Template:BCP47: Difference between revisions
Template page
More actions
m fix incorrect nesting of some HTML comments |
Per BCP 47, “und” SHOULD NOT be used unless a language tag is required. According to MDN, an empty lang attribute explicitly conveys the same meaning as “und”, thus it’s unnecessary and SHOULD NOT be used. |
||
| Line 1: | Line 1: | ||
{{#switch:{{lc:{{{1|}}}}} | {{#switch:{{lc:{{{1|}}}}} | ||
<!-- pseudo codes --> | <!-- pseudo codes --> | ||
||root|default|i-default= | ||root|default|i-default=<!-- empty language tag means unknown per the HTML spec --><!-- or ={{int:lang}}? (the best user default), or =en? (the default "ContentLanguage" for unlocalized data on Meta) --> | ||
<!-- current BCP47 violations by Wikimedia sites, which can be fixed using standard tags when they exist --> | <!-- current BCP47 violations by Wikimedia sites, which can be fixed using standard tags when they exist --> | ||
| Line 139: | Line 139: | ||
This check is necessary to avoid a severe bug in MediaWiki, with some values of parameter 1, notably with | This check is necessary to avoid a severe bug in MediaWiki, with some values of parameter 1, notably with | ||
urlencoded characters (including quotes, braces, ampersands...), slashes, or any HTML or wiki formatting | urlencoded characters (including quotes, braces, ampersands...), slashes, or any HTML or wiki formatting | ||
(see also [[Template:CURRENTCONTENTLANGUAGE]]). If successful, force result to lowercase; otherwise return | (see also [[Template:CURRENTCONTENTLANGUAGE]]). If successful, force result to lowercase; otherwise | ||
return an empty language tag. | |||
--> | --> | ||
|#default = | |#default = | ||
{{#ifeq: {{#titleparts:{{{1|}}}|1}} | {{#titleparts:{{{1|}}}||-1}} | {{#ifeq: {{#titleparts:{{{1|}}}|1}} | {{#titleparts:{{{1|}}}||-1}} | ||
| {{#ifeq: {{lc:{{#titleparts:{{{1|}}}|1}}}} | {{ucfirst:{{lc:{{#titleparts:{{{1|}}}|1}}}}}} | | {{#ifeq: {{lc:{{#titleparts:{{{1|}}}|1}}}} | {{ucfirst:{{lc:{{#titleparts:{{{1|}}}|1}}}}}} | ||
| | | | ||
| {{#ifeq: {{{1|}}} | {{urlencode:{{{1|}}}}} | | {{#ifeq: {{{1|}}} | {{urlencode:{{{1|}}}}} | ||
| {{lc:{{{1|}}}}} | | {{lc:{{{1|}}}}} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
}}<noinclude>{{Documentation}}</noinclude> | }}<noinclude>{{Documentation}}</noinclude> | ||