【发布时间】:2013-08-30 10:56:16
【问题描述】:
我正在使用 jquery i18n 插件 (http://code.google.com/p/jquery-i18n-properties/) 将放置在 jquery/js 中的消息国际化。 我有以下项目结构。
我在js 文件夹和some.js 文件中有some.js 文件,我必须引用位于properties 文件夹的src/main/resources 文件夹中的属性文件。我可以这样做吗?在src/main/resources 文件夹的properties 文件夹内,我放置了Messages.properties 和Messages_en_US.properties。在两个属性文件中,我都放置了myForm.success.msg=Success 属性。现在我正在尝试按如下方式访问它。但是下面的代码没有得到myForm.success.msg 键的值。 instead of giving value, it is giving the key itself but not the value。我是否错误地引用了属性文件?我的属性文件引用正确吗?请帮帮我。
JSP 代码:
<script type="text/javascript" src="./public/js/some.js"></script>
<script type="text/javascript" src="./public/js/jquery.i18n.properties-min-1.0.9.js"></script>
一些.js
jQuery.i18n.properties({
name:'Messages',
path:'properties/', //as i have properties file in properties folder of src/main/resources
mode:'both',
callback: function() {
alert("message "+jQuery.i18n.prop('myForm.success.msg'));
}
});
【问题讨论】:
-
您必须提供有关您所引用的其他文件中代码的更多详细信息。但是我鼓励你使用 MessageFormat 插件而不是 jQuery.i18n。我在这里描述了这个插件:developer.tizen.org/documentation/articles/…
-
和我一样的问题。你的问题解决了吗
标签: javascript jquery html internationalization