From 6830b03fb2664c7262a0e5acd63671e59879ebd6 Mon Sep 17 00:00:00 2001 From: Danhia Date: Wed, 16 Feb 2022 12:45:55 +0100 Subject: [PATCH] Update 'Internationalization' --- Internationalization.md | 132 ++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/Internationalization.md b/Internationalization.md index 2edd6c7..9d81909 100644 --- a/Internationalization.md +++ b/Internationalization.md @@ -1,66 +1,66 @@ -# Internationalization - -Internationalization configuration in `settings.py` : - -```python -# Internationalization -# https://docs.djangoproject.com/en/2.2/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -LANGUAGE_COOKIE_NAME = 'django_language' - -USE_I18N = True - -LANGUAGES = ( - ('en', _("English")), - ('de', _('German')), - ('fr', _('French')), - ('ru', _('Russian')), -) - -``` -`LANGUAGES` list of languages supported. - - -## Locale directory - -All lang files where traductions is stored are located into `locale/`. - -For translations, edit file `locale/[lang]/django.po` : - -```python - -#: accounts/templates/accounts/edit.html:44 -msgid "Connected accounts" -msgstr "" - -#: accounts/templates/accounts/edit.html:51 -msgid "Disconnect Discord" -msgstr "" - -``` - -For all `messages`, we have a list of `path to files` containing this `message` and line number. - -Edit `msgstr` with the translated string. - - -## Make messages -To create all .po files, run this command : -```bash -django-admin makemessages -l [LANG_CODE] -``` - -`LANG_CODE` for exemple can be set to 'ru', 'fr', 'en'... - -## Compile `messages` - -To compile messages run this command : - -```bash -manage.py compilemessages -``` - -## Contributing -Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. +# Internationalization + +Internationalization configuration in `settings.py` : + +```python +# Internationalization +# https://docs.djangoproject.com/en/2.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +LANGUAGE_COOKIE_NAME = 'django_language' + +USE_I18N = True + +LANGUAGES = ( + ('en', _("English")), + ('de', _('German')), + ('fr', _('French')), + ('ru', _('Russian')), +) + +``` +`LANGUAGES` list of languages supported. + + +## Locale directory + +All lang files where traductions are stored are located into `locale/` and `ressources/locale`. + +For translations, edit file `locale/[lang]/django.po` : + +```python + +#: accounts/templates/accounts/edit.html:44 +msgid "Connected accounts" +msgstr "" + +#: accounts/templates/accounts/edit.html:51 +msgid "Disconnect Discord" +msgstr "" + +``` + +For all `messages`, we have a list of `path to files` containing this `message` and line number. + +Edit `msgstr` with the translated string. + + +## Make messages +To create all .po files, run this command : +```bash +django-admin makemessages -l [LANG_CODE] +``` + +`LANG_CODE` for exemple can be set to 'ru', 'fr', 'en'... + +## Compile `messages` + +To compile messages run this command : + +```bash +manage.py compilemessages +``` + +## Contributing +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.