JavaScript i18n与gettext和.po文件 [英] javascript i18n with gettext and .po files
问题描述
我的翻译机制与jinja2模板引擎一起工作,webapp2的i18n函数带有magic _函数,现在我需要Javascript来本地化几个字符串,但是我找不到一个好的实现。有没有?
我想要一个用于本地化我的网络应用的解决方案。 JavaScript字符串只是一些,但我需要一个翻译机制,字典是.po和.mo文件。理想情况下,我希望JavaScript采用与python相同的字典(.po文件)。
我不需要提取,我需要的是_函数加确定用户语言和加载翻译的一种方式,不仅针对单一语言,而且针对我所有的语言。我研究了一些解决方案,但他们一次只处理一个翻译,而我需要处理很多问题。
例如, http://www.zomeoff.com/jsin/jsin.1.2.unit.test.html 做了一个成功的工作,但这只是一个本地化。我需要协调翻译,以便python jinja2模板和javascript使用相同的语言。
您有建议还是可以评论我的情况?
谢谢你
/ jsgettext.berlios.de/rel =nofollow> Javascript Gettext你可以使用polib和 json
即时生成JSON。
My translation mechanism works serverside with the jinja2 template engine, webapp2's i18n function with the magic _ function and now I need it for Javascript to localize just a few strings but I couldn't find a good implementation. Is there one?
I'd like a solution for localizing my web app. The javascript strings are just a few but I need a translation mechanism and the dictionary is .po and .mo files. Ideally I'd like javascript to take the same dictionaries as python does (the .po files)
I don't need extractions, what I need is the _ function plus some way of determining user language and loading the translations, not just for a single language but for all my languages. I looked at some solutions but they only handla one translation at a time and I need to handle many.
For instance, http://www.zomeoff.com/jsin/jsin.1.2.unit.test.html does a successful job but this is only one localization. I need to harmonize the translations so that the same language is used by both the python jinja2 templates and javascript.
Do you have s suggestion or can comment my situation?
Thank yo
You could probably use polib and json
to generate the JSON on the fly though.
这篇关于JavaScript i18n与gettext和.po文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!