To force a locale globally in the Nuxeo WebUI, one has to use this code
<script>
window.nuxeo.I18n.language = 'en';
window.nuxeo.I18n.loadLocale();
</script>
it works as expected but it generates an error in the console
nuxeo-app.html?ts=1597058167177-240.js:126 Uncaught TypeError: this.i18n is not a function at HTMLElement._emptyLabel (nuxeo-app.html?ts=1597058167177-240.js:126) at runMethodEffect (nuxeo-app.html?ts=1597058167177-13.js:798) at Function._evaluateBinding (nuxeo-app.html?ts=1597058167177-13.js:2713) at Object.runBindingEffect [as fn] (nuxeo-app.html?ts=1597058167177-13.js:561) at runEffectsForProperty (nuxeo-app.html?ts=1597058167177-13.js:142) at runEffects (nuxeo-app.html?ts=1597058167177-13.js:108) at HTMLElement._propagatePropertyChanges (nuxeo-app.html?ts=1597058167177-13.js:1722) at HTMLElement._propertiesChanged (nuxeo-app.html?ts=1597058167177-13.js:1686) at HTMLElement._flushProperties (nuxeo-app.html?ts=1597058167177-10.js:327) at HTMLElement._flushProperties (nuxeo-app.html?ts=1597058167177-13.js:1540)
It seems to come from the method refreshI18n which sets this.i18n to null
refreshI18n() { this.i18n = null; this.set('i18n', window.nuxeo.I18n.translate); },
Commenting the line which sets this.i18n = null which to fix the problem and the locale is still correctly applied
Problem is probably not there in master as this line is already commented : https://github.com/nuxeo/nuxeo-ui-elements/blob/master/nuxeo-i18n-behavior.js#L134
- Is referenced in