Changes
further check of valid characters in language codes: only [-.0-9A-Z_a-z] are idempotent in URLENCODE, but we already disallowed uppercase letters and underscore:
{{#switchifeq: {{#titleparts:{{PAGENAME}}||-1}}| {{#titleparts:{{PAGENAME}}|1}}|| {{#ifeq: {{#titleparts:{{PAGENAME}}||-1}} = | {{lc:{{PAGENAME| {{#default = titleparts:{{PAGENAME}}||-1}}}}}} | {{#ifeq: {{#titleparts:{{PAGENAME}}||-1}} | {{urlencode:{{#titleparts:{{PAGENAME}}||-1}}}} | {{#ifeq: {{lc:{{#titleparts:{{PAGENAME}}||-1}}}} |{{ucfirst:{{lc:{{#titleparts:{{PAGENAME}}||-1}}}}}} | | {{#titleparts:{{PAGENAME}}||-1}}}}}}}}}}<noinclude>{{Documentation}}</noinclude>