adminfaces / admin-template

JSF responsive admin template based on Bootstrap and AdminLTE
https://adminfaces.github.io/docs/latest/#admin_template
MIT License
209 stars 101 forks source link

Wrong language selection #172

Closed jomu78 closed 5 years ago

jomu78 commented 5 years ago

The browser is running on main language en_US and has de_DE as fallback alternative in available. System is running on German (Windows). Expected behaviour would be admin-template language is English but it is German. Tested with Chrome and Firefox, running 1.0.0-RC22-SNAPSHOT.

Idea for the reason why: The supported language in faces-config.xml lists en and de_DE. Browser primary language en_US is not matched, so fallback language de_DE is first match and language is selected. (When I run the browser and Wildfly on Ubuntu correct language en_US is selected. )

Possible solutions

  1. Add admin_en_US.properties (a copy of admin.properties which is system default). Already tested and works. But this leaves the problem, that other en_XX languages are still not supported
  2. Ensure AdminUTF8Bundle first tries to full match and if this does not work, fallback to en for all en_XX languages. Example: user has languages en_GB, en_US and de_DE setup in the browse. As long as en_GB is not a supported by admin_template, en_US falls back to en and users 2nd preferred language is selected. In case en_GB is added to admin_template, this needs to be preferred
rmpestano commented 5 years ago

Hi @jomu78,

I think we can add admin_en_US as it is the language in admin.properties.

For locales not supported by admin-template, e.g en_GB, users must add the file on their application as well override supported locales in faces-config.

What do you think?

jomu78 commented 5 years ago

Hi @rmpestano That is ok for me .

Don't you to extend the faces-config.xml?

<supported-locale>en_US</supported-locale>

And by accident I added file faces-config.NavData with commit a2dc37f which should not be required (Netbeans autogenerated file)

rmpestano commented 5 years ago

Hi, just added the supported locale, thank you very much!