Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Using Visitors' Language Choice for i18n


There are two languages used by Lenya:
1. Content language is chosen by adding the language code to the URL, such as "index_en.html". This is also used for creating navigation menus, since they use the document name specified in the version for the language specified.
2. Everything else uses i18n (internationalization). Error messages and Lenya-provided text (such as in the Editor) use i18n. Any custom XSL should also use the i18n:text tags around text.

Lenya defaults to using the language configuration of browsers for i18n. This can result in multiple languages being displayed. The fix is to change i18n to use the language chosen by a visitor for everything, rather than depend on the browser's setting. To accomplish this, change every sitemap from:
<map:parameter name="locale" value="{request:locale}"/>
To:
<map:parameter name="locale" value="{page-envelope:document-language}"/>

The files to change are:
build\lenya\webapp\sitemap.xmap
build\lenya\webapp\global-sitemap.xmap

build\lenya\webapp\lenya\info.xmap
build\lenya\webapp\lenya\lenya.xmap
build\lenya\webapp\lenya\navigation.xmap
build\lenya\webapp\lenya\usecase.xmap

build\lenya\webapp\lenya\pubs\{pub}\doctypes.xmap
build\lenya\webapp\lenya\pubs\{pub}\publication-sitemap.xmap
build\lenya\webapp\lenya\pubs\{pub}\sitemap.xmap
build\lenya\webapp\lenya\pubs\{pub}\usecase-bxeng.xmap

You may want to skip:
- build\lenya\webapp\admin.xmap
to keep the CMS GUI in the browser's language. Much discussion on the mailing lists is about whether the administration functions should follow the chosen language. I believe it should be changed so editors can edit their own language with controls in the same language; it seems rare an editor would work in a language they do not comprehend.

There is no point in fixing:
- build\lenya\webapp\lucene.xmap
because the standard URL for Search does not contain language information, so {page-envelope:document-language} is always empty. All Search pages must be in the browser language (unless you implement my version of Publication Search.)

<< Visitors' ChoiceConsistent URLs >>

Contact Solprovider
Paul Ercolino