<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 版)只接受注册的语言环境

        时间:2023-09-24

        <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 版)只接受注册的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Weblogic 12c 启动期间出现的来自 Struts 的额外信息消息 下一篇:ModelDriven 接口是否在 struts2 中提出了安全问题?

                  相关文章

                  <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>