Skip to content

Translations

deby edited this page Feb 16, 2023 · 31 revisions

↑ Parent: Advanced tutorials

← Previous: Enable and disable existing collections and pages

Generate the translations terms

You will need to clone all the repositories of all the projects under the Circles family that use MagiCircles. See list of all repositories.

WIP script to generate all translations

Add a new language

  1. Where should the language be added?

    • If he language is at 100%:
      • The language should be added to the MagiCircles repo
    • Otherwise:
      • The language should be added to the site only
  2. Find:

    • the language(s) code from the list of languages
    • the language name in its native language (replace language in URL) https://github.com/django/django/blob/master/django/conf/locale/tr/LC_MESSAGES/django.po
  3. Add the language to the list of available languages:

    LANGUAGES = (
        ...
        ('tr', _('Turkish')),
    )
    ...
    NATIVE_LANGUAGES = (
        ...
        ('tr', u'Türkçe'),
    )
    • MagiCircles:
      1. sample_project/sample_project/settings.py
      2. For all the projects that use the latest version of MagiCircles: ${PROJECT}_project/settings.py
    • Single site:
      1. ${PROJECT}_project/settings.py
  4. If the language uses a non-latin charset (example: Russian, Chinese, ...), it should be added to the list of non-latin languages (can only be done at MagiCircles level):

    magi/item_model.py:

    NON_LATIN_LANGUAGES = [... in [... , 'el']]
  5. If people who speak this language are more likely to not be able to speak English, it should be added to the default list of languages that cant speak English.

    • MagiCircles:
      • magi/default_settings.py, DEFAULT_LANGUAGES_CANT_SPEAK_ENGLISH
    • Single site:
      • ${PROJECT}/settings.py, extend LANGUAGES_CANT_SPEAK_ENGLISH
  6. Check that the short code is the same for Google Translate by changing the source to the right language and looking at the URL value of sl. You can also look for it in ISO639-2 documentation. If it's different, update the dict RFC3066_TO_ISO6392 in magi/raw.py.

  7. Download the flag(s) image(s) from this list

  8. Upload the flag(s) image(s) to the static repository + S3

    • MagiCircles:
      • Add to repo magi/static/img/language/tr.png
      • Upload to all s3 of all sites in static/img/language/
    • Single site:
      • Add to repo ${PROJECT}/static/img/language/tr.png (create the folder if it doesn't exist)
      • Upload to s3 site static/img/language/tr.png
  9. Create and commit an empty file for the language(s) (MagiCircles: for all sites):

    PROJECT='bang' # see Local setup guide to find each project short name
    NEWLANGS='tr' # for multiple languages: 'ru fr zh_Hans de tr it id kr pt_BR pl zh_Hant ja es vi pt'
    git add -p ${PROJECT}_project/settings.py
    for lang in $NEWLANGS; do mkdir -p $PROJECT/locale/$lang/LC_MESSAGES/ && touch $PROJECT/locale/$lang/LC_MESSAGES/django.po; done
    for lang in $NEWLANGS; do git add $PROJECT/locale/$lang/LC_MESSAGES/django.po; done
    git commit -m "Add new language(s) $NEWLANGS"

    ⚠️ Some languages have a different folder name from their code. Find the right folder name here.

  10. MagiCircles: Update the production guide to include the right folder name in section "Link translations POEditor → GitHub".

  11. Link the file(s) with POEditor:

Make sure you check the box "Also get a .mo file with the same filename on export."

  1. Export the translation from POEditor to GitHub.

  2. Pull on your local and test.

    • Go to /translations_check/ to see the list of formatting errors. If any in the new language, reach out to the translation team on Discord to ask them to fix the errors, then export translations to GitHub again.
  3. Deploy to production.

  4. Bonus: It's always good to announce it 😊

    Here are some example tweets and graphics:

    Example of new language announcements Example of new language announcements Example of new language announcements Example of new language announcements

ℹ︎ See also: Coding style

I. Introduction

II. Tutorials

  1. Collections
    1. MagiModel
    2. MagiCollection
    3. MagiForm
    4. MagiFiltersForm
    5. MagiFields
  2. Single pages
  3. Configuring the navbar

III. References

IV. Utils

V. Advanced tutorials

VI. More

Clone this wiki locally