[OPENAM-7123] Allow country-specific localization in XUI Created: 14/Oct/15  Updated: 10/Jan/17  Resolved: 17/Nov/15

Status: Resolved
Project: OpenAM
Component/s: I18N, localisation, XUI
Affects Version/s: 12.0.0, 12.0.1
Fix Version/s: 12.0.3, 13.0.0

Type: Improvement Priority: Major
Reporter: David Bate Assignee: Peter Major [X] (Inactive)
Resolution: Fixed Votes: 1
Labels: EDISON, release-notes
Remaining Estimate: 0h
Time Spent: 8h
Original Estimate: 0h

Attachments: File locales.tar.gz    
Issue Links:
Depends
depends on OPENAM-7387 Upgrade CREST to 2.4.3 for 12.0.x Resolved
depends on CUI-126 Allow control over i18next#load Resolved
Relates
relates to OPENAM-6969 Calls to 'serverinfo' endpoint are ca... Resolved
Sprint: AM Sustaining Sprint 14
Support Ticket IDs:

 Description   

When following the steps here:
https://backstage.forgerock.com/#!/docs/openam/12.0.0/install-guide/chap-custom-ui#basic-xui-configuration

Much of the text supplied in XUI is stored in translation.json files for each locale. To customize the English text, edit XUI/locales/en/translation.json under the directory where OpenAM is unpacked for deployment. To prepare a translation for a new locale, copy the English file, XUI/locales/en/translation.json, to XUI/locales/new-locale/ and edit the copy changing only the values not the keys, and taking care not to change the JSON structure or to render it invalid.

When attempting to use the locale based off of the Browser headers (in preferences set the browsers language to another language), it does not pick up the dialect part.

So if you use English it will show the correct English translation

If you set it to Spanish - it will show the correct Spanish translation

If you set it to Spanish Mexican - it will just show the "unspecific" Spanish translation
rather then the "specific" Spanish Mexican translation that was created.



 Comments   
Comment by Peter Major [X] (Inactive) [ 10/Nov/15 ]

Using Firefox with es-MX locale /json/serverinfo/* incorrectly determined my locale because of case sensitive header retrieval.

Comment by Peter Major [X] (Inactive) [ 10/Nov/15 ]

The main problem appears to be that i18nManager.js from commons-ui is using load: 'unspecific' by default, which means that specific locales like es-MX does not get used during lookup, only 'es' will be used. The solution is either to use 'current' or not define "load" at all (or just have some completely different value than 'current' and 'unspecific', like "specific").
CUI-126 should expose this configuration to OpenAM's XUI/index.html. An example config will look like:

<script type="text/javascript">
    var require = {
        urlArgs : "v=12.0.3-SNAPSHOT", // jshint ignore:line
        deps : ['main'],
        config : {
            'org/forgerock/commons/ui/common/main/i18nManager': {
                i18nLoad: 'specific'
            }
        }
    };
</script>

It should be noted that changing the load value can easily result in additional load on the server, as i18nnext then can look for es-MX, es and en, in order to try to get a localization text. Cache-Control usage is recommended.

Comment by Peter Major [X] (Inactive) [ 10/Nov/15 ]

The last outstanding bug is that ServerInfoResource only returns language at the moment, but for 'current' load mode to work actually it should return es-MX (also note the dash/underscore difference compared to es_MX returned by Locale.toString()).

Generated at Mon Oct 19 21:34:04 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.