Jump to content

Do not begin to migrate content here, it may be wiped without notice. More info.

Template:SanitiseLanguageCode: Difference between revisions

From Debian Wiki
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 |..."
 
No edit summary
Line 59: Line 59:
| zh-tw
| zh-tw
| zh_tw = zh_TW
| zh_tw = zh_TW
| [[Category:Pages with unknown locales]]{{{1|{{#titleparts:{{PAGENAME}}|1}}}}}
| [[Category:Pages with invalid locales]]
}}
}}
</onlyinclude></pre>
</onlyinclude></pre>
Line 129: Line 129:
}
}
},
},
"description": "Convert language-code parameters (\"eN\", \"Pt-Br\" etc.) to a canonical version, or the empty string for unknown values."
"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:InputSanitisers]]
[[Category:Input Sanitisers]]

Revision as of 15:11, 7 September 2025

<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
| zh-tw
| zh_tw = zh_TW
| [[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.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Value1

Value to convert to a language code

Suggested values
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 pt_br pt_pt ro ru ru se si sk sr sv ta te tr uk us vi vi zh zh_cn zh_hk zh_tw
Example
pt_BR
Unknownrequired