#11384: Django Internationalization override translation mechanisim not working
as
expected
-------------------------------------------+--------------------------------
Reporter: alfredo | Owner: garcia_marc
Status: new | Milestone:
Component: Internationalization | Version: 1.0
Resolution: | Keywords:
internationalization translation overrride not-working
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Old description:
> The internationalization override is not working as expected
>
> The documentation says:
>
> *** you can write applications that include their own translations, and
> you can override base translations in your project path.*** Or, you can
> just build a big project out of several apps and put all
> translations into one big project message file. The choice is yours.
>
> Which makes perfect sense to have distributable apps and be able to
> override such translations provided with the app
>
> http://docs.djangoproject.com/en/dev/topics/i18n/#using-translations-in-
> your-own-projects
>
> But having a distributable app with its translation, living outside the
> project path, lets say:
>
> $VIRTUALENV/$APPPATH/locale/<language>/LC_MESSAGES/django.po
> $VIRTUALENV/$APPPATH/locale/<language>/LC_MESSAGES/django.mo
>
> And trying to override such translation with:
>
> $PROJECTPATH/locale/<language>/LC_MESSAGES/django.po
> $PROJECTPATH/locale/<language>/LC_MESSAGES/django.mo
>
> It will pick up the translation from the app ignoring the one in the
> project path.
>
> Looking at the code I can see that the translation on the project path
> gets to be called first
>
> http://code.djangoproject.com/browser/django/trunk/django/utils/translation/trans_real.py#L176
>
> and then the translations on the external apps which overrides the
> translations already picked up in the project path.
>
> It looks like the answer would be to load first the translation of the
> apps and then the translations in the project path. I've tried switching
> them and it worked for me.
>
> Thank you!
New description:
The internationalization override is not working as expected
The documentation says:
'''you can write applications that include their own translations, and you
can override base translations in your project path.''' ''Or, you can just
build a big project out of several apps and put all translations into one
big project message file. The choice is yours.''
Which makes perfect sense to have distributable apps and be able to
override such translations provided with the app
http://docs.djangoproject.com/en/dev/topics/i18n/#using-translations-in-
your-own-projects
But having a distributable app with its translation, living outside the
project path, lets say:
{{{
$VIRTUALENV/$APPPATH/locale/<language>/LC_MESSAGES/django.po
$VIRTUALENV/$APPPATH/locale/<language>/LC_MESSAGES/django.mo
}}}
And trying to override such translation with:
{{{
$PROJECTPATH/locale/<language>/LC_MESSAGES/django.po
$PROJECTPATH/locale/<language>/LC_MESSAGES/django.mo
}}}
It will pick up the translation from the app ignoring the one in the
project path.
Looking at the code I can see that the translation on the project path
gets to be called first
http://code.djangoproject.com/browser/django/trunk/django/utils/translation/trans_real.py#L176
and then the translations on the external apps which overrides the
translations already picked up in the project path.
It looks like the answer would be to load first the translation of the
apps and then the translations in the project path. I've tried switching
them and it worked for me.
Thank you!
Comment (by ramiro):
(reformatted description)
--
Ticket URL: <http://code.djangoproject.com/ticket/11384#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.