MediaWiki  master
MediaWiki\Languages\LanguageConverterFactory Class Reference

An interface for creating language converters. More...

Collaboration diagram for MediaWiki\Languages\LanguageConverterFactory:

Public Member Functions

 __construct (ObjectFactory $objectFactory, $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

 instantiateConverter ( $lang)
 Returns Converter instance for given language object. More...
 

Private Attributes

 $cache = []
 
array $converterList
 
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...
 
ObjectFactory $objectFactory
 
const DEFAULT_CONVERTER
 
const EN_CONVERTER
 

Detailed Description

An interface for creating language converters.

Since
1.35

Definition at line 48 of file LanguageConverterFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Languages\LanguageConverterFactory::__construct ( ObjectFactory  $objectFactory,
  $usePigLatinVariant,
  $isConversionDisabled,
  $isTitleConversionDisabled,
callable  $defaultLanguage 
)
Parameters
ObjectFactory$objectFactory
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$defaultLanguagecallback of () : Language, should return default language. Used in getLanguageConverter when $language is null.
Access: internal
Should be called from MediaWikiServices only.

Definition at line 132 of file LanguageConverterFactory.php.

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

Member Function Documentation

◆ getLanguageConverter()

◆ instantiateConverter()

MediaWiki\Languages\LanguageConverterFactory::instantiateConverter (   $lang)
private

Returns Converter instance for given language object.

Parameters
Language | StubUserLang$lang
Returns
ILanguageConverter

Definition at line 152 of file LanguageConverterFactory.php.

◆ isConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isConversionDisabled ( )

Whether to disable language variant conversion.

Returns
bool

Definition at line 190 of file LanguageConverterFactory.php.

Referenced by MediaWiki\Languages\LanguageConverterFactory\__construct(), and Parser\__construct().

◆ isLinkConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isLinkConversionDisabled ( )

Whether to disable language variant conversion for links.

Returns
bool

Definition at line 207 of file LanguageConverterFactory.php.

◆ isTitleConversionDisabled()

MediaWiki\Languages\LanguageConverterFactory::isTitleConversionDisabled ( )

Whether to disable language variant conversion for titles.

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

Definition at line 199 of file LanguageConverterFactory.php.

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

Member Data Documentation

◆ $cache

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

Definition at line 50 of file LanguageConverterFactory.php.

◆ $converterList

array MediaWiki\Languages\LanguageConverterFactory::$converterList
private

Definition at line 54 of file LanguageConverterFactory.php.

◆ $defaultLanguage

callable MediaWiki\Languages\LanguageConverterFactory::$defaultLanguage
private

callback of () : Language

Definition at line 120 of file LanguageConverterFactory.php.

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

◆ $isConversionDisabled

bool MediaWiki\Languages\LanguageConverterFactory::$isConversionDisabled
private

Whether to disable language variant conversion.

Definition at line 110 of file LanguageConverterFactory.php.

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

◆ $isTitleConversionDisabled

bool MediaWiki\Languages\LanguageConverterFactory::$isTitleConversionDisabled
private

Whether to disable language variant conversion for links.

Definition at line 115 of file LanguageConverterFactory.php.

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

◆ $objectFactory

ObjectFactory MediaWiki\Languages\LanguageConverterFactory::$objectFactory
private

◆ DEFAULT_CONVERTER

const MediaWiki\Languages\LanguageConverterFactory::DEFAULT_CONVERTER
private
Initial value:
= [
'class' => TrivialLanguageConverter::class,
'services' => [
'TitleFormatter',
]
]

Definition at line 93 of file LanguageConverterFactory.php.

◆ EN_CONVERTER

const MediaWiki\Languages\LanguageConverterFactory::EN_CONVERTER
private
Initial value:
= [
'class' => EnConverter::class,
]

Definition at line 100 of file LanguageConverterFactory.php.

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


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