MediaWiki  master
MediaWiki\Languages\LanguageConverterFactory Class Reference

An interface for creating language converters. More...

Public Member Functions

 __construct ( $usePigLatinVariant, $isConversionDisabled, $isTitleConversionDisabled, callable $defaultLanguage)
 
 getLanguageConverter ( $language=null)
 Provide a LanguageConverter for given language. More...
 
 isConversionDisabled ()
 Whether to disable language variant conversion. More...
 
 isLinkConversionDisabled ()
 Whether to disable language variant conversion for links. More...
 
 isTitleConversionDisabled ()
 Whether to disable language variant conversion for titles. More...
 

Private Member Functions

 classFromCode (string $code)
 Returns Converter's class name for given language code. More...
 

Private Attributes

 $cache = []
 
array $converterClasses
 
 $defaultConverterClass = TrivialLanguageConverter::class
 
callable $defaultLanguage
 callback of () : Language More...
 
bool $isConversionDisabled
 Whether to disable language variant conversion. More...
 
bool $isTitleConversionDisabled
 Whether to disable language variant conversion for links. More...
 

Detailed Description

An interface for creating language converters.

Since
1.35

Definition at line 46 of file LanguageConverterFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Languages\LanguageConverterFactory::__construct (   $usePigLatinVariant,
  $isConversionDisabled,
  $isTitleConversionDisabled,
callable  $defaultLanguage 
)
Parameters
bool$usePigLatinVariantshould pig variant of English be used
bool$isConversionDisabledWhether to disable language variant conversion
bool$isTitleConversionDisabledWhether to disable language variant conversion for links
callable$defaultLanguage- callback of () : Language, should return default language. Used in getLanguageConverter when $language is null.

Definition at line 93 of file LanguageConverterFactory.php.

References MediaWiki\Languages\LanguageConverterFactory\$defaultLanguage, MediaWiki\Languages\LanguageConverterFactory\$isConversionDisabled, MediaWiki\Languages\LanguageConverterFactory\$isTitleConversionDisabled, MediaWiki\Languages\LanguageConverterFactory\isConversionDisabled(), and MediaWiki\Languages\LanguageConverterFactory\isTitleConversionDisabled().

Member Function Documentation

◆ classFromCode()

MediaWiki\Languages\LanguageConverterFactory::classFromCode ( string  $code)
private

Returns Converter's class name for given language code.

Parameters
string$codecode for which class name should be provided
Returns
string

Definition at line 111 of file LanguageConverterFactory.php.

References MediaWiki\Languages\LanguageConverterFactory\$defaultConverterClass.

Referenced by MediaWiki\Languages\LanguageConverterFactory\getLanguageConverter().

◆ getLanguageConverter()

◆ isConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isConversionDisabled ( )

◆ isLinkConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isLinkConversionDisabled ( )

Whether to disable language variant conversion for links.

Returns
bool

Definition at line 158 of file LanguageConverterFactory.php.

References MediaWiki\Languages\LanguageConverterFactory\$isTitleConversionDisabled, and MediaWiki\Languages\LanguageConverterFactory\isConversionDisabled().

◆ isTitleConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isTitleConversionDisabled ( )

Whether to disable language variant conversion for titles.

Returns
bool
Deprecated:
1.36 Should use ::isLinkConversionDisabled() instead

Definition at line 150 of file LanguageConverterFactory.php.

References MediaWiki\Languages\LanguageConverterFactory\$isTitleConversionDisabled.

Referenced by MediaWiki\Languages\LanguageConverterFactory\__construct().

Member Data Documentation

◆ $cache

MediaWiki\Languages\LanguageConverterFactory::$cache = []
private

Definition at line 48 of file LanguageConverterFactory.php.

◆ $converterClasses

array MediaWiki\Languages\LanguageConverterFactory::$converterClasses
private
Initial value:
= [
'ban' => BanConverter::class,
'crh' => CrhConverter::class,
'gan' => GanConverter::class,
'iu' => IuConverter::class,
'kk' => KkConverter::class,
'ku' => KuConverter::class,
'shi' => ShiConverter::class,
'sr' => SrConverter::class,
'tg' => TgConverter::class,
'tly' => TlyConverter::class,
'uz' => UzConverter::class,
'zh' => ZhConverter::class,
]

Definition at line 52 of file LanguageConverterFactory.php.

◆ $defaultConverterClass

MediaWiki\Languages\LanguageConverterFactory::$defaultConverterClass = TrivialLanguageConverter::class
private

◆ $defaultLanguage

callable MediaWiki\Languages\LanguageConverterFactory::$defaultLanguage
private

◆ $isConversionDisabled

bool MediaWiki\Languages\LanguageConverterFactory::$isConversionDisabled
private

◆ $isTitleConversionDisabled

bool MediaWiki\Languages\LanguageConverterFactory::$isTitleConversionDisabled
private

The documentation for this class was generated from the following file: