Spring MVC-jquery-i18n-properties无法加载消息属性
我正在尝试用AngularJs制作一个SpringMVC4应用程序。我的问题是AngularJs不支持国际化。我想使用jquery.i18n-properties,但我无法加载消息%s.properties 我收到以下错误消息: 找不到获取404 js:7845找不到GET 404 application-context-config.xml:Spring MVC-jquery-i18n-properties无法加载消息属性,jquery,angularjs,spring,spring-mvc,Jquery,Angularjs,Spring,Spring Mvc,我正在尝试用AngularJs制作一个SpringMVC4应用程序。我的问题是AngularJs不支持国际化。我想使用jquery.i18n-properties,但我无法加载消息%s.properties 我收到以下错误消息: 找不到获取404 js:7845找不到GET 404 application-context-config.xml: <!-- Handles HTTP GET requests for /resources/** by efficiently serving u
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/WEB-INF/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" />
<mvc:view-controller path="/" view-name="/resources/html/templates/index.html"/>
<!-- Saves a locale change using a cookie -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />
<bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
id="messageSource" p:defaultEncoding="UTF-8"
p:basenames="resources/i18n/messages"
p:fallbackToSystemLocale="false" />
})
我不使用JSP-s,我只使用HTML-s。以下是我的文件结构:
src
|_main
|_webapp
|_WEB-INF
|_resources
|_...
|_html
|_... here are my .html files
|_i18n
|_messages_en.proerties
|_images
|_...
|_js
|_...
我尝试了很多方法来解决这个问题,但没有任何效果。谁能帮帮我吗
谢谢大家! 如果您使用AngularJS,我认为应用i18n的最佳方式是使用以下库: 这可以处理i18n的许多问题。例如: 以以下Messages.properties、Messages_pt.properties和Messages_pt.properties为例: Messages.properties 消息\u pt.properties 消息\u pt\u pt.properties 如您所见,该插件加载三个文件:默认文件,例如,Messages.properties,然后是特定于语言环境的文件Messages_pt.properties,然后是Messages_pt.properties
app.service('i18n', function () {
var self = this;
this.setLanguage = function (language) {
$.i18n.properties({
name: 'messages',
path: 'resources/i18n/',
mode: 'map',
language: language,
callback: function () {
self.language = language;
}
});
};
this.setLanguage('en');
src
|_main
|_webapp
|_WEB-INF
|_resources
|_...
|_html
|_... here are my .html files
|_i18n
|_messages_en.proerties
|_images
|_...
|_js
|_...
# This line is ignored by the plugin
msg_hello = Hello
msg_world = World
msg_complex = Good morning {0}!
# We only provide a translation for the 'msg_hello' key
msg_hello = Bom dia
# We only provide a translation for the 'msg_hello' key
msg_hello = Olá