Template:LangToWiki: Difference between revisions
Content deleted Content added
m +sgs |
m 8 revisions imported from meta:Template:LangToWiki: import |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{#invoke:langToWiki|wikidata|{{{1|{{int:lang}}}}}}}<noinclude> |
|||
{{#switch:{{int:lang}}|de-at=de|de-ch=de|de-formal=de|en-ca=en|en-gb=en|gsw=als|nl-informal=nl|pt-br=pt|sgs=bat-smg|{{int:lang}}}}<noinclude><br /> |
|||
This template allows to use <nowiki>{{int:lang}}</nowiki> for linking to wikis depending on interface language settings here on metawiki. More rules may be added as required.</noinclude> |
|||
{{documentation|content= |
|||
This template returns the Wikidata interwiki identifier which matches with interface language or the given language code. |
|||
<templateData> |
|||
{ |
|||
"params": { |
|||
"1": { |
|||
"label": "Language code", |
|||
"example": "pt-br", |
|||
"type": "string", |
|||
"suggested": true |
|||
} |
|||
}, |
|||
"description": "Returns the Wikidata interwiki identifier string, from interface language or given language code.", |
|||
"format": "inline" |
|||
} |
|||
</templateData> |
|||
== Examples == |
|||
* <code><nowiki>{{langToWiki}}</nowiki></code> gives <code>{{langToWiki}}</code> |
|||
* <code><nowiki>{{langToWiki|pt}}</nowiki></code> gives <code>{{langToWiki|pt}}</code> |
|||
* <code><nowiki>{{langToWiki|pt-br}}</nowiki></code> gives <code>{{langToWiki|pt-br}}</code> |
|||
* <code><nowiki>{{langToWiki|zh-hans}}</nowiki></code> gives <code>{{langToWiki|zh-hans}}</code> |
|||
* <code><nowiki>{{langToWiki|nan}}</nowiki></code> gives <code>{{langToWiki|nan}}</code> |
|||
* <code><nowiki>{{langToWiki|wikidata}}</nowiki></code> gives <code>{{langToWiki|wikidata}}</code> (not a language) |
|||
* <code><nowiki>{{langToWiki|abcdef}}</nowiki></code> gives <code>{{langToWiki|abcdef}}</code> (not a language) |
|||
== See also == |
|||
* {{tl|LangToIw}} which gives interwiki prefix (instead of Wikidata site identifier) and uses page language as default (instead of interface language). |
|||
}} |
|||
[[Category:Interwiki link templates]] |
|||
[[Category:Internationalization templates]] |
|||
</noinclude> |
Latest revision as of 23:25, 22 January 2024
en
Template documentation
This template returns the Wikidata interwiki identifier which matches with interface language or the given language code.
Returns the Wikidata interwiki identifier string, from interface language or given language code.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Language code | 1 | no description
| String | suggested |
Examples
{{langToWiki}}
givesen
{{langToWiki|pt}}
givespt
{{langToWiki|pt-br}}
givespt
{{langToWiki|zh-hans}}
giveszh
{{langToWiki|nan}}
giveszh_min_nan
{{langToWiki|wikidata}}
giveswikidata
(not a language){{langToWiki|abcdef}}
givesabcdef
(not a language)
See also
- {{LangToIw}} which gives interwiki prefix (instead of Wikidata site identifier) and uses page language as default (instead of interface language).