41use Wikimedia\ObjectFactory\ObjectFactory;
57 private $converterList = [
59 'class' => BanConverter::class,
62 'class' => CrhConverter::class,
65 'class' => GanConverter::class,
68 'class' => IuConverter::class,
71 'class' => KuConverter::class,
74 'class' => ShiConverter::class,
77 'class' => ShConverter::class,
80 'class' => SrConverter::class,
83 'class' => TgConverter::class,
86 'class' => TlyConverter::class,
89 'class' => UzConverter::class,
92 'class' => WuuConverter::class,
95 'class' => ZhConverter::class,
99 private const DEFAULT_CONVERTER = [
100 'class' => TrivialLanguageConverter::class,
106 private const EN_CONVERTER = [
107 'class' => EnConverter::class,
120 private ObjectFactory $objectFactory;
125 private $defaultLanguage;
137 ObjectFactory $objectFactory,
138 callable $defaultLanguage
141 $this->options = $options;
142 $this->objectFactory = $objectFactory;
144 $this->converterList[
'en'] = self::EN_CONVERTER;
146 $this->defaultLanguage = $defaultLanguage;
156 $code = mb_strtolower( $lang->getCode() );
157 $spec = $this->converterList[$code] ?? self::DEFAULT_CONVERTER;
160 return $this->objectFactory->createObject(
163 'assertClass' => ILanguageConverter::class,
164 'extraArgs' => [ $lang ],
179 $lang = $language ?? ( $this->defaultLanguage )();
180 if ( isset( $this->cache[$lang->getCode()] ) ) {
181 return $this->cache[$lang->getCode()];
184 $converter = $this->instantiateConverter( $lang );
185 $this->cache[$lang->getCode()] = $converter;
195 return $this->options->get( MainConfigNames::DisableLangConversion );
204 return $this->options->get( MainConfigNames::DisableLangConversion ) ||
206 $this->options->get( MainConfigNames::DisableTitleConversion );
Crimean Tatar (Qırımtatarca) converter routines.
English specific converter routines.
Gan Chinese specific code.
Kurdish converter routines.
Base class for language-specific code.
A class containing constants representing the names of configuration variables.
const UsePigLatinVariant
Name constant for the UsePigLatinVariant setting, for use with Config::get()
const DisableLangConversion
Name constant for the DisableLangConversion setting, for use with Config::get()
const DisableTitleConversion
Name constant for the DisableTitleConversion setting, for use with Config::get()
Converts Serbo-Croatian from Latin script to Cyrillic script.
Serbian (Српски / Srpski) specific code.
Tajik (Тоҷикӣ) specific code, converting Tajiki to Latin orthography.
A trivial language converter.
Wu language specific code.
Chinese converter routine.
The shared interface for all language converters.