Template talk:Uselang

From OpenStreetMap Wiki
Jump to navigation Jump to search


Hi there! "Uselang" doesn't seem to work. Whatever language I set in the front-end, it delivers "en". I expected that it shows the language I use or choose in browsing the wiki. That would be important in combination with {{LangSwitch}} to make it possible for templates with translation strings to display an ambox text in the language of current viewer and not of the page or namespace. With notice boxes that would make much more sense IMHO. (Test {{Uselang}}: en). I tried as good as I can with coding but never got displayed the user language. Could anyone help? -- regards, Chris2map (talk) 10:59, 2 April 2021 (UTC)

It works but the definition is probably wrong. When you paste it on a page with "DE:" prefix it shows "de", "ES" -> "es" and so on. On pages without a prefix it will show "en". It works the same as {{Langcode}} as far as I can see. maro21 19:29, 23 April 2021 (UTC)
Hi, so with the actual result the template is quiet useless to me. Is there another possibility to read the language of current browsing (language of user setup / user interface)? --regards, Chris2map (talk) 08:09, 24 April 2021 (UTC)
Looks like this template works like a magic word {{CONTENTLANGUAGE}} which shows the default language interface of a Wiki - here English. If you use it on for example Polish Wikipedia, the result will be "pl", German Wikipedia - "de". It's just the default language set in $wgLanguageCode - so this variable doesn't depend on either interface language or language set in page language. There is "user interface language ($contextSource->getLanguage()" https://www.mediawiki.org/wiki/Manual:Language but I don't know how to use this variable in the wiki text. maro21 12:25, 2 April 2022 (UTC)

I give it another try: IMO this template doesn't work and for now there is no ability in OSM wiki to use UI language with templates. There has to be installed a patch to MediaWiki installation or created the pages MediaWiki:Lang and its translations e.g. MediaWiki:Lang/de, like that is done on https://meta.wikimedia.org/wiki/MediaWiki:Lang . See MediaWiki talk:Lang. Unfortunately I have no rights to create these pages. I would appreciate, if an admin user could go for it! --Chris2map (talk) 20:31, 1 April 2022 (UTC)

> there is no ability in OSM wiki to use UI language with templates
Interface language recognition somehow works - e.g. in case of Taginfo2 template - I didn't check if it uses {Uselang} template, but see for example at RU:Tag:building=yes - can you see messages from Taginfo2 template in Russian or in German? I can see it in Polish (my interface language). So we should find out why Taginfo2 correctly recognizes user's interface language :). maro21 12:08, 2 April 2022 (UTC)
I read MediaWiki talk:Lang and now I understand. I see that creating 20 such subpages with the most common languages used here would do the trick and we could create templates with content depending on the UI language! maro21 12:59, 2 April 2022 (UTC)
Exactly! Taginfo2 also uses "int:". But Taginfo2 doesn't need to know the UI language because it doesn't have to translate text within the template. All translations for Taginfo2 are stored in such separate pages like MediaWiki:Taginfo-all/pl. So "int:" does the job for Taginfo2 template, without the template taking notice of it. - Whereas with {{Uselang}} we would use the translation or selection (of the pages MediaWiki:Lang/...) done by "int:" to get a language parameter to set for "LangSwitch" etc. --Chris2map (talk) 16:37, 2 April 2022 (UTC)