MediaWiki talk:Lang

From OpenStreetMap Wiki
Jump to: navigation, search


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)