Howdy,
I just found that the extension Multilang is broken and does not display anything. :-(
I wanted to create some small templates with it that get autotranslated, so {{composer}} would yield in “Komponist”, “композитор” or just “composer”, depending on the selected language. Is there any other way to do this?
How is it done on commons.wikimedia.org?
Thanks, Thomas
Multilang is a beta that hasn't been updated since 2006, and it's noted that it will work on MediaWiki versions older than 1.11 - I would have been surprised if it had functioned for you. It seems interest in diverse translation extensions has mostly been dropped in favor of this one:
http://www.mediawiki.org/wiki/Extension:Translate
I haven't done anything with translation myself yet, but I hope this info is helpful.
"Thomas Uwe Grüttmüller" wrote:
Howdy,
I just found that the extension Multilang is broken and does not display anything. :-(
I wanted to create some small templates with it that get autotranslated, so {{composer}} would yield in “Komponist”, “композитор” or just “composer”, depending on the selected language. Is there any other way to do this?
How is it done on commons.wikimedia.org?
Thanks, 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@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
badon fastgoldfish@gmail.com wrote:
I would have been surprised if it had functioned for you. It seems interest in diverse translation extensions has mostly been dropped in favor of this one:
That extension seems to have a different purpose though. :-(
Now I tried this one (with the ParserFunctions extension):
{{#switch: {{CONTENTLANGUAGE}} | de = Das Wiki-Liederbuch für freie Musik… | es = El cancionero wiki de música libre… | ru = Вики песенник свободной музыки… | case = result | case = result | case = result | The wiki song book for free music… }}
The basic construct seems to work, but {{CONTENTLANGUAGE}} is always “en”. I need a variable that gives me the language selected by the user.
-- Thomas
I did some research for you, and all I could find are some javascript variable methods of accessing the user's language preference:
wgUserLanguage:
http://www.mediawiki.org/wiki/Manual:Interface/JavaScript
With some different info here:
http://www.mediawiki.org/wiki/Language_in_MediaWiki
Unfortunately, that requires you to load some javascript to obtain the user's language preference. Maybe you can copy a simple function from somewhere that already does the detection part, and then use it to show or hide different text in different languages?
This extension seems to do user language preference checks, so maybe you can borrow some code from it:
http://www.mediawiki.org/wiki/Extension:AutoLanguage
I'm sure someone has thought of this before. I seem to remember seeing templates over at Commons or Meta that did it, so maybe there is a better, easier way. Hopefully this info is still useful though.
"Thomas Uwe Grüttmüller" wrote:
badon fastgoldfish@gmail.com wrote:
I would have been surprised if it had functioned for you. It seems interest in diverse translation extensions has mostly been dropped in favor of this one:
That extension seems to have a different purpose though. :-(
Now I tried this one (with the ParserFunctions extension):
{{#switch: {{CONTENTLANGUAGE}} | de = Das Wiki-Liederbuch für freie Musik… | es = El cancionero wiki de música libre… | ru = Вики песенник свободной музыки… | case = result | case = result | case = result | The wiki song book for free music… }}
The basic construct seems to work, but {{CONTENTLANGUAGE}} is always “en”. I need a variable that gives me the language selected by the user.
-- Thomas
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
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
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;
8Modified version: 8< - - - - - case 'contentlanguage': global $wgLang; return $wgLang->getCode();
8So 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… }}
8Template:Language is 8< - - - - - {{CONTENTLANGUAGE}}
8for 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@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
On Thu, Nov 10, 2011 at 1:34 AM, badon fastgoldfish@gmail.com wrote:
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:
This has been requested before[0]--on more than one occasion, look at the dupes--and shot down because it destroys caching.
-Chad
badon fastgoldfish@gmail.com wrote:
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}}
I don't know anything more than I already posted in my last mail. Especially, I don't know how to create a new magic word. That's why I ‘reused’ the other one.
If you like to, please submit the feature request for me.
Thanks -- Thomas
mediawiki-l@lists.wikimedia.org