Forum .LRN Q&A: Internationalization - ACS5.0.0

Collapse
Posted by Sung Hong on
I tested the Internationalization package using the message key in template files and the separate templates for each locale.  Both methods work well as long as there is a match between the browser's and  package's locale.  For example, es_ar (Argentina Spanish in IE) won't map to the Spanish es_ES defined in the package.  Then, my question is how to modify the code to map only the prefix 'es' instead of the whole locale 'es_??'.  Is this request a new feature to be implemented in the future?
Collapse
Posted by Sung Hong on
Feature request detail:
The language mapping should
1st. - look for Exact macth
2nd. - look for any available same prefix
3rd. - look for Default
Collapse
Posted by Peter Marklund on
Sung,
take a look at the proc lang::conn::browser_locale. It already looks for an exact locale match, but uses a locale with only matching language part if it doesn't find that.

Here is code from the corresponding test case that explains the logic:

        # First locale is perfect language match
        lang::test::assert_browser_locale "da,en-us;q=0.8,de;q=0.5,es;q=0.3" "da_DK"

        # First locale is perfect locale match
        lang::test::assert_browser_locale "da_DK,en-us;q=0.8,de;q=0.5,es;q=0.3" "da_DK"

        # Tentative match being discarded
        lang::test::assert_browser_locale "da_BLA,foobar,en" "en_US"

        # Tentative match being used
        lang::test::assert_browser_locale "da_BLA,foobar" "da_DK"

        # Several tentative matches, all being discarded
        lang::test::assert_browser_locale "da_BLA,foobar,da_BLUB,da_DK" "da_DK"

Collapse
Posted by Sung Hong on
Thanks, I will look into those testing code.  I have another question related to the locale.  How can I unset the site wide/package locale so the client browser locale is used?  Where is the UI?