Opened 13 years ago
Closed 10 years ago
#17246 closed Cleanup/optimization (wontfix)
title localization
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.3 |
Severity: | Normal | Keywords: | title main.py base.html |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
hi.
I am working on translation of my django app and i have one trouble
localized name of the model looks ugly when the template renders in admin page
in russian language the words have many variations that depends of context
for example I have 'user' model that translates as 'Пользователь'
but in context 'Select %s to change' it looks as 'Пользователя'
I can't override the base.html template because it gets {{ title }} variable that already incorrect in sentence context
I think that bulding of the strings like this must processed in template
for example in base.html:
was:
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
must:
{% block content_title %}{% if title %}<h1>Select {{ title }} to change'</h1>{% endif %}{% endblock %}
of course the result block will be bigger than in my example, but nevertheless this is more flexible approach.
Can you fix it?
Change History (7)
comment:1 by , 13 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → reopened |
comment:3 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
In fact this is a duplicate of #16973.
comment:4 by , 13 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
Triage Stage: | Unreviewed → Accepted |
I'm no longer sure it was right to close this ticket. While I still don't understand the solution proposed by the OP, the problem looks valid.
This proposal could help fixing it.
comment:5 by , 13 years ago
The problem described here is string interpolation. In some languages simply sticking the verbose name into a template results in grammatically incorrect phrase.
Ramiro's proposal mentioned above does not really address this problem as it primarily deals with pluralization.
While this is a real problem, I'd say it should be marked as "won't fix" for 3 reasons:
1) Language generation is a rather non-trivial problem that is not specific to Django.
2) There is a simple but someone ugly workaround. Translators may choose to localize the offending template string in such a way that interpolating generic verbose form works for their locale. The resulting phrase often looks rather artificial but is at least grammatically correct (e.g., "Select object to change: user" instead of "Select user to change").
3) The proposed solution is ineffective. Whether we localize this in code (Select %s to change
) or in template (Select {{ title }} to change
) - the result is still the same.
comment:6 by , 12 years ago
Status: | reopened → new |
---|
comment:7 by , 10 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Closing as won't fix for now. As stated by shelldweller above, the best solution currently is to workaround this issue at the translation level, by reformulating the sentence (comment:5, point 2))
I'm sorry, but I don't grasp how the change you're proposing resolves the problem.
Won't
{{ title }}
still be defined by theverbose_name
of your model?Did I miss something?