2

I just got done setting up languages in Django via this tutorial: http://devdoodles.wordpress.com/2009/02/14/multi-language-support-in-a-django-project/

Now that I have it live and working, I've discovered it will default to showing the message IDs if I don't have the user's locale.

Because I don't intend on supporting every locale in the whole wide world, can I set it to show the english locale by default instead? Right now my site says "title" to germans instead of the name of the site.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Adam Grant
  • 12,477
  • 10
  • 58
  • 65

2 Answers2

1

Just use the English translations as the message IDs.

If you need a more detailed introductin to the translation of text with Django, you can look here.

Philipp Zedler
  • 1,660
  • 1
  • 17
  • 36
  • 1
    I see. Even in the case of a paragraph of text? Seems like an odd way to do it, if I change the paragraph, I'd have to go into each translation file and change the IDs as well. – Adam Grant Dec 11 '12 at 17:35
  • 1
    It works even for paragraphs. And Django's text translation system is quiet smart. If you change only parts of your paragraph, Django will recognize the similarity. You will find the changed paragraph in the file *.po together with the old transition, marked as "fuzzy". – Philipp Zedler Dec 12 '12 at 08:45
  • Okay, that sounds good. It's working very well for me now. Thank you. – Adam Grant Dec 12 '12 at 17:59
1

If you prefer to explicitly determine what languages you allow, you can set the variable LANGUAGES in your settings file, which is described here. An example:

LANGUAGES = (
    ('de', 'German'),
    ('en', 'English'),
)

Then, for all other countries your standard language (details here) will be used. This is en-us by default.

Philipp Zedler
  • 1,660
  • 1
  • 17
  • 36