6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-09-27 19:59:02 +00:00

docs: non-ascii locales must specify a content-type

See: https://discuss.overhang.io/t/translating-login-registration-page/1378/3

This should also address issue #410.
This commit is contained in:
Régis Behmo 2021-03-30 11:51:06 +02:00 committed by Régis Behmo
parent f2ab27199e
commit 5cff808ee7

View File

@ -298,9 +298,17 @@ The language code should be similar to those used in edx-platform or openedx-i18
Then, add a "django.po" file there that will contain your custom translations::
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8"
msgid "String to translate"
msgstr "你翻译的东西 la traduction de votre bidule"
.. warning::
Don't forget to specify the file ``Content-Type`` when adding message strings with non-ASCII characters; otherwise a ``UnicodeDecodeError`` will be raised during compilation.
The "String to translate" part should match *exactly* the string that you would like to translate. You cannot make it up! The best way to find this string is to copy-paste it from the `upstream django.po file for the English language <https://github.com/edx/edx-platform/blob/open-release/koa.2/conf/locale/en/LC_MESSAGES/django.po>`__.
If you cannot find the string to translate in this file, then it means that you are trying to translate a string that is used in some piece of javascript code. Those strings are stored in a different file named "djangojs.po". You can check it out `in the edx-platform repo as well <https://github.com/edx/edx-platform/blob/open-release/koa.2/conf/locale/en/LC_MESSAGES/djangojs.po>`__. Your custom javascript strings should also be stored in a "djangojs.po" file that should be placed in the same directory.
@ -315,11 +323,19 @@ To recap, here is an example. To translate a few strings in French, both from dj
With django.po containing::
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8"
msgid "It works! Powered by Open edX{registered_trademark}"
msgstr "Ça marche ! Propulsé by Open edX{registered_trademark}"
And djangojs.po::
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8"
msgid "%(num_points)s point possible (graded, results hidden)"
msgid_plural "%(num_points)s points possible (graded, results hidden)"
msgstr[0] "%(num_points)s point possible (noté, résultats cachés)"