<legend id='A9bEm'><style id='A9bEm'><dir id='A9bEm'><q id='A9bEm'></q></dir></style></legend>
    1. <small id='A9bEm'></small><noframes id='A9bEm'>

    2. <i id='A9bEm'><tr id='A9bEm'><dt id='A9bEm'><q id='A9bEm'><span id='A9bEm'><b id='A9bEm'><form id='A9bEm'><ins id='A9bEm'></ins><ul id='A9bEm'></ul><sub id='A9bEm'></sub></form><legend id='A9bEm'></legend><bdo id='A9bEm'><pre id='A9bEm'><center id='A9bEm'></center></pre></bdo></b><th id='A9bEm'></th></span></q></dt></tr></i><div id='A9bEm'><tfoot id='A9bEm'></tfoot><dl id='A9bEm'><fieldset id='A9bEm'></fieldset></dl></div>
      1. <tfoot id='A9bEm'></tfoot>
          <bdo id='A9bEm'></bdo><ul id='A9bEm'></ul>

      2. Struts 2(2.3.28 版)只接受注册的语言环境

        Struts 2 (version 2.3.28) only accepts registered locales(Struts 2(2.3.28 版)只接受注册的语言环境)

        <legend id='r20rr'><style id='r20rr'><dir id='r20rr'><q id='r20rr'></q></dir></style></legend>

            <tbody id='r20rr'></tbody>
        1. <small id='r20rr'></small><noframes id='r20rr'>

            • <bdo id='r20rr'></bdo><ul id='r20rr'></ul>

                • <tfoot id='r20rr'></tfoot>

                  <i id='r20rr'><tr id='r20rr'><dt id='r20rr'><q id='r20rr'><span id='r20rr'><b id='r20rr'><form id='r20rr'><ins id='r20rr'></ins><ul id='r20rr'></ul><sub id='r20rr'></sub></form><legend id='r20rr'></legend><bdo id='r20rr'><pre id='r20rr'><center id='r20rr'></center></pre></bdo></b><th id='r20rr'></th></span></q></dt></tr></i><div id='r20rr'><tfoot id='r20rr'></tfoot><dl id='r20rr'><fieldset id='r20rr'></fieldset></dl></div>
                  本文介绍了Struts 2(2.3.28 版)只接受注册的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 Struts 2 版本 2.3.28 中,i18n 拦截器只接受注册到 jvm 的语言环境,该列表由 Locale.getAvailableLocales() 返回.

                  In Struts 2 version 2.3.28, the i18n interceptor only accepts the locales which are registered to jvm, the list which is returned by Locale.getAvailableLocales().

                  好吧,虽然我可以扩展可用 Java 语言环境的列表,如前所述 如何扩展可用 Java 语言环境的列表,是否有任何捷径可以将此拦截器设置为接受所有字符串作为语言环境(例如 fa_IR )?!

                  Well, although I can extend the list of available Java Locales, as mentioned How to extend the list of available Java Locales, is it any short way that set this interceptor to accept all strings as locale (for example fa_IR ) ?!

                  请注意:将默认语言环境设置为 fa_IR ( <constant name="struts.locale" value="fa_IR"/> ) 可以正常工作.

                  Just a note: Setting the default locale to fa_IR ( <constant name="struts.locale" value="fa_IR" /> ) works fine.

                  推荐答案

                  不行,你必须创建自己的拦截器来扩展 i18n 并覆盖这个方法

                  No, you have to create your own interceptor that extends i18n and override this method

                   protected Locale getLocaleFromParam(Object requestedLocale) {
                          Locale locale = null;
                          if (requestedLocale != null) {
                              locale = (requestedLocale instanceof Locale) ?
                                      (Locale) requestedLocale :
                                      LocalizedTextUtil.localeFromString(requestedLocale.toString(), null);
                              if (locale != null && LOG.isDebugEnabled()) {
                                  LOG.debug("applied request locale=#0", locale);
                              }
                          }
                  
                          if (locale == null) {
                              locale = Locale.getDefault();
                          }
                          return locale;
                      }
                  

                  这篇关于Struts 2(2.3.28 版)只接受注册的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <tbody id='mRsym'></tbody>

                  <small id='mRsym'></small><noframes id='mRsym'>

                    <bdo id='mRsym'></bdo><ul id='mRsym'></ul>
                      <legend id='mRsym'><style id='mRsym'><dir id='mRsym'><q id='mRsym'></q></dir></style></legend>

                          <tfoot id='mRsym'></tfoot>
                          <i id='mRsym'><tr id='mRsym'><dt id='mRsym'><q id='mRsym'><span id='mRsym'><b id='mRsym'><form id='mRsym'><ins id='mRsym'></ins><ul id='mRsym'></ul><sub id='mRsym'></sub></form><legend id='mRsym'></legend><bdo id='mRsym'><pre id='mRsym'><center id='mRsym'></center></pre></bdo></b><th id='mRsym'></th></span></q></dt></tr></i><div id='mRsym'><tfoot id='mRsym'></tfoot><dl id='mRsym'><fieldset id='mRsym'></fieldset></dl></div>