Skip to content
evgenyfadeev edited this page Sep 13, 2010 · 22 revisions

Currently cnprog “understands” Chinese, English and Spanish.

To translation to another language – you need to work on two files:

  • /locale/lang_code/LC_MESSAGES/django.po
  • /templates/content/js/com.cnprog.i18n.js

Steps to translate django.po file

  • create a directory /locale/your_lang_code/LC_MESSAGE
  • copy a django.po file from the translation that you understand to that new directory
  • translate strings that start with “msgstr”, keep strings “msgid” intact and preserve overall format.
  • any strings that have a comment above them like #, fuzzy will not be shown as translated – verify translation for those and then remorve the “fuzzy” string.
  • if a string takes variables – make sure to follow format of translation strings it should have things like %(the_variable)s to properly insert values
  • also strings like that must have a comment just above msgstr
    #, python-format
  • at any time run
    python manage.py compilemessages
    – that will create django.mo file that is actually feeding translations into the application

h.2 How does Django code connect with your translation

There are three use cases:

  • simple 1 to 1 string mapping
  • mapping with a variable substitution
  • mapping with variable substitution and pluralization

Clone this wiki locally