「テンプレート:Language」の版間の差分
細 (1版) |
(相違点なし)
|
2015年3月14日 (土) 12:15時点における版
- This template is outdated. Use {{#language:fr|de}} -> français.
This template produces the word for a language given the language code, in a given language. By default, the fall-back language is English. Optionally this is suppressed, and the template produces nothing if the word is not available in the desired language. This can be useful if the English term is given anyway, with another call of the template.
Parameters
Parameter name | Description | Default value
|
---|---|---|
1 | language code for the language name to be produced | empty |
2 | language code for the language in which the name is expressed | the result of {{uselang}} , giving en
|
3 | if non-empty: do not produce the English word if the word in the requested language is not available; instead, produce nothing | empty |
Examples
Some results depend on the user language, try: de • en • fr • nl
{{language}}
→
{{language|ar}}
→ Arabic{{language|de}}
→ German{{language|is}}
→ Icelandic{{language|nl}}
→ Dutch{{language|zh-hant}}
→ Traditional Chinese
{{language|ar||x}}
→ Arabic{{language|de||x}}
→ German{{language|is||x}}
→ Icelandic{{language|nl||x}}
→ Dutch{{language|zh-hant||x}}
→ Traditional Chinese
{{language|ar|de}}
→ テンプレート:Language/de{{language|de|de}}
→ テンプレート:Language/de{{language|is|de}}
→ テンプレート:Language/de{{language|nl|de}}
→ テンプレート:Language/de{{language|zh-hant|de }}
→ テンプレート:Language/de
{{language|ar|de|x}}
→ テンプレート:Language/de{{language|de|de|x}}
→ テンプレート:Language/de{{language|is|de|x}}
→ テンプレート:Language/de{{language|nl|de|x}}
→ テンプレート:Language/de{{language|zh-hant|de|x}}
→ テンプレート:Language/de
If the subtemplate for the language in which the name is expressed is known to exist, and fall-back to English if the word is not available is not desired, then the subtemplate can more efficiently be called directly as follows:
{{language/nl|ar}}
→ テンプレート:Language/nl{{language/nl|de}}
→ テンプレート:Language/nl{{language/nl|is}}
→ テンプレート:Language/nl{{language/nl|nl}}
→ テンプレート:Language/nl{{language/nl|zh-hant}}
→ テンプレート:Language/nl
Required
- The page
MediaWiki:Lang/
xx for the user language xx set in the preferences; it should contain the language code xx - Lang/ja
Template:Language/
xx for the language in which the name is expressed, with in that page support for the language name to be produced:
They can be copied from commons (see list), but the following modification is needed:
- the default is removed
Localization
This template calls Template:Language/en. The following language versions are available: English | 日本語 | +/− Each calls Template:Language/layout.
See also
- commons:Template:Language
- mw:Help:Magic_words#Miscellaneous #language - returns the local name of the language
- svn:/trunk/phase3/languages/Names.php
Similar to en:Template:Language and fr:Modèle:Langue-local.