https://bz.apache.org/bugzilla/show_bug.cgi?id=63143

            Bug ID: 63143
           Summary: Respect client's browser preference for English
                    language (can be fixed by providing empty
                    LocalStrings_en.properties files)
           Product: Tomcat 9
           Version: 9.0.14
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Manager
          Assignee: dev@tomcat.apache.org
          Reporter: knst.koli...@gmail.com
  Target Milestone: -----

The manager web application does not select English language according to
user's preferences in some configurations, unless you create an empty
LocalStrings_en.properties" file to enable English locale.

It is an issue with bundle selection in
org.apache.tomcat.util.res.StringManager.getManager(String,
Enumeration<Locale>).


Steps to reproduce:

Using Tomcat 9.0.15 (trunk), Java 8, Mozilla Firefox.

1. Run JVM with an OS of a language that Tomcat has a translation available.

My OS uses Russian language.

2. Configure a browser, to send "en" as the preferred language.

E.g., I configure the browser with the following list of languages:

en
en-us
ru-ru
ru

3. Start Tomcat, start the browser and access the Manager web application.

Expected: I expect the UI to be in English language.
Actual: The UI is in Russian language.

WORKAROUND:

If I create an empty LocalStrings_en.properties file in
${catalina.home}/lib/**, I get the expected result: the UI is in English
language. Path to the file:

${catalina.home}/lib/org/apache/catalina/manager/LocalStrings_en.properties


GUESS:

Looking into StringManager class constructor, when it gets a bundle that has
Locale.ROOT it interprets it as Locale.ENGLISH. It is OK.

If I remember correctly, in this case Java actually falls back to the system
default locale. That is: when you request a resource in English locale (that
does not exist), Java returns a resource in the system default locale (Russian
in my case) and not the ROOT locale one.

It would be better to fix this in StringManager, instead of having to maintain
a lot of empty files.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to