Reputation: 533
I have configured Localization and Internalization in Spring 3 mvc.I put properties files in resource folder.And Its working properly.Now I want to use Javascript internalization to provide proper alert messages according to the languages. My Project Structure is given below for properties files
Project
|
|
src
resource
|_message.properties
|_message_en.properties
|_message_es.properties
I want to use jQuery internalization.Now I want to access these properties files using jQuery.I have written below code in javascript to load my properties file
jQuery.i18n.properties({
name:'message',
path:'resources/',
mode:'both',
language:'en'
});
**But I am getting Http 404 Error during loading of the page.**
**GET http://SERVER IP:PORT/viuw/resources/message.properties?_=1373877147985 404 (Not Found)**
How to load Property files using jQuery.i18n.property.js?
my configuration is
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="es" />
</bean>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language" />
</bean>
<bean
class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor" />
</list>
</property>
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="message" />
</bean>
web.xml file configuration is
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Upvotes: 1
Views: 6270
Reputation: 1
try it
jQuery.i18n.properties({
name:'message',
path:'resources/',
mode:'both',
language:'en'
});
path:'resource/'
Upvotes: 0
Reputation: 68
The path you list in your project structure is resource
, not resources
. Hope you got around that error.
Upvotes: 1