[pmwiki-users] switch language

noskule noskule at gmx.net
Sat Apr 15 08:35:01 CDT 2006


Stephan Schildberg schrieb:

>
>> I woud like to have a Language switch link [english] [german], so the 
>> user could switch form german to englisch and back.  The selection 
>> sould be storey in a cookie. So that it remembers the users desition.
>> Basicly I would like to enable/disable the XLPage('de'..... entrys in 
>> the config-php file.
>>   
>
> first: install cookbook - file:
> http://www.pmwiki.org/wiki/Cookbook/MultiLanguage
>
> the wiki-page will look like this:
>
> (:if userlang de:)
> blahblahblah
> (:if userlang en:)
> blahblahblah
> (:if:)
>
> to your template xxx.tmpl goes:
>
> <div id='language'>
> <!-- LP: Multiligue --> <a href='?userlang=de 
> title='*deutsch*'>*Deutsch*</a> | <a href='?userlang=en' 
> title='english'>English</a>
> <!-- LP: Multiligue -->  </div>
>
> you have to adjust <div id='language'> via css
>
>
>
> to your config.php you add the following lines:
>
> $DefaultLanguage = 'de';
>
> $EnableMultiLanguage = 1;
> include_once("cookbook/multilanguage.php");
>
> if ($GLOBALS['userlang']=='de') {
> XLPage('de','PmWikiDe.XLPageExtra');
> XLPage('de','PmWikiDe.XLPage');
> }
>
> if ($GLOBALS['userlang']=='en') {
> XLPage('en','PmWikiEn.XLPageExtra');
> XLPage('en','PmWikiEn.XLPage');
> }
>
>
> regards, Stephan.
>
>
hm, ist seams that if got a problem. I used:

if ($userlang == 'XX') {
    XLPage('XX','PmWikiXX.XLPageCookbook');
    XLPage('XX','PmWikiXX.XLPage');
    }
This seams to work, but only if the url has the extension ?userlang=de. 
It seams that rather than to ask for the userlang variable I have to ask 
vor the value in the cookie. Is this correct? And if how would I do that?
Do you have any suggestions?
grz nos



>
>





More information about the pmwiki-users mailing list