Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4677

I18N Interceptor automatically validates Locale

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5.5
    • Component/s: Core Interceptors
    • Labels:
      None
    • Environment:

      2.5.1 running on Java 8, RHEL Linux 6/7

      Description

      There is an annoying issue with the I18N Interceptor, which now validates locales against the list of default available locales in this bit of code:

      if (locale != null && Arrays.asList(Locale.getAvailableLocales()).contains(locale)) {
          locale = Locale.getDefault();
      }
      

      The problem is I have a web app for refugees and not all the languages are in the available locales array. This must be relatively new as it worked in the old version 2.x ish.

      Ideally it would be great if we could add a parameter (or constant) to bi-pass the validation.

      For example a tag in the struts.xml file:

      <interceptor-ref name="I18nInterceptor">
        <param name="validation">
           false
        </param>
      </interceptor-ref>
      

      and then access it in the interceptor to override default behaviour.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              zoran Zoran Avtarovski
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: