2015-05-07 54 views
1

我需要向我的Web應用程序添加烏爾都語言支持。我創建了兩個屬性文件,如下圖所示如何在Spring Web應用程序中添加烏爾都語言支持

messages_en.properties 
messages_ar.properties 

,我配置了我的Spring XML像下面

<beans:bean id="messageSource" 
     class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
     <beans:property name="basename" value="classpath:messages" /> 
     <beans:property name="defaultEncoding" value="UTF-8" /> 
    </beans:bean> 

    <beans:bean id="localeResolver" 
     class="org.springframework.web.servlet.i18n.CookieLocaleResolver"> 
     <beans:property name="defaultLocale" value="en" /> 
     <beans:property name="cookieName" value="myAppLocaleCookie"></beans:property> 
     <beans:property name="cookieMaxAge" value="3600"></beans:property> 
    </beans:bean> 

    <interceptors> 
     <beans:bean 
      class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"> 
      <beans:property name="paramName" value="locale" /> 
     </beans:bean> 
    </interceptors> 
messages_ar.properties

我把阿拉伯字母,我得救了。如果我撥打locale=ar瀏覽器不顯示烏爾都語字母。我指的是the following example for internationalization

+0

如何給你打電話的語言環境?什麼是您的瀏覽器默認設置?什麼是瀏覽器顯示呢? – swinkler

+0

我使用firefox,它顯示爲?????,在url中添加'locale = ar' – Ramakrishna

回答

1

檢查以下步驟(下載例如拆包後):

  1. 新增WEB-INF \類\ messages_ar.properties在WEB-INF \觀點
  2. 集編碼\回到Home.jsp

    <%@頁會話= 「假」 的contentType = 「text/html的;字符集= UTF-8」 %>

結果: enter image description here

  • 重載應用/瀏覽器
  • 相關問題