red*_*rom 7 internationalization jquery-mobile
是Jquery Mobile的任何i18n本地化插件?我搜索了很多时间,但J18ery的i18n翻译插件在JQM上无法正常工作.例如在一个href ..非常感谢.
没人知道?
我也遇到了同样的问题,我简单地使用 Jquery Extend 函数解决了该问题。
\n\n假设您按如下方式定义语言资源:
\n\n1) 创建一个具有默认本地化的资源文件,大概是用英语定义的。我们称之为 resources.default.js
\n\nvar MyApp = MyApp || {};\n\nMyApp.resources = {\n One: "One",\n Two: "Two",\n Three:"Three" \n}\nRun Code Online (Sandbox Code Playgroud)\n\n2) 在独立文件中定义本地化资源,比如说西班牙语。称之为 resources.es.js
\n\nvar localizedResources = {\n One: "Uno",\n Two: "Dos",\n Three:"Tres" \n}\nRun Code Online (Sandbox Code Playgroud)\n\n3) 在您的服务器逻辑上,决定您只需要包含英语的默认翻译,或者如果您需要任何其他语言,请包含。
\n\n<script src="resources.es.js"> </script> \nRun Code Online (Sandbox Code Playgroud)\n\n4) 按照步骤 3 创建网页,并添加脚本来处理资源包含情况。
\n\n<html>\n<head>\n</head>\n<body>\n\n\xe2\x80\x8b<h1>Welcome to my App</h1>\n<p>\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8b\xe2\x80\x8bWelcome to this test app</p>\n\n<button>Click me</button>\xe2\x80\x8b\n\n\n\n<script src="resources.default.js"> </script> \n\n\n// The server decided we needed Spanish translations.\n<script src="resources.es.js"> </script> \n\n\n<script type="text/javascript">\n //Extend the translations into the resources object.\n\n $.extend(MyApp.resources, localizedResources);\n\n $(window).ready(function(){\n $(\'button\').click(function(){\n alert(MyApp.resources.One); \n }); \n });\n\n</script> \n</body>\nRun Code Online (Sandbox Code Playgroud)\n\n这应该适合您。\n\xe2\x80\x8b\n编辑:\n在此处查看它的实际效果: http ://jsfiddle.net/agarcian/rrDv3/1/
\n| 归档时间: |
|
| 查看次数: |
7976 次 |
| 最近记录: |