agateblue / django-dynamic-preferences

Dynamic global and instance settings for your django project
https://django-dynamic-preferences.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
346 stars 86 forks source link

[Question] Localized Text preference #228

Closed ondrejkolin closed 3 years ago

ondrejkolin commented 3 years ago

I want to add a string which differs in every language in my Django app. Is this possible with django-dynamic-preferences?

agateblue commented 3 years ago

We don't offer any localization mechanism, but I can see several ways to support this:

  1. Create a single preferences that store the strings as a JSON object with locales as keys and translated strings as values (example : {"en": "My string", "fr": "Ma chaîne"})
  2. You can also create one preference per locale, but this approach is probably less flexible because you'd have to edit the code everytime you add a new locale
ondrejkolin commented 3 years ago

Ok, that is a fair answer to my problem!