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)

make-messages.diff (994 bytes ) - added by Evren Esat Özkan <sleytr@…> 17 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@…> 17 years ago.
admin index.html patch to change blocktrans to trans for app.names

Download all attachments as: .zip

Change History (17)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: invalid
Status: newclosed

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

comment:2 by hugo, 18 years ago

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 by anonymous, 18 years ago

milestone: Version 0.92Version 1.0
Version: magic-removalSVN

comment:4 by hugo, 18 years ago

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 by Rudolph Froger, 18 years ago

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 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:7 by Simon G. <dev@…>, 18 years ago

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 by Malcolm Tredinnick, 18 years ago

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

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.

by Evren Esat Özkan <sleytr@…>, 17 years ago

Attachment: make-messages.diff added

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

by Evren Esat Özkan <sleytr@…>, 17 years ago

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

comment:10 by Evren Esat Özkan <sleytr@…>, 17 years ago

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

comment:11 by Antti Kaihola, 17 years ago

Cc: akaihol+django@… added

comment:12 by Antti Kaihola, 17 years ago

I think #3591 is related.

comment:13 by Jacob, 17 years ago

Triage Stage: Design decision neededAccepted

comment:14 by Torsten Bronger, 15 years ago

Cc: bronger@… added

comment:15 by Adam Nelson, 15 years ago

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