-
Notifications
You must be signed in to change notification settings - Fork 11
Avoid generating translation terms for terms already available in Django framework
deby edited this page Oct 18, 2018
·
4 revisions
↑ Parent: Python Utils
← Previous: Validators
Every time you add a new term to translate, check if it's not already provided by the Django Framework, to avoid adding more work to our translators when the terms don't need to be transated again.
If it is, add it in or create a file ${PROJECT}/django_translated.py
like so:
from django.utils.translation import ugettext_lazy as _
from magi.django_translated import t
t.update({
'Japanese': _('Japanese'),
})
When you want to use the term, do:
from .django_translated import t
print t['Japanese']
When generating the terms, make sure you don't include the terms in this file:
python manage.py makemessages ... --ignore=${PROJECT}/django_translated.py
See ⎡Translations⎦.
→ Next: Use generated settings
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