1

I want to internationalize my django app. After playing around according to the documentation and following this question here I realized I don't need most of these options.

In my settings file I only use this:

USE_I18N = True

USE_L10N = True

USE_TZ = True

LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'locale'),
)

So I got rid off LANGUAGE_CODE and also didn't define any LANGUAGES.

Then I only added this to my views

from django.utils import translation

created language translations with django-admin.py makemessages -l fr and django-admin.py compilemessages and translated the messages in the .po file.

Now when I set the browser preference (Chrome) to French, all the text within {% trans my text %} in the html shows up translated. I guess it's explained here on a higher level, I am just a little confused that it is that simple. Or is this just a hack that I am using?

Community
  • 1
  • 1
Tom
  • 2,545
  • 5
  • 31
  • 71

0 Answers0