Language Localization of Khan Academy

Viewed 817

I am currently working on language localization of Khan Academy, I have downloaded the source 8051 from Google Code . After survey information and viewing code online, the project is made using jinja2 as the templating language. I can use babel to accomplish my work.

With the following work, I can finally enable {%trans%} and {%endtrans%} tag parse-able by the template engine with following modification:

in webapp2_extra/jinja2.py:

from django.utils import translation
    env.install_gettext_translations(translation)

in config_jinja2.py

-- put following line
"extensions": ['jinja2.ext.i18n']

However, my translated template of *.mo and *.po (from pybabel) does not correctly translate tag within value in to destined language. I am thinking the babel integration should came from webapp2_extra.i18n.py, but I do not know how to enable it.

As few posts in Google mentioned that following code might work:

from webapp2_extras import i18n 
    env.install_gettext_translations(i18n) 

However, it fails because it does not recognize {%trans%} tag. So does anyone have the experience working on the same problem or has any suggestion to jinja2 i18n problem?

Appreciate any suggestions.

1 Answers
Related