Merge "RequestContext: Clarify uselang support and how it works"
This commit is contained in:
commit
393909537e
1 changed files with 12 additions and 0 deletions
|
|
@ -344,6 +344,18 @@ class RequestContext implements IContextSource, MutableContext {
|
|||
if ( $code === 'user' ) {
|
||||
$code = $user->getOption( 'language' );
|
||||
}
|
||||
|
||||
// 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 );
|
||||
|
||||
Hooks::run( 'UserGetLanguageObject', [ $user, &$code, $this ] );
|
||||
|
|
|
|||
Loading…
Reference in a new issue