test.rst (1.5 kb) added by Ole Marius Smestad
Language Switcher
=================
The language switcher is used to switch from viewing one translation of a site
to another. This is today done by changing to another translation siteaccess
(We are not talking about using the locale user param here).
**Problem**: Today this poses a challenge with the multilingual url alias system
where the request uri cannot be reused in another translation site access, as
the URL will be different there, that is, translated into another language, for
a specific node.
Scope
-----
Several approaches are listed below. The first one, shows an example where the
urls are virtually created manually, only helped by the url transformation.
The later approaches show a much more automated approach, where the system
automatically generates all required information for the user.
Both approaches have merit, in the sense, that for certain setups full control
on how URLs look like are needed. In many other cases on the other hand,
simplicity of use is better.
Approach 1
~~~~~~~~~~
::
{def $langSwitcher=switchLang( array(), array())}
{foreach $langSwitcher as $lang}
<a href={$lang.url}>{$lang.text}</a>
{/foreach}
Tasks
-----
- Calculate siteaccess url for given SA
- Translate request uri to uri in desired translation
- redirect to final destination url SA
- Setup the mapping between SA and translation locale.
Limitations
-----------
Initially only a subset of the possible site access types will be supported,
namely *URI* and *host*.