build: Remove 'stylelint' package as it gets pulled-in by 'stylelint-config-wikimedia'
[lhc/web/wiklou.git] / includes / Setup.php
index bdfce62..aba050d 100644 (file)
@@ -498,11 +498,24 @@ if ( is_array( $wgExtraNamespaces ) ) {
        $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
 }
 
+// Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
+if ( count( $wgDummyLanguageCodes ) !== 0 ) {
+       wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
+}
 // Merge in the legacy language codes, incorporating overrides from the config
 $wgDummyLanguageCodes += [
+       // Internal language codes of the private-use area which get mapped to
+       // themselves.
        'qqq' => 'qqq', // Used for message documentation
        'qqx' => 'qqx', // Used for viewing message keys
 ] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping();
+// Merge in (inverted) BCP 47 mappings
+foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) {
+       $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
+       if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
+               $wgDummyLanguageCodes[$bcp47] = $wgDummyLanguageCodes[$code] ?? $code;
+       }
+}
 
 // These are now the same, always
 // To determine the user language, use $wgLang->getCode()