My recent experience with using django-admin.py makemessages is that this command only works when there is a subdirectory present named 'locale' that sits just below where you are executing this command. Without a 'locale' subdirectory present, the command will raise an error. I think by design it only makes translation files for the user created project/apps. You can exclude parts of your project.
-- http://stackoverflow.com/questions/9973584/django-admin-makemessages-translate-all-django-package-with-mine
I am not sure if that helped.
On Friday, May 30, 2014 9:57:40 AM UTC-7, Selenite Vingt-Neuf wrote:
On Friday, May 30, 2014 9:57:40 AM UTC-7, Selenite Vingt-Neuf wrote:
Hi,I'm writing authentication templates using authentication views provided by Django, and for that purpose I am reusing translation messages present in django.contrib.admin.That works very well at the execution time, Django understands that translation messages already exist in django.contrib.admin and display them in the requested language (French in my case).My concern is that "django-admin.py makemessages -a" command doesn't understand just as well and it creates those translation messages again in my auth app's locale files. But I don't need them, or at least commented as #fuzzy. Is it the normal behavior of that command or am I doing wrong ?Below is the example with the message "Reset my password":In django.contrib.admin locale files:- path/to/python2.7/sites-packages/django/contrib/admin/ locale/en/LC_MESSAGES/django. py #: templates/registration/password_reset_form.html:21 msgid "Reset my password"msgstr ""- path/to/python2.7/sites-packages/django/contrib/admin/ locale/fr/LC_MESSAGES/django. py #: templates/registration/password_reset_form.html:21 msgid "Reset my password"msgstr "Réinitialiser mon mot de passe"In my password_reset template of my auth app:- auth/templates/auth/password_reset.html: {% load i18n %}<input type="submit" value="{% trans "Reset my password" %}" />In my auth app's locale files after typing "cd path/to/myproject; cd auth; django-admin.py makemessages -a":- auth/locale/en/LC_MESSAGES/django.po: #: templates/auth/password_reset.html:36 msgid "Reset my password"msgstr ""- auth/locale/en/LC_MESSAGES/django.po: #: templates/auth/password_reset.html:36 msgid "Reset my password"msgstr ""Here my settings:- myproject/settings.py:MIDDLEWARE_CLASSES = ('django.middleware.cache.UpdateCacheMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware. AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking. XFrameOptionsMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', )LANGUAGE_CODE = 'en-us'LANGUAGES = (('fr', _('French')),('en', _('English')),)TIME_ZONE = 'UTC'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = TrueHere my config:- Mac OS X 10.9.2- python 2.7.6- gettext 0.18.3 (installed via homebrew)Thanks for your help.Cheers,Selenite Vingt-Neuf
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ce57726-5f35-43cb-9c2e-3eb22592c862%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment