Struts 2 動作調用丟失 xwork i18n 語言設置 (Struts 2 action call loses the xwork i18n language setting)


問題描述

Struts 2 動作調用丟失 xwork i18n 語言設置 (Struts 2 action call loses the xwork i18n language setting)

我在表單上調用了一個函數“foo.action?request_locale=en”。該頁面上有一個 xwork‑validation,我希望在給定的語言中得到一個驗證錯誤。我得到的是芬蘭語頁面 ‑ 我的瀏覽器默認語言 ‑ 我希望有一個英文頁面。

如何更改 jsp 頁面上使用的語言(這就是 request_locale 的來源)所以我的表單中調用的操作將顯示為所選語言而不是瀏覽器默認語言?

一些規範:struts.xml 有一行,因為我的操作位於 fi.foo.action 目錄和 i18n fi/foo/package_en.properties 和此類文件中的資源。

驗證器位於 fi.foo.action 文件夾中的 barAction‑foo‑validation.xml 類文件中。

fi =芬蘭語


## 參考解法 #### 方法 1:

It sounds like the i18n interceptor is not configured for your action's interceptor stack. The i18n interceptor is defined fourth in the defaultStack. Make sure you are not overriding the stack for your action. If it appears to be configured, then try setting a breakpoint in the intercept method of the I18nInterceptor to confirm that it is being invoked. Otherwise, what you have should work.

(by micoSteven Benitez)

參考文件

  1. Struts 2 action call loses the xwork i18n language setting (CC BY‑SA 2.5/3.0/4.0)

#internationalization #java #struts2 #xwork #validation






相關問題

志願者翻譯對 Delphi 2009 應用程序進行本地化的過程? (Process for localization of Delphi 2009 app by volunteer translators?)

Netbeans 菜單和 i18n (Netbeans menu and i18n)

Menggunakan Perpustakaan Penutupan pada aplikasi Phonegap (Android) (Using Closure Library on Phonegap(Android) application)

支持 SDK 但不支持 PhoneGap 的印度語語言 (Indic Language Support for SDK but not PhoneGap)

翻譯 symfony2 路由錯誤 (translation symfony2 routing error)

Django 沒有正確翻譯網站 (Django not translating the site properly)

django模型翻譯404 (django modeltranslation 404)

您是否知道用於編輯/翻譯資源(.rc)文件的好的程序? (Do you know of a good program for editing/translating resource (.rc) files?)

Struts 2 動作調用丟失 xwork i18n 語言設置 (Struts 2 action call loses the xwork i18n language setting)

移動應用測試 (Mobile application testing)

nuxt-i18n 的延遲加載語言環境 (Lazy load locales for nuxt-i18n)

你能在 next.config 中獲取數據嗎 (Can you fetch data in next.config)







留言討論