Michael added a comment.
We can't fix it where I would like to fix it:
name=RequestContext::getLanguage()
// There are certain characters we don't allow
in language code strings,
// but by and large almost any valid UTF-8
string will makes it past
// this check and the
LanguageNameUtils::isValidCode method it uses.
// This is to support on-wiki interface message
overrides for
// non-existent language codes. Also known as
"Uselang hacks".
// See
<https://www.mediawiki.org/wiki/Manual:Uselang_hack>
// For something like "en-whatever" or
"de-whatever" it will end up
// with a mostly "en" or "de" interface, but
with an extra layer of
// possible MessageCache overrides from
`MediaWiki:*/<code>` titles.
// While non-ASCII works here, it is required
that they are in
// NFC form given this will not convert to
normalised form.
$code = self::sanitizeLangCode( $code );
The reasoning more better explained in T39564#407711
<https://phabricator.wikimedia.org/T39564#407711>:
> See implementation of Language::isValidCode, which explicitly doesn't check
whether a language exists, in order to allow {{int:}} hacks such as
historically used on Wikimedia Commons to provide an extra dimension of
interface customisation:
>
>
https://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=ownwork
>
https://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=fromflickr
>
https://commons.wikimedia.org/w/index.php?title=Special:Upload&uselang=fromgov
>
> So until we decide do no longer support that, it makes sense to have this
consistently reflected throughout and not make a weird exception just for <html
lang> but not anywhere else.
I'll keep looking. There must be some place that lends itself to throwing out
everything except a valid language code.
TASK DETAIL
https://phabricator.wikimedia.org/T250930
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Michael
Cc: WMDE-leszek, Addshore, Aklapper, Iflorez, darthmon_wmde, alaa_wmde,
Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen,
rosalieper, Scott_WUaS, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs