Opened 10 years ago

Closed 6 years ago

#1668 closed defect (duplicate)

Translate module names via make-messages.py

Reported by: Rudolph Froger Owned by: hugo
Component: Internationalization Version: master
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: UI/UX:

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)

make-messages.diff (994 bytes) - added by Evren Esat Özkan <sleytr@…> 9 years ago.
make-messages.py patch to add app names to django.po file
django_admin_index.html.diff (601 bytes) - added by Evren Esat Özkan <sleytr@…> 9 years ago.
admin index.html patch to change blocktrans to trans for app.names

Download all attachments as: .zip

Change History (17)

comment:1 Changed 10 years ago by Adrian Holovaty

Resolution: invalid
Status: newclosed

I'm not exactly sure what this means. Please reopen if it's still a problem.

comment:2 Changed 10 years ago by hugo

Resolution: invalid
Status: closedreopened

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 Changed 10 years ago by anonymous

milestone: Version 0.92Version 1.0
Version: magic-removalSVN

comment:4 Changed 10 years ago by hugo

Resolution: wontfix
Status: reopenedclosed

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 Changed 10 years ago by Rudolph Froger

Resolution: wontfix
Status: closedreopened

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:6 Changed 10 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:7 Changed 10 years ago by Simon G. <dev@…>

Keywords: i18n translate module added
Summary: Module name doesn't get translated in M-RTranslate module names via gettext_noop
Triage Stage: UnreviewedDesign decision needed

comment:8 Changed 9 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: reopenedclosed

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 Changed 9 years ago by Evren Esat Özkan <sleytr@…>

Has patch: set
Resolution: wontfix
Status: closedreopened

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.

Changed 9 years ago by Evren Esat Özkan <sleytr@…>

Attachment: make-messages.diff added

make-messages.py patch to add app names to django.po file

Changed 9 years ago by Evren Esat Özkan <sleytr@…>

admin index.html patch to change blocktrans to trans for app.names

comment:10 Changed 9 years ago by Evren Esat Özkan <sleytr@…>

Summary: Translate module names via gettext_noopTranslate module names via make-messages.py

comment:11 Changed 9 years ago by Antti Kaihola

Cc: akaihol+django@… added

comment:12 Changed 9 years ago by Antti Kaihola

I think #3591 is related.

comment:13 Changed 9 years ago by Jacob

Triage Stage: Design decision neededAccepted

comment:14 Changed 7 years ago by Torsten Bronger

Cc: bronger@… added

comment:15 Changed 6 years ago by Adam Nelson

Resolution: duplicate
Status: reopenedclosed

#3591 is the more active ticket on this so this should be duplicate - even though it's older.

Note: See TracTickets for help on using tickets.
Back to Top