Nuxeo Server

How to Force Locale

Updated: October 13, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

You can force the locale by removing other locales support. This is done in the deployment-fragment.xml file of your plugin.

"Sample extract of deployment-fragment.xml replacing other bundles' contributions to faces-config.xml"

<require>org.nuxeo.ecm.platform.lang.ext</require>
<extension target="faces-config#APPLICATION_LOCALE" mode="replace">
  <locale-config>
    <default-locale>en_US</default-locale>
    <supported-locale>en_US</supported-locale>
  </locale-config>
  <message-bundle>messages</message-bundle>
</extension>

The mode="replace" attribute will replace all the previously contributed <extension target="faces-config#APPLICATION_LOCALE">.

So you have to carefully make your plugin being deployed after any other bundle contributing a locale-config. In the above sample, this is ensured by the require parameter.

This configuration applies on JSF pages and will not change the default locale on the login page which only depends on the browser configuration.

If you'd like to force locale on the login page, you should override the page at /login.jsp and force the locale there, by adding the following line at the beginning of the file, just after the <html> tag, for instance:

<fmt:setLocale value="fr" />
5 days ago manonlumeau NXDOC-1346-FT review screenshot
2 years ago Anahide Tchertchian 26 | xplain how to force locale on the login pag
3 years ago Manon Lumeau 25
4 years ago Solen Guitter 24
4 years ago Solen Guitter 23 | Removed instructions for before 5.4.3
6 years ago Julien Carsique 21
6 years ago Julien Carsique 22
6 years ago Julien Carsique 20 | fix sample locale contribution, add 5.4.3 improvement (NXP-7353)
7 years ago Stéfane Fermigier 19
7 years ago Stéfane Fermigier 18
7 years ago Stéfane Fermigier 17
7 years ago Stéfane Fermigier 16
7 years ago Stéfane Fermigier 15
7 years ago Stéfane Fermigier 14
7 years ago Stéfane Fermigier 13
7 years ago Stéfane Fermigier 12
7 years ago Stéfane Fermigier 11
7 years ago Stéfane Fermigier 10
7 years ago Stéfane Fermigier 9
7 years ago Stéfane Fermigier 8
7 years ago Stéfane Fermigier 7
7 years ago Stéfane Fermigier 6
7 years ago Stéfane Fermigier 5
7 years ago Stéfane Fermigier 4
7 years ago Stéfane Fermigier 3
7 years ago Stéfane Fermigier 2
7 years ago Stéfane Fermigier 1
History: Created by Stéfane Fermigier