• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.213
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Mw lang

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Mw lang
WarningThis template is used on approximately 70,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.

A template similar to {{ISO 639 name}} that uses MediaWiki's language set.

Usage

This template accepts two positional parameters and has one named parameter.

{{mw lang|<language code or name>|<target language code>|fn=<function name>}}

  • |fn= – names the function to be called in Module:mw lang. Valid values are:
    • name_from_code – (default) essentially the same as the {{#language:}} magic word
    • is_code – returns true when <language code> is a valid MediaWiki language code
    • code_from_name – inverse of name_from_code; attempts to return a language code for <language name>
    • is_name – returns true when <language name> is a valid MediaWiki language name
  • <language code> required for name_from_code and is_code
  • <language name> required for code_from_name – case agnostic, must otherwise match MediaWiki language name exactly
  • <target language code> (optional) specifies MediaWiki language set to evaluate; defaults to local wiki language

Examples

{{mw lang|nv|en}} → Navajo

{{mw lang| nv | sq }} → navahoisht

{{mw lang|fn=is_code|nv|en}} → true

{{mw lang|fn=is_code|xx}} →← (not valid, returns nil)

{{mw lang|fn=code_from_name|navajo|en}} → nv

{{mw lang|fn=code_from_name| navahoisht | sq }} → nv

The above documentation is transcluded from Template:Mw lang/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Mw_lang&oldid=24208"
Category:
  • Lua-based templates
Last edited on 1 September 2020, at 11:35

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 1 September 2020, at 11:35.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop