[pmwiki-users] MultiLanguage --- again (setting default language)

Tom Lederer celok at gmx.net
Mon Feb 5 19:59:22 CST 2007


Am 05.02.2007 um 16:16 schrieb blues:
>> 3. Also an idea for an improvement (i can not implement myself, cause
>> then i would have done it), would be to give the ?userlang= links a
>> css class in order to mark the active one.
>
> that's a good idea. i will consider it for a future version.
>
> blues
>

Hi again,

being curious as i am, i could not let this issue rest. Anyway, here  
is my solution:

In LanguageSelection function i make $userlang a global value: (line  
112)

> global $LanguageSelectionFmt, $userlang, $pagename, $PCache,  
> $DefaultLanguages;

Then i replace this part: (line 130 and following)

> foreach ($DefaultLanguages as $lang) {
> 	if (in_array($lang,$PageLanguages)) {

> 		$mid .= str_replace('$1',$lang,$LanguageSelectionFmt);

> 	} else if (isset($args['default'])) {
> 		$mid .= FmtPageName(str_replace('$1',$lang,$LanguageSelectionFmt), 
> $args['default']);
> 	}
> }


with this part (first two lines and last four lines are identical).

> foreach ($DefaultLanguages as $lang) {
> 	if (in_array($lang,$PageLanguages)) {

> 		if ($userlang == $lang) {
> 			$mid .= '%activelang%'.str_replace('$1',$lang, 
> $LanguageSelectionFmt).'%%';
> 		} else {
> 			$mid .= str_replace('$1',$lang,$LanguageSelectionFmt);
> 			}

> 	} else if (isset($args['default'])) {
> 		$mid .= FmtPageName(str_replace('$1',$lang,$LanguageSelectionFmt), 
> $args['default']);
> 	}
> }

After that i can put anything into my css file to demark the active  
language with .activelang. I know it is not a class to the link but  
to a surrounding span, but i didn't manage to come up with a better  
solution...

In my case:

> .activelang {
> 	background-color: #fff;
	... and some other ...
> }


Demo: http://www.celok.de/Inhalt/Start?setskin=new (active lang  
expands like a "tab"). (not final design, but i need to get to bed...  
*yawn*)

(only implemented in new skin. (Skin doesn't look like anything  
reasonable in IE yet (working on that soon...))


Best Regards,
Tom


-- 

Tom
http://www.celok.de







More information about the pmwiki-users mailing list