You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2019/02/04 13:10:43 UTC

[Bug 63143] New: Respect client's browser preference for English language (can be fixed by providing empty LocalStrings_en.properties files)

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.kolinko@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63143] Respect client's browser preference for English language (can be fixed by providing empty LocalStrings_en.properties files)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63143

--- Comment #2 from Christopher Schultz <ch...@christopherschultz.net> ---
I didn't look at Mark's fix, but at $work, we always work on
Bundle_en.properties for English. At build time, we specify the "Default
locale" and copy Bundle_[locale].properties to Bundle.properties.

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


[Bug 63143] Respect client's browser preference for English language (can be fixed by providing empty LocalStrings_en.properties files)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63143

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 OS|                            |All
         Resolution|---                         |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Fixed in:
- trunk for 9.0.16 onwards
- 8.5.x for 8.5.38 onwards
- 7.0.x for 7.0.93 onwards

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