The best/recommended way to translate Django database values

前端 未结 3 1772
陌清茗
陌清茗 2020-12-13 19:47

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 appl

相关标签:
3条回答
  • 2020-12-13 19:53

    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.

    0 讨论(0)
  • 2020-12-13 19:53

    You could take a look at the following thread which seems to be the same question you're asking here.

    I wouldn't mind hearing the solution you eventually will be using as sometime in the future I might have the same question:)

    0 讨论(0)
  • 2020-12-13 20:04

    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.

    0 讨论(0)
提交回复
热议问题