views:

37

answers:

2

My app has tables for languages and countries (actually django-countries at the moment, but open for suggestions). The tables are populated when I initialize the database and remain static after that.

What would be the ideal localization mechanism for the contents of these tables, so that I can show the country and language names to users in their chosen site language?

I'm aware of projects like django-multilingual and transdb, but IMO they are more suitable for dynamic content, i.e. stuff that's supposed to be modified.

Please englighten me!

A: 

Maybe I'm missing something here, but why just not use [un]gettext, i.e. {% trans lang_from_db %} and _(lang_from_db)?

Alternatively, hardcode language names translated in their own language into database, e.g "English", "Svenska", "Suomi", etc.

jholster
A: 

@Yaggo

No, I think I missed some stuff.

I'm using a modelform for the selections. I'm wondering if hacking the form (to override the selection labels with gettext) is a good way to achieve the localization.

Also, I'm trying to get to the point where all strings can be translated at once, through .po-files. Having an outsider translator enter the translations into database isn't feasible.

I wouldn't really call the hardcoding-alternative localization, though...

man with python