32 lines
926 B
Markdown
32 lines
926 B
Markdown
|
|
# how to do django translation
|
||
|
|
|
||
|
|
[https://docs.djangoproject.com/es/1.9/topics/i18n/translation/]()
|
||
|
|
|
||
|
|
|
||
|
|
#### translation for templates
|
||
|
|
|
||
|
|
[https://docs.djangoproject.com/es/1.9/topics/i18n/translation/#translator-comments-in-templates]()
|
||
|
|
|
||
|
|
#### language switching
|
||
|
|
|
||
|
|
[https://docs.djangoproject.com/es/1.9/topics/i18n/translation/#switching-language-in-templates]()
|
||
|
|
|
||
|
|
#### how to create language files
|
||
|
|
|
||
|
|
[https://docs.djangoproject.com/es/1.9/topics/i18n/translation/#localization-how-to-create-language-files]()
|
||
|
|
|
||
|
|
|
||
|
|
you have to set the -e extension to specify files you want to use. e.g.
|
||
|
|
|
||
|
|
`django-admin makemessages -e django`
|
||
|
|
|
||
|
|
`fab django.admin:"makemessages -l en -e django"`
|
||
|
|
|
||
|
|
after creating the .po files you have to compile them for use
|
||
|
|
|
||
|
|
`django-admin compilemessages`
|
||
|
|
|
||
|
|
`fab django.admin:"compilemessages"`
|
||
|
|
|
||
|
|
### set langauge redirect
|
||
|
|
[https://docs.djangoproject.com/es/1.9/topics/i18n/translation/#the-set-language-redirect-view]()
|