The best/recommended way to translate Django database values

13,979

Solution 1

I was reading up on my django extensions, and found the django-modeltranslation plugin. It seems to do exactly what you want it to do.

Solution 2

I also found this small project which purpose is to synchronize localized strings into standard message files for fields of registered models.

Example:

import vinaigrette
vinaigrette.register(YourModel, ['name', 'description'])

The standard command

$ manage.py makemessages

Would maintain messages for each distinct values found in registered fields.

I have not had the occasion to try it yet.
But this seems for me to be the simplest way to translate data from db.

Share:
13,979
sa125
Author by

sa125

Updated on June 06, 2022

Comments

  • sa125
    sa125 almost 2 years

    I'm trying to figure out the best way to translate actual database values (textual strings, not date formats or anything complicated) when internationalizing my Django application. The most logical ways I could come up with were to either:

    • hold a database column for every language (e.g. description_en, description_de, description_fr, ...) or
    • have a different database for every language (e.g. schema_en, schema_fr, schema_de, ...).

    Are these the best options, or is there something else I'm missing? Thanks.