To make it multilingual - that is, bilingual up to now.
(Are you interested to translate it into Italian? ;-) ).
If you click the button
English, the intro page will be reloaded with the added parameter
?lang=en - so this choice is retrievable from the $_SESSION variable through a snippet,
[[!get_lang_par]]:
<?php
if ( isset($_SESSION['lang']) ) {
return $_SESSION['lang'];
} else {
return 'de';
};
I created a namespace
multiling and the lexicon files
core/components/multiling/lexicon/de/default.inc.php and
core/components/multiling/lexicon/en/default.inc.php
which contain, e.g., the entries
$_lang['ml.xpls'] = 'Beispiele';
and
$_lang['ml.xpls'] = 'Examples';
respectively.
Now the examples' page as Menu Title has to become a language tag:
[[!%ml.xpls? &namespace=`multiling` &topic=`default` &language=`[[!get_lang_par]]`]]
To display the correct title also in the page's title bar, in the template I have
<title>[[++site_name]] | Wayfinder Demo | [[*menutitle]]</title>
instead of the normally used
[[*pagetitle]].
The content of a page is always a static resource chosing the appropriate chunk using a modifyer. For instance, the static resource for the start page,
intro.html, just contains
[[!get_lang_par:is=`de`:then=`[[$de_intro]]`:else=`[[$en_intro]]`]]
where
[[$de_intro]] and
[[$en_intro]] are the chunks of the content in the different languages.
Maybe all this could have been made simpler. But it was my way out after spending much fruitless time trying the Babel add on or other context related solutions...
[ed. note: ottogal last edited this post 11 years, 11 months ago.]