Template:SanitiseLanguageCode: Difference between revisions
Appearance
AndrewSayers (talk | contribs) Created page with "<pre><onlyinclude>{{#switch:{{lc: {{{1|{{#titleparts:{{PAGENAME}}|1}}}}} }}| | ar | be | bn | ca | cn | cs | da | de | el | en | en | eo | es | es | fa | fi | fr | fr | he | hu | id | it | ja | jp | ko | lv | ms | nb | nl | nn | no | pl | pt | ro | ru | ru | se | si | sk | sr | sv | ta | te | tr | uk | us | vi | vi | zh = {{lc: {{{1|{{#titleparts:{{PAGENAME}}|1}}}}} }} | pt-br | pt_br = pt_BR | pt-pt | pt_pt = pt_PT | zh-cn | zh_cn = zh_CN | zh-hk | zh_hk = zh_HK |..." |
AndrewSayers (talk | contribs) No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<pre><onlyinclude>{{#switch:{{lc: {{{1| | <pre><onlyinclude>{{#switch:{{lc:{{{1|}}}}}| | ||
| ar | | ar | ||
| be | | be | ||
| Line 10: | Line 10: | ||
| el | | el | ||
| en | | en | ||
| eo | | eo | ||
| es | | es | ||
| fa | | fa | ||
| fi | | fi | ||
| fr | | fr | ||
| he | | he | ||
| hu | | hu | ||
| Line 35: | Line 32: | ||
| ro | | ro | ||
| ru | | ru | ||
| se | | se | ||
| si | | si | ||
| Line 47: | Line 43: | ||
| us | | us | ||
| vi | | vi | ||
| zh = {{lc:{{{1|}}}}} | |||
| zh = {{lc: {{{1| | |||
| pt-br | | pt-br | ||
| pt_br = pt_BR | | pt_br = pt_BR | ||
| Line 59: | Line 54: | ||
| zh-tw | | zh-tw | ||
| zh_tw = zh_TW | | zh_tw = zh_TW | ||
| | | {{#if:{{{IgnoreInvalid}}}|{{#if:{{{IgnoreInvalid|}}}||[[Category:Pages with invalid locales]]|}}}} | ||
}} | }}</onlyinclude></pre> | ||
</onlyinclude></pre> | |||
<templatedata> | <templatedata> | ||
{ | { | ||
| Line 81: | Line 75: | ||
"el", | "el", | ||
"en", | "en", | ||
"eo", | "eo", | ||
"es", | "es", | ||
"fa", | "fa", | ||
"fi", | "fi", | ||
"fr", | "fr", | ||
"he", | "he", | ||
"hu", | "hu", | ||
| Line 108: | Line 99: | ||
"ro", | "ro", | ||
"ru", | "ru", | ||
"se", | "se", | ||
"si", | "si", | ||
| Line 120: | Line 110: | ||
"us", | "us", | ||
"vi", | "vi", | ||
"zh", | "zh", | ||
"zh_cn", | "zh_cn", | ||
| Line 127: | Line 116: | ||
], | ], | ||
"required": true | "required": true | ||
}, | |||
"IgnoreInvalid": { | |||
"description": "If present, an invalid parameter will not cause this to be added to the \"Pages with invalid language codes\" category." | |||
} | } | ||
}, | }, | ||
"description": "Convert language-code parameters (\"eN\", \"Pt-Br\" etc.) to a canonical version, | "description": "Convert language-code parameters (\"eN\", \"Pt-Br\" etc.) to a canonical version, convert unknown values to the empty string. Please call this from other templates to sanitise your boolean values." | ||
} | } | ||
</templatedata> | </templatedata> | ||
[[Category: | [[Category:Input Sanitisers]] | ||
Latest revision as of 17:24, 11 September 2025
<onlyinclude>{{#switch:{{lc:{{{1|}}}}}|
| ar
| be
| bn
| ca
| cn
| cs
| da
| de
| el
| en
| eo
| es
| fa
| fi
| fr
| he
| hu
| id
| it
| ja
| jp
| ko
| lv
| ms
| nb
| nl
| nn
| no
| pl
| pt
| ro
| ru
| se
| si
| sk
| sr
| sv
| ta
| te
| tr
| uk
| us
| vi
| zh = {{lc:{{{1|}}}}}
| pt-br
| pt_br = pt_BR
| pt-pt
| pt_pt = pt_PT
| zh-cn
| zh_cn = zh_CN
| zh-hk
| zh_hk = zh_HK
| zh-tw
| zh_tw = zh_TW
| {{#if:{{{IgnoreInvalid}}}|{{#if:{{{IgnoreInvalid|}}}||[[Category:Pages with invalid locales]]|}}}}
}}</onlyinclude>
Convert language-code parameters ("eN", "Pt-Br" etc.) to a canonical version, convert unknown values to the empty string. Please call this from other templates to sanitise your boolean values.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Value | 1 | Value to convert to a language code
| Unknown | required |
| IgnoreInvalid | IgnoreInvalid | If present, an invalid parameter will not cause this to be added to the "Pages with invalid language codes" category. | Unknown | optional |