39use Wikimedia\ObjectFactory\ObjectFactory;
54 private $converterList = [
56 'class' => BanConverter::class,
59 'class' => CrhConverter::class,
62 'class' => GanConverter::class,
65 'class' => IuConverter::class,
68 'class' => KkConverter::class,
71 'class' => KuConverter::class,
74 'class' => ShiConverter::class,
77 'class' => SrConverter::class,
80 'class' => TgConverter::class,
83 'class' => TlyConverter::class,
86 'class' => UzConverter::class,
89 'class' => ZhConverter::class,
93 private const DEFAULT_CONVERTER = [
94 'class' => TrivialLanguageConverter::class,
100 private const EN_CONVERTER = [
101 'class' => EnConverter::class,
105 private $objectFactory;
110 private $isConversionDisabled;
115 private $isTitleConversionDisabled;
120 private $defaultLanguage;
133 ObjectFactory $objectFactory,
134 $usePigLatinVariant, $isConversionDisabled, $isTitleConversionDisabled,
135 callable $defaultLanguage
137 $this->objectFactory = $objectFactory;
138 if ( $usePigLatinVariant ) {
139 $this->converterList[
'en'] = self::EN_CONVERTER;
143 $this->defaultLanguage = $defaultLanguage;
153 $code = mb_strtolower(
$lang->getCode() );
154 $spec = $this->converterList[$code] ?? self::DEFAULT_CONVERTER;
157 return $this->objectFactory->createObject(
160 'assertClass' => ILanguageConverter::class,
161 'extraArgs' => [
$lang ],
176 $lang = $language ?? ( $this->defaultLanguage )();
177 if ( isset( $this->cache[
$lang->getCode()] ) ) {
178 return $this->cache[
$lang->getCode()];
181 $converter = $this->instantiateConverter(
$lang );
182 $this->cache[
$lang->getCode()] = $converter;
191 return $this->isConversionDisabled;
200 return $this->isTitleConversionDisabled;
208 return $this->isConversionDisabled || $this->isTitleConversionDisabled;
Crimean Tatar (Qırımtatarca) converter routines.
English specific converter routines.
Gan Chinese specific code.
Kazakh (Қазақша) converter routines.
Kurdish converter routines.
Base class for language-specific code.
Serbian (Српски / Srpski) specific code.
Stub object for the user language.
Tajik (Тоҷикӣ) specific code, converting Tajiki to Latin orthography.
A trivial language converter.
Chinese converter routine.
The shared interface for all language converters.
if(!isset( $args[0])) $lang