-
Notifications
You must be signed in to change notification settings - Fork 11
Translations
↑ Parent: Advanced tutorials
← Previous: Enable and disable existing collections and pages
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
-
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
- If he language is at 100%:
-
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
-
Add the language to the list of available languages:
LANGUAGES = ( ... ('tr', _('Turkish')), ) ... NATIVE_LANGUAGES = ( ... ('tr', u'Türkçe'), )
- MagiCircles:
sample_project/sample_project/settings.py
- For all the projects that use the latest version of MagiCircles:
${PROJECT}_project/settings.py
- Single site:
${PROJECT}_project/settings.py
- MagiCircles:
-
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']]
-
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
, extendLANGUAGES_CANT_SPEAK_ENGLISH
-
- MagiCircles:
-
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 dictRFC3066_TO_ISO6392
inmagi/raw.py
. -
Download the flag(s) image(s) from this list
-
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/
- Add to repo
- 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
- Add to repo
- MagiCircles:
-
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. -
MagiCircles: Update the production guide to include the right folder name in section "Link translations POEditor → GitHub".
-
Link the file(s) with POEditor:
Make sure you check the box "Also get a .mo file with the same filename on export."
-
Export the translation from POEditor to GitHub.
-
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.
- Go to
-
Deploy to production.
-
Bonus: It's always good to announce it 😊
Here are some example tweets and graphics:
ℹ︎ See also: Translate fields values in multiple languages
ℹ︎ See also: Coding style
→ Next: Page titles and descriptions
I. Introduction
II. Tutorials
III. References
- Files tree
- Default collections
- Default pages
- Website settings
- MagiCollection settings
- Abstract models
- Abstract collections
- MagiForm settings
- MagiFiltersForm settings
- Single pages settings
IV. Utils
-
MagiModel utils
- MagiModel images and files
- DateTime fields
- BaseAccount model
- Save choices values as integer rather than strings
- Store comma separated values
- Store dictionaries
- Store Markdown texts
- Translate fields values in multiple languages
- Store JSON
- More model field types
- Transform images before saving them
- Check choices at form level instead of model level
- Use an internal cache for foreign keys in models
- Customize views with MagiModel properties
- Events
- Form utils
- Python utils
- Templates utils
- Javascript utils
- Enable and disable existing collections and pages
- Translations
- Page titles and descriptions
- Characters
- Seasons
- Roles and permissions
- Allow your staff team to change configurations
- Custom users preferences and settings
- Background illustrations
- Activities tabs
- Corner popups
VI. More