71 public const CONSTRUCTOR_OPTIONS = [
109 $code = $this->options->get(
'DummyLanguageCodes' )[$code] ?? $code;
117 $this->langObjCache = Language::$mLangObjCache;
121 $langObj = $this->langObjCache[$code] ?? $this->
newFromCode( $code );
124 $this->langObjCache = array_merge( [ $code => $langObj ], $this->langObjCache );
126 $this->langObjCache =
127 array_slice( $this->langObjCache, 0, $this->options->get(
'LangObjCacheSize' ),
true );
148 if ( !$this->langNameUtils->isValidCode( $code ) ) {
149 throw new MWException(
"Invalid language code \"$code\"" );
154 $this->localisationCache,
155 $this->langNameUtils,
157 $this->langConverterFactory,
161 if ( !$this->langNameUtils->isValidBuiltInCode( $code ) ) {
164 return new Language( ...$constructorArgs );
168 $class = $this->classFromCode( $code,
$fallback );
170 if ( class_exists( $class ) && is_a( $class,
'Language',
true ) ) {
171 return new $class( ...$constructorArgs );
175 $fallbacks = $this->langFallback->getAll( $code );
176 foreach ( $fallbacks as $fallbackCode ) {
177 $class = $this->classFromCode( $fallbackCode );
178 if ( class_exists( $class ) ) {
180 return new $class( ...$constructorArgs );
184 throw new MWException(
"Invalid fallback sequence for language '$code'" );
196 return 'Language' . str_replace(
'-',
'_', ucfirst( $code ) );
210 if ( !array_key_exists( $code, $this->parentLangCache ) ) {
211 $codeBase = explode(
'-', $code )[0];
212 if ( !in_array( $codeBase, LanguageConverter::$languagesWithVariants ) ) {
213 $this->parentLangCache[$code] =
null;
217 $lang = $this->getLanguage( $codeBase );
218 $converter = $this->langConverterFactory->getLanguageConverter(
$lang );
219 if ( !$converter->hasVariant( $code ) ) {
220 $this->parentLangCache[$code] =
null;
224 $this->parentLangCache[$code] =
$lang;
227 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.
if(!isset( $args[0])) $lang