This is an interesting, novel solution. It seems it would be trivial to take
this a step further and add an additional case that is "userlanguage". It
might be worth your time to request that as a feature enhancement for an
upcoming version of MediaWiki:
https://bugzilla.wikimedia.org/
If you'd like me to do it for you, I can try, but I think you're more
qualified than I am to write up the details. Since you have already figured
out how to do this, you may be able to submit the code for it, and if
accepted, it will certainly appear in the next release. I think this is a
very important missing feature of MediaWiki that a multi-language world
needs:
{{USERLANGUAGE}}
"Thomas Uwe Grüttmüller" wrote:
Badon, thanks for your help. Unfortunately, I don't speak PHP or
JavaScript, but at least I managed to create a very crude patch for
includes/parser/Parser.php
Original version:
8< - - - - -
case 'contentlanguage':
global $wgContLanguageCode;
return $wgContLanguageCode;
- - - - - >8
Modified version:
8< - - - - -
case 'contentlanguage':
global $wgLang;
return $wgLang->getCode();
- - - - - >8
So now this works:
8< - - - - -
{{#switch: {{Language}}
| de = Das Wiki-Liederbuch für freie Musik…
| es = El cancionero wiki de música libre…
| ru = Вики песенник свободной музыки…
| nds = Dat Wiki-Leederböök för frie Musik…
| case = result
| case = result
| The wiki song book for free music…
}}
- - - - - >8
Template:Language is
8< - - - - -
{{CONTENTLANGUAGE}}
- - - - - >8
for now.
The language is chosen with the LanguageSelector extension.
The “#switch:” requires the ParserFunctions extension.
That's all.
Bye,
-- Thomas
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro!
https://freundschaftswerbung.gmx.de
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
--
View this message in context:
http://old.nabble.com/Extension%3AMultilang-tp32801001p32816492.html
Sent from the WikiMedia General mailing list archive at
Nabble.com.