MediaWiki REL1_35
MediaWiki\Languages\LanguageConverterFactory Class Reference

An interface for creating language converters. More...

Public Member Functions

 __construct ( $usePigLatinVariant, callable $defaultLanguage)
 
 getLanguageConverter ( $language=null)
 Provide a LanguageConverter for given language.
 

Private Member Functions

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

Private Attributes

 $cache = []
 
array $converterClasses
 
 $defaultConverterClass = TrivialLanguageConverter::class
 
callable $defaultLanguage
 callback of () : Language
 

Detailed Description

An interface for creating language converters.

Since
1.35

Definition at line 44 of file LanguageConverterFactory.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 77 of file LanguageConverterFactory.php.

References MediaWiki\Languages\LanguageConverterFactory\$defaultLanguage.

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 90 of file LanguageConverterFactory.php.

◆ getLanguageConverter()

MediaWiki\Languages\LanguageConverterFactory::getLanguageConverter (   $language = null)

Provide a LanguageConverter for given language.

Parameters
Language | null$languagefor which a LanguageConverter should be provided. If null then LanguageConverter provided for current content language as returned by the callback provided to the constructor..
Returns
ILanguageConverter

Definition at line 104 of file LanguageConverterFactory.php.

References $lang.

Member Data Documentation

◆ $cache

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

Definition at line 46 of file LanguageConverterFactory.php.

◆ $converterClasses

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

Definition at line 50 of file LanguageConverterFactory.php.

◆ $defaultConverterClass

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

Definition at line 63 of file LanguageConverterFactory.php.

◆ $defaultLanguage

callable MediaWiki\Languages\LanguageConverterFactory::$defaultLanguage
private

callback of () : Language

Definition at line 68 of file LanguageConverterFactory.php.

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


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