MediaWiki  master
MediaWiki\Languages\LanguageFactory Class Reference

Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more information. More...

Collaboration diagram for MediaWiki\Languages\LanguageFactory:

Public Member Functions

 __construct (ServiceOptions $options, NamespaceInfo $namespaceInfo, LocalisationCache $localisationCache, LanguageNameUtils $langNameUtils, LanguageFallback $langFallback, LanguageConverterFactory $langConverterFactory, HookContainer $hookContainer, Config $config)
 
 getLanguage ( $code)
 Get a cached or new language object for a given language code. More...
 
 getParentLanguage ( $code)
 Get the "parent" language which has a converter to convert a "compatible" language (in another variant) to this language (eg. More...
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Private Member Functions

 classFromCode ( $code, $fallback=true)
 
 newFromCode ( $code, $fallback=false)
 Create a language object for a given language code. More...
 

Private Attributes

Config $config
 
HookContainer $hookContainer
 
LanguageConverterFactory $langConverterFactory
 
LanguageFallback $langFallback
 
LanguageNameUtils $langNameUtils
 
MapCacheLRU $langObjCache
 
LocalisationCache $localisationCache
 
NamespaceInfo $namespaceInfo
 
ServiceOptions $options
 
array $parentLangCache = []
 
const LANG_CACHE_SIZE = 10
 How many distinct Language objects to retain at most in memory (T40439). More...
 

Detailed Description

Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more information.

Since
1.35

Definition at line 45 of file LanguageFactory.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ classFromCode()

MediaWiki\Languages\LanguageFactory::classFromCode (   $code,
  $fallback = true 
)
private
Parameters
string$code
bool$fallbackWhether we're going through language fallback chain
Returns
string Name of the language class

Definition at line 193 of file LanguageFactory.php.

References $fallback.

◆ getLanguage()

MediaWiki\Languages\LanguageFactory::getLanguage (   $code)

Get a cached or new language object for a given language code.

Parameters
string$code
Exceptions
MWExceptionif the language code contains dangerous characters, e.g. HTML special characters or characters illegal in MediaWiki titles.
Returns
Language

Definition at line 129 of file LanguageFactory.php.

References MediaWiki\Languages\LanguageFactory\newFromCode().

Referenced by MediaWiki\User\TempUser\LocalizedNumericSerialMapping\__construct(), CollationCkb\__construct(), UppercaseCollation\__construct(), NumericUppercaseCollation\__construct(), IcuCollation\__construct(), and CustomUppercaseCollation\__construct().

◆ getParentLanguage()

MediaWiki\Languages\LanguageFactory::getParentLanguage (   $code)

Get the "parent" language which has a converter to convert a "compatible" language (in another variant) to this language (eg.

zh for zh-cn, but not en for en-gb).

Parameters
string$code
Returns
Language|null
Since
1.22

Definition at line 209 of file LanguageFactory.php.

References $lang, and LanguageConverter\$languagesWithVariants.

◆ newFromCode()

MediaWiki\Languages\LanguageFactory::newFromCode (   $code,
  $fallback = false 
)
private

Create a language object for a given language code.

Parameters
string$code
bool$fallbackWhether we're going through language fallback chain
Exceptions
MWExceptionif the language code or fallback sequence is invalid
Returns
Language

Definition at line 146 of file LanguageFactory.php.

Referenced by MediaWiki\Languages\LanguageFactory\getLanguage().

Member Data Documentation

◆ $config

Config MediaWiki\Languages\LanguageFactory::$config
private

Definition at line 71 of file LanguageFactory.php.

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

◆ $hookContainer

HookContainer MediaWiki\Languages\LanguageFactory::$hookContainer
private

Definition at line 65 of file LanguageFactory.php.

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

◆ $langConverterFactory

LanguageConverterFactory MediaWiki\Languages\LanguageFactory::$langConverterFactory
private

Definition at line 62 of file LanguageFactory.php.

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

◆ $langFallback

LanguageFallback MediaWiki\Languages\LanguageFactory::$langFallback
private

Definition at line 59 of file LanguageFactory.php.

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

◆ $langNameUtils

LanguageNameUtils MediaWiki\Languages\LanguageFactory::$langNameUtils
private

Definition at line 56 of file LanguageFactory.php.

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

◆ $langObjCache

MapCacheLRU MediaWiki\Languages\LanguageFactory::$langObjCache
private

Definition at line 68 of file LanguageFactory.php.

◆ $localisationCache

LocalisationCache MediaWiki\Languages\LanguageFactory::$localisationCache
private

Definition at line 53 of file LanguageFactory.php.

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

◆ $namespaceInfo

NamespaceInfo MediaWiki\Languages\LanguageFactory::$namespaceInfo
private

Definition at line 50 of file LanguageFactory.php.

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

◆ $options

ServiceOptions MediaWiki\Languages\LanguageFactory::$options
private

Definition at line 47 of file LanguageFactory.php.

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

◆ $parentLangCache

array MediaWiki\Languages\LanguageFactory::$parentLangCache = []
private

Definition at line 74 of file LanguageFactory.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Languages\LanguageFactory::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const DummyLanguageCodes
Name constant for the DummyLanguageCodes setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 79 of file LanguageFactory.php.

◆ LANG_CACHE_SIZE

const MediaWiki\Languages\LanguageFactory::LANG_CACHE_SIZE = 10
private

How many distinct Language objects to retain at most in memory (T40439).

Definition at line 84 of file LanguageFactory.php.


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