Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django internationalization and translations issue

I have a problem with django translations.

Problem 1 - I updated string in django.po file, but the change does not appear on the webpage.

Problem 2 - I have created my own locale file with django-admin.py makemessages -l et, added the translation string into file, but they too do not appear on the page.

I do not think this is setting problem, because the translations from django.po file do appear on the website, its just the changes and the translations from my own generated file that do not appear.

Edit: My settings.py contains this:

gettext = lambda s: s
LANGUAGE_CODE = 'et'

LANGUAGES = (
             ('et', gettext('Estonian')),
             )

my own locale files are in

/path/to/project/locale/et/LC_MESSAGES/

and the files are

django.mo and django.po

the file I refer to in problem 1 is django own et transaltion, which I changed.

like image 492
Odif Yltsaeb Avatar asked Apr 14 '10 17:04

Odif Yltsaeb


2 Answers

Well, I got this same error a few moments ago. I solved it deleting the "#, fuzzy" tag over the translation strings in my django.po files. It seems that translated text is not served if it got this tag, so make sure to translate the text and then delete this line.

Here is an example of a translated text not server on a po file:

     #: course/models.py:13
     #, fuzzy
     msgid "code"
     msgstr "código"

So, just delete the flag and leave it like this:

     #: course/models.py:13
     msgid "code"
     msgstr "código"

I hope this work for you. Good luck!

Reference: http://share-experiences.com/blog/what-fuzzy-means-python-django-gettext/

PD: I know you got this issue a few month ago, but I leave this response due that you we never heard if you got this problem solved.

like image 177
FernandoEscher Avatar answered Sep 21 '22 15:09

FernandoEscher


Had a same/similar issue with translations not showing up. Setting the LOCALE_PATHS fixed the issue:

# settings.py
USE_I18N = True
USE_L10N = True

LOCALE_PATHS = (
  '/path/to/djangoapp/locale',
)
like image 33
jmu Avatar answered Sep 24 '22 15:09

jmu