101 $this->langObjCache =
new MapCacheLRU( self::LANG_CACHE_SIZE );
112 $code = $this->options->get(
'DummyLanguageCodes' )[$code] ?? $code;
113 $langObj = $this->langObjCache->get( $code );
117 $this->langObjCache->set( $code, $langObj );
131 if ( !$this->langNameUtils->isValidCode( $code ) ) {
132 throw new MWException(
"Invalid language code \"$code\"" );
137 $this->localisationCache,
138 $this->langNameUtils,
140 $this->langConverterFactory,
144 if ( !$this->langNameUtils->isValidBuiltInCode( $code ) ) {
147 return new Language( ...$constructorArgs );
151 $class = $this->classFromCode( $code,
$fallback );
153 if ( class_exists( $class ) && is_a( $class,
'Language',
true ) ) {
154 return new $class( ...$constructorArgs );
158 $fallbacks = $this->langFallback->getAll( $code );
159 foreach ( $fallbacks as $fallbackCode ) {
160 $class = $this->classFromCode( $fallbackCode );
161 if ( class_exists( $class ) ) {
163 return new $class( ...$constructorArgs );
167 throw new MWException(
"Invalid fallback sequence for language '$code'" );
179 return 'Language' . str_replace(
'-',
'_', ucfirst( $code ) );
193 if ( !array_key_exists( $code, $this->parentLangCache ) ) {
194 $codeBase = explode(
'-', $code )[0];
195 if ( !in_array( $codeBase, LanguageConverter::$languagesWithVariants ) ) {
196 $this->parentLangCache[$code] =
null;
200 $lang = $this->getLanguage( $codeBase );
201 $converter = $this->langConverterFactory->getLanguageConverter(
$lang );
202 if ( !$converter->hasVariant( $code ) ) {
203 $this->parentLangCache[$code] =
null;
207 $this->parentLangCache[$code] =
$lang;
210 return $this->parentLangCache[$code];
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
Base class for multi-variant language conversion.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
Handles a simple LRU key/value map with a maximum number of entries.
if(!isset( $args[0])) $lang