What is the best way to change the language files in Django
I want to change some of the strings in the language file for my language in Django. I can of course just change the .po file, but that seems unwise because if I update Django the file will be changed again. What is the best way to do this?
I don't care if the solution is for the specific app I'm working on or for my entire Django开发者_JAVA技巧 installation.
From the docs:
Django looks for translations by following this algorithm:
- First, it looks for a locale directory in the application directory of the view that's being called. If it finds a translation for the selected language, the translation will be installed.
- Next, it looks for a locale directory in the project directory. If it finds a translation, the translation will be installed.
- Finally, it checks the Django-provided base translation in django/conf/locale.
So just create a locale
directory for your project and overwrite your messages in there.
精彩评论