Opened 19 years ago
Closed 15 years ago
#1668 closed defect (duplicate)
Translate module names via make-messages.py
Reported by: | Rudolph Froger | Owned by: | hugo |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | normal | Keywords: | i18n translate module |
Cc: | akaihol+django@…, bronger@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Translation of the module name on te frontpage of the admin
interface. I understood this should be done in the init.py file,
like this (put this in the docs!):
from django.utils.translation import gettext_noop gettext_noop('my module name')
When running make-messages.py, I can see the string appear in the PO
file. But the Admin interface still uses the untranslated string (at several places).
Attachments (2)
Change History (17)
comment:1 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
The problem is, the admin doesn't try to translate module names - not even it's own module names it delivers with django. There was some discussion about this in the group:
http://groups.google.com/group/Django-I18N/browse_thread/thread/5f262db230bb393d
This could be incorporated in some way into the basic source - like adding gettext_noop() calls with the application names to some places, maybe __init__.py
or some other code. It could even be some dummy line in the model definition - the gettext stuff doesn't care.
The idea is just to put a translation hook into some python file and to use the translation calls in the admin templates, so that application names can be translated as other stuff.
The only problem with this - and that's why I not just put in this solution - is that you would have to write the application name explicitely somewhere down. Currently it is taken from the module name, so this would be repetition for the sake of translation.
Comments?
comment:3 by , 18 years ago
milestone: | Version 0.92 → Version 1.0 |
---|---|
Version: | magic-removal → SVN |
comment:4 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Since nobody had any good suggestions and the solutions involved are rather hacky, I close this for now. Anybody with a good idea on how to solve this can open a new ticket. preferably with patch ;)
comment:5 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
How about doing it like this in a models.py file:
VERBOSE_NAME = _('polls') class Poll(models.Model): question = CharField(_('question'), maxlength=50) etc. etc.
comment:7 by , 18 years ago
Keywords: | i18n translate module added |
---|---|
Summary: | Module name doesn't get translated in M-R → Translate module names via gettext_noop |
Triage Stage: | Unreviewed → Design decision needed |
comment:8 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
I'm going to close this for the same reason it was originally closed: nobody has come up with a good solution. Any acceptable solution will not require rewriting the model name again and will ideally not require running import on the Python file to extract the string name (because that can have side-effects when extracting the strings, including security problems).
Please don't reopen this ticket without first bringing up suggestions on the django-developers list.
comment:9 by , 17 years ago
Has patch: | set |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
I've created a patch for make-messages.py to add app names to
django.po file. With this patch, make-messages.py creates a temporary html file with installed app
names first, then runs make_messages() and removes temporary file.
I also changed the admin/index.html template because it's not translate app.names with blocktrans tag.
by , 17 years ago
Attachment: | make-messages.diff added |
---|
make-messages.py patch to add app names to django.po file
by , 17 years ago
Attachment: | django_admin_index.html.diff added |
---|
admin index.html patch to change blocktrans to trans for app.names
comment:10 by , 17 years ago
Summary: | Translate module names via gettext_noop → Translate module names via make-messages.py |
---|
comment:11 by , 17 years ago
Cc: | added |
---|
comment:13 by , 17 years ago
Triage Stage: | Design decision needed → Accepted |
---|
comment:14 by , 15 years ago
Cc: | added |
---|
comment:15 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
#3591 is the more active ticket on this so this should be duplicate - even though it's older.
I'm not exactly sure what this means. Please reopen if it's still a problem.