MediaWiki talk:Lang

From OpenStreetMap Wiki
(Redirected from MediaWiki talk:Lang/qqq)
Jump to navigation Jump to search

Howto

Please define the MediaWiki:Lang message and store just "en" (without the quotes) to indicate the code of the default fallback language (English) used on this wiki for its visible user interface.

Then define the subpage in MediaWiki:Lang/qqq with a small documentation sentence showing how to define every other "MediaWiki:Lang/code" submessages :

Define the content of every subpage in "MediaWiki:Lang/code" where code matches a supported Mediawiki translation, and store there only the same language code as in the subpagename.
Do not insert anything else, not even any leading blanks or newlines or HTML comments or noinclude sections, as the content of every message in the special Mediawiki namespace is not parsed (like other Mediawiki pages in other namespaces) but is instead used litteraly !

Then perform what is indicated above by creating the necessary "MediaWiki:Lang/code" subpages (as many as there are translations of the MediaWiki interface loaded on this server). You may just load a few of these subpages, so that all other languages will be replaced by the default language code when using {{int:lang}} in autotranslatable templates.

If a subpage "MediaWiki:Lang/code" matching the code of the language currently used by the current user is not present, the wikicode {{int:lang}} will return the content of the MediaWiki:Lang message, i.e. the default fallback language code used by this wiki, i.e. "en" (without the quotes). So you should define as many "MediaWiki:Lang/code" messages as there are languages supported in the MediaWiki interface and imported on this server (the full list is visible in your user's Preferences page).

As long as there won't be a MediaWiki:Lang resource defined on this wiki server, the Wiki syntax {{int:lang}} will return the constant "<lang>" (between angle brackets showing that there's no such "lang" message defined on this server) instead of the language code of the current viewing user (if that language is supported by the Mediawiki interface), or otherwise the code of the default fallback language used on this wiki (if the user's current language is not supported by the MediaWiki visible interface).

Note: a patch in MediaWiki's internal extension for the "int:" prefix allows it to return directly the user's prefered language code for the UI (it returns the value of an internal variable in MediaWiki PHP code) when specifically quering "int:lang", without needing to create any "MediaWiki:Lang/code" page for each "supported" language (the list of supported language is visible in the Universal Language selector at top of pages or in the User's Preference panel). This is a bit more performant as the external sources don't need to be loaded from the wiki database. This small patch (deployed now on all wikis of Wikimedia projects) is still not deployed in the OSM wiki, so "int:lang" still requires those ~200 small "MediaWiki:Lang/code" resources in the wiki database.

For now, {{int:lang}} returns "⧼lang⧽" (without the quotes) : if you see angle brackets, the {{int:lang}} feature cannot work (due to missing messages), and it will be impossible to have autotranslatable templates that work like in the international wiki sites operated by the Wikimedia Foundation (Commons, Meta, Mediawiki), but also as in all linguistic editions of Wikipedia and Wiktionnary (that support as many user interfaces in languages different from the default language of the local linguistic edition).

The only alternative to using {{int:lang}} would be that this site defines a lot of pretranslated templates in the "Mediawiki:" namespace, but site admins could not maintain them in so many languages (so most autotranslatable templates will be user contributed). Here the site admins just have to maintain a single message per language code, the rest being defined in standard templates by normal users contributing their translations.

-- Verdy p 14:22, 15 February 2012 (UTC)

Now asked on https://wiki.openstreetmap.org/w/index.php?title=Wiki:Requests_for_administrator_attention&oldid=2307421 ( see Wiki:Requests for administrator attention for the latest page state ) Mateusz Konieczny (talk) 07:14, 5 April 2022 (UTC)

Still To-Do

The case described in "Howto" is still open and needs attention to make {{int:Lang}} work. This is required for e.g. {{Uselang}}, see also Template talk:Uselang#Working?. - I would appreciate, if an admin user could manage it! --Chris2map (talk) 07:59, 2 April 2022 (UTC)

If the method with int:Lang leads to technical problems, is there a usable workaround to output a message or display in the user language or UI language in another way? --Chris2map (talk) 19:42, 6 April 2022 (UTC)
Yes, you can use other MediaWiki: messages to check UI language :). What technical problems are there? maro21 20:07, 6 April 2022 (UTC)
Apparently there are or were various problems related to this: creates problems for VisualEditor, interface language magic word was declined, like remarked at Wiki%3ARequests_for_administrator_attention&type=revision&diff=2307421&oldid=2307414. --Chris2map (talk) 20:18, 6 April 2022 (UTC)
I saw it, but decling to add a magic word doesn't mean that there are technical problems. maro21 21:13, 6 April 2022 (UTC)
See a test with {{Move to Commons}}, e.g. File:Traffic Sign BG-G20-2 1.svg. --Chris2map (talk) 18:24, 23 April 2022 (UTC)
Yes, it works with the interface language :). But convince admins to add mediawiki:lang so we don't have to use such workarounds ;p. maro21 21:50, 23 April 2022 (UTC)