Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Language/doc: Difference between revisions

Template page
add examples using param 2 = fr and he
update doc
Line 1: Line 1:
{{TemplateBox
{{documentation subpage}}
|1=1
 
|1d=language code
This template will return the name of a language given the language code. This template is made specifically for the language codes used in MediaWiki (not necessarily ISO codes, but see {{tl|Language/ISO 639/en}}).
|1stat=required
 
|2=2
==Examples==
|2d=language code of the output language (provide this parameter only, if the output shall be in a fixed language instead of the user's preferred language)
|2stat=optional-
|name=Language
|desc=This template will return the localized name of a language given the language code.
|namespace=Template
|usergroup=all
|usage-notes=
'''Examples:'''
* <nowiki>{{language|ar}}</nowiki> → {{language|ar}}
* <nowiki>{{language|ar}}</nowiki> → {{language|ar}}
* <nowiki>{{language|is}}</nowiki> → {{language|is}}
* <nowiki>{{language|is}}</nowiki> → {{language|is}}
* <nowiki>{{language|zh-hant}}</nowiki> → {{language|zh-hant}}
* <nowiki>{{language|zh-hant}}</nowiki> → {{language|zh-hant}}
The second parameter can be used to set the desired output language, otherwise it will return the name in the user's interface language (if a translation exists).
* <nowiki>{{language|en|fr}}</nowiki> → {{language|en|fr}}
* <nowiki>{{language|en|fr}}</nowiki> → {{language|en|fr}}
* <nowiki>{{language|en|he}}</nowiki> → {{language|en|he}}
* <nowiki>{{language|en|he}}</nowiki> → {{language|en|he}}
|type=marker
 
|example=
You can also use this template's subpages directly to archive the same effect (which is also easier on the servers).
|i18n-method=autotranslate
* <nowiki>{{language/en|de}}</nowiki> → {{language/en|de}}
|i18n-desc=
* <nowiki>{{language/zh-hans|de}}</nowiki> → {{language/zh-hans|de}}
|seealso=
 
* {{mwl|language}} - returns the local name of the language
==Subpages==
{{Special:PrefixIndex/Template:Language/}}
 
==See also==
* {{x|language}} - returns the local name of the language
* [[svn:/trunk/phase3/languages/Names.php]]
* [[svn:/trunk/phase3/languages/Names.php]]
* [[:en:Template:Language]] - en.wp has a similar template. linked here for comparison only. theirs converts ISO 639-1/2 codes, ours converts the language codes we use in Wikimedia (Names.php) as well as some additional ISO 639-3 codes.
* {{tl|Language/ISO 639/en}} - returns the language name given a ISO 639 code (as opposed to the codes used in MediaWiki). Works for all 639-1, 639-2, 639-3 codes (you may have trouble editing it because of the size). Similar to [[:en:Template:Language]] and [[:fr:Modèle:Langue-local]].
|setscats=
 
|lines=one
[[Category:Internationalization templates|{{PAGENAME}}]]
|shorthand=
</noinclude>
}}

Revision as of 06:59, 3 May 2009

This template will return the name of a language given the language code. This template is made specifically for the language codes used in MediaWiki (not necessarily ISO codes, but see {{Language/ISO 639/en}}).

Examples

  • {{language|ar}} → Arabic
  • {{language|is}} → Icelandic
  • {{language|zh-hant}} → Traditional Chinese

The second parameter can be used to set the desired output language, otherwise it will return the name in the user's interface language (if a translation exists).

  • {{language|en|fr}} → anglais
  • {{language|en|he}} → אנגלית

You can also use this template's subpages directly to archive the same effect (which is also easier on the servers).

Subpages

See also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.