国际化 – Jquery Mobile的i18n本地化插件?

Jquery Mobile的任何i18n本地化插件?我搜索了很多时间,但J18ery的i18n翻译插件在JQM上无法正常工作.例如在一个href ..非常感谢.

没人知道?

解决方法

我遇到了同样的问题,我只是通过使用Jquery Extend函数解决了这个问题.

假设您定义语言资源如下:

1)使用认本地化创建资源文件,可能是用英语定义的.我们称之为resources.default.js

var MyApp = MyApp || {};

MyApp.resources = {
    One: "One",Two: "Two",Three:"Three"    
}

2)在独立文件中定义本地化资源,比方说西班牙语.称之为resources.es.js

var localizedResources = {
    One: "Uno",Two: "Dos",Three:"Tres"    
}

3)在您的服务器逻辑上,确定您只需要包含英语的认翻译,或者如果您需要任何其他语言,请执行包含.

<script src="resources.es.js"> </script>

4)创建您的网页,并根据步骤3添加脚本以处理您包含的资源.

<html>
<head>
</head>
<body>

​<h1>Welcome to my App</h1>
<p>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​Welcome to this test app</p>

<button>Click me</button>​



<script src="resources.default.js"> </script> 


// The server decided we needed Spanish translations.
<script src="resources.es.js"> </script> 


<script type="text/javascript">
    //Extend the translations into the resources object.

    $.extend(MyApp.resources,localizedResources);

    $(window).ready(function(){
        $('button').click(function(){
            alert(MyApp.resources.One);    
        });    
    });

</script>  
</body>

这应该适合你.

编辑:
在这里看到它:http://jsfiddle.net/agarcian/rrDv3/1/

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...