abisson
abisson

Reputation: 4425

Django internalization not working, followed tutorials step-by-step

I am really getting annoyed by this. So I have the following structure:

project/
   project/
   locale/
      fr/
        locale/
          LC_MESSAGES/
              django.po
              django.mo
   templates/

I have

USE_I18N = True

USE_L10N = True

LANGUAGE_COOKIE_NAME = 'django_language'

LOCALE_PATHS = '/Users/xxxx/Programming/Projects/xxxx/locale'

LANGUAGES = ( ('en', gettext_noop('English')), ('fr', gettext_noop('French')), )

I mostly have my strings to translate in my templates which are in the templates directory.

Within my app, it seems like I am setting the language correctly, since I can see the django password forms are changing from French to English. It is just MY templates are not getting translated.

Thanks!

Upvotes: 2

Views: 182

Answers (1)

andrea.ge
andrea.ge

Reputation: 1987

LOCALE_PATHS is a tuple, as stated in https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths

If you provide a string, Django considers it as a tuple (of characters) and probably loops through all the characters one by one, looking for templates in there.

If you have a single directory remember to write it as a tuple, i.e. ('string', ) and not ('string'), if you have more then ('string1', 'string2') is fine.

Upvotes: 1

Related Questions