简体   繁体   English

如何在jQuery mobile中处理字符串本地化?

[英]How to handle string localisation in jQuery mobile?

I am making an android app using phonegap and jQuery mobile.The app will also have option for displaying text in other languages like Tamil,Kannada and Telugu.I want to change all the text displayed when the user clicks on these options for changing the language. 我正在使用phonegap和jQuery mobile制作一个android应用程序。该应用程序还具有显示其他语言的选项,例如泰米尔语,卡纳达语和泰卢固语。我想更改用户单击这些选项以更改语言时显示的所有文本。 What is the best way to do that? 最好的方法是什么?

I would look at i18next , a JS library that runs entirely in browser and whose localizations are stored in JSON. 我看一下i18next ,它是一个完全在浏览器中运行的JS库,其本地化存储在JSON中。 It works with jQuery and has several other nice features. 它与jQuery一起使用,并具有其他一些不错的功能。 Seems like it would cover your needs. 似乎可以满足您的需求。

I'm running a Application which supports around 5 European languages. 我正在运行一个支持大约5种欧洲语言的应用程序。 I manually created a language file in the format of JSON . 我手动创建了JSON格式的语言文件。 I wrote custom functions to replace the UI element's labels in a separate file which triggers when a page loads. 我编写了自定义函数来替换一个单独的文件中的UI元素标签,该文件在页面加载时触发。

It just works fine for me. 它对我来说很好。

在GitHub 链接上查看用于jQuery移动本地化的HTMLed.js框架

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM