Template:Languagename/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

Usage

This is similar to Mediawiki’s {{#language:}} parser function.

  • {{Languagename|language-code}} returns the native language name (autonym). In most cases, outputs the same as {{#language:language-code}}, but supports additional languages still unknown to Mediawiki. Also equivalent to:
    {{Languagename|language-code|language-code}}
  • {{Languagename|language-code1|language-code2}} returns the language name translated to language-code2. In most cases, outputs the same as {{#language:language-code1|language-code2}}, but supports additional languages still unknown to Mediawiki.

For now the following additional language codes (valid in BCP 47) are recognized have have their language names translated by this template and not by Mediawiki’s {{#language:}} parser function which still does not support them correctly:

  • bh : Bihari, भोजपुरी
  • ca-valencia : Valencian, valencià
  • gcf : Guadeloupean Creole French, kréyòl gwadloupéyen
  • gsw : Alemannic, Alemannisch
  • kbp : Kabiye, kabɩyɛ
  • kfa : Kodava, ಕೊಡವ
  • mrw : Maranao, Maranao
  • rcf : Reunion Creole, kréol rénioné
  • sr-cyrl : Serbian (Cyrillic script), српски (ћирилица)
  • sr-latn : Serbian (Latin script), srpski (latinica)
  • sxu : Guadeloupean Creole French, kréyòl gwadloupéyen
  • swg : Swabian, Schwäbisch
  • sxu : Upper Saxon, Obersächsisch
  • trp : Kokborok, Kókborok ককবরক
  • tzm : Central Atlas Tamazight, ⵜⴰⵎⴰⵣⵉⵖⵜ
  • zgh : Standard Moroccan Tamazight, ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ

Unlike MediaWiki's parser function, if the first parameter is unspecified or empty, it takes its default non-empty value from the language of the current page, as returned by {{Langcode}} (for this case, the Mediawiki parser function would only return an empty text).

But like MediaWiki's parser function, if the second parameter is unspecified or empty, it takes its default its default non-empty value from the first parameter (itself taking a default valmue from {{Langcode}} if this parameter is also unspecified or empty).

Technical notes

The following two standard language codes have their names defined by MediaWiki using legacy non-standard codes of Wikimedia, and this template currently uses these aliases (which will remain as long as they are not converted to the BCP47 standard; these language codes are perfectly wellformed for BCP 47, but their incorrect current usage in MediaWiki localisation data is referencing completeley unrelated country codes, but not any script) :

  • sr-cyrl (variant written with the Cyrillic alphabet) : its language names are taken from the legacy Mediawiki localisation data for sr-ec, normally a language variant for Ecuador, according to the ISO 3166-1 standard, and valid in BCP 47 (such usage for international locale codes is incompatible and conflicting with both ISO 3166-1 and BCP 47);
  • sr-latn (variant written with the Latin alphabet) : its language names are taken from the legacy Mediawiki localisation data for sr-el, normally a language variant for Greece, according to the ISO 3166-1 standard with the special reservation of EL for the European Union (and a few other organizations) as an alias for GR (such usage for international locale codes is incompatible and conflicting with both ISO 3166-1 and BCP 47).

These usages will probably not conflict with localisation needed in Serbian needing specific variants for Ecuador (extremely unlikely) or Greece (if there's a Serbian-speaking minority in Greece and an ethnic Greek community in Serbia speaking Serbian as a secondary language, where both may want to write the Serbian language in the Greek alphabet, they could still use "sr-gr" without problem, but it is unlikely they'll need specific language names different from standard serbian in one of its two scripts, or they could use "sr-grek" for a Serbian variant written in the Greek alphabet).

All other language codes not specifically defined by this template will have their names taken from MediaWiki localisation data using the builtin "#language:" parser function (including for providing fallback names from another language). As well, any other non-conforming locale code defined in MediaWiki and generally coming on this wiki from usages in Wikipedia (such as "simple", "zh-classical") will be accepted by this template, which will recognize them and provide translations as needed: if this ever creates a conflict for some languages, the standard can be restored by updating this template to remap the codes.

See also