MediaWiki REL1_39
MediaWiki\Languages\LanguageFactory Class Reference

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

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 with normalization of the language code.
 
 getParentLanguage ( $code)
 Get the "parent" language which has a converter to convert a "compatible" language (in another variant) to this language (eg.
 
 getRawLanguage ( $code)
 Get a cached or new language object for a given language code without normalization of the language code.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

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

Since
1.35

Definition at line 41 of file LanguageFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Languages\LanguageFactory::__construct ( ServiceOptions $options,
NamespaceInfo $namespaceInfo,
LocalisationCache $localisationCache,
LanguageNameUtils $langNameUtils,
LanguageFallback $langFallback,
LanguageConverterFactory $langConverterFactory,
HookContainer $hookContainer,
Config $config )
Parameters
ServiceOptions$options
NamespaceInfo$namespaceInfo
LocalisationCache$localisationCache
LanguageNameUtils$langNameUtils
LanguageFallback$langFallback
LanguageConverterFactory$langConverterFactory
HookContainer$hookContainer
Config$config

Definition at line 92 of file LanguageFactory.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ getLanguage()

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

Get a cached or new language object for a given language code with normalization of the 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 126 of file LanguageFactory.php.

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 219 of file LanguageFactory.php.

References $lang.

◆ getRawLanguage()

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

Get a cached or new language object for a given language code without normalization of the 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
Since
1.39

Definition at line 140 of file LanguageFactory.php.

Referenced by AllMessagesTablePager\__construct().

Member Data Documentation

◆ 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 75 of file LanguageFactory.php.


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