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

blues blues4u at supereva.it
Tue Feb 6 03:24:31 CST 2007


On Tue, 06 Feb 2007 03:59:22 +0200, Tom Lederer <celok at gmx.net> wrote:
>>> 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.
>>
> 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...))
>

it looks very nice :)
do you have problems if i add it to the recipe?
i'll give you full credits of course.

blues




More information about the pmwiki-users mailing list