Answer the question
In order to leave comments, you need to log in
Correct approach to organize i18n phrase structure in django?
Share your experience on how to better organize the translation of phrases in a bilingual project (Russian and English)? In order not to run into a rake in half a year, when the project will already be strongly tied to one of the options.
1. Write {% trans 'header_menu_news' %} in templates, create 2 files -ru and -en and translate the phrase into your language there
2. Write {% trans 'News' %} in templates and create only -en option, and -ru will be displayed by default (judging by the documentation, django is made for this option, but there is English by default)
3. Some other option?
Answer the question
In order to leave comments, you need to log in
This issue has been discussed by the community for a long time, but no one has come to a single option, so everyone uses the option to their taste. Personally, I use the second option.
Pros:
+ the translator does not need to keep two .po files open, since the text for translation is the key
+ if there is no translation for the key, then a clear value will be displayed, which in which case the user can translate, and not a stub like header_menu_news
Cons:
- if necessary change the original text, you will have to search the entire project for the use of this key and change it, although in the first option it would be enough to change only in the .po file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question