WikiLambda
MediaWiki WikiLambda extension
Loading...
Searching...
No Matches
MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry Class Reference

A registry service for ZLanguage and language codes. More...

+ Inheritance diagram for MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry:
+ Collaboration diagram for MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry:

Public Member Functions

 getLanguageCodeFromZid ( $zid)
 Given a ZLanguage Zid, return its language code.
 
 getLanguageZidFromCode ( $code, $fallback=false)
 Given a language code, return its ZLanguage Zid.
 
 isLanguageKnownGivenCode ( $code)
 Check if a given language code, is a known ZLanguage Zid.
 
 isValidLanguageZid ( $zid)
 Checks if the given Zid is a valid language Zid.
 
 getLanguageZids ( $languageCodes)
 Returns an array of language Zids given an array of language codes.
 
 getListOfFallbackLanguageZids ( $languageFallback, $langCode)
 Return the list of unique language Zids that correspond to the user's selected language, its fallbacks, and English if requested.
 
- Public Member Functions inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
 register (string $zid, string $value)
 Utility method to cache a key value in a registry instance, where the key is the Zid of the cached ZObject.
 
 unregister (string $zid)
 Utility method to remove a given Zid from a registry instance.
 
 clear ()
 Utility method to clear the whole cache of a registry instance and set it to initial values.
 
 isZidCached (string $zid)
 Utility method to check if the given Zid is cached in the registry.
 

Public Attributes

const MULTILINGUAL_VALUE = 'Z1360'
 

Protected Member Functions

 initialize ()
 Initialize ZLangRegistry.
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
static singleton ()
 
static unregisterZid (string $zid)
 Unregisters the zid from any of the existing registry instances.
 
static clearAll ()
 Clears and re-initializes all existing registry instances.
 
- Protected Attributes inherited from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry
 $registry = []
 
 $type
 

Detailed Description

A registry service for ZLanguage and language codes.

Member Function Documentation

◆ getLanguageCodeFromZid()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::getLanguageCodeFromZid ( $zid)

Given a ZLanguage Zid, return its language code.

Parameters
string$zid
Returns
string
Exceptions
ZErrorException

◆ getLanguageZidFromCode()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::getLanguageZidFromCode ( $code,
$fallback = false )

Given a language code, return its ZLanguage Zid.

Parameters
string$code
bool$fallbackIf true, give the ZLanguage for English
Returns
string
Exceptions
ZErrorException

◆ getLanguageZids()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::getLanguageZids ( $languageCodes)

Returns an array of language Zids given an array of language codes.

Parameters
string[]$languageCodes
Returns
string[]

◆ getListOfFallbackLanguageZids()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::getListOfFallbackLanguageZids ( $languageFallback,
$langCode )

Return the list of unique language Zids that correspond to the user's selected language, its fallbacks, and English if requested.

Parameters
LanguageFallback$languageFallback
string$langCode- Language BCP47 code
Returns
string[]

◆ initialize()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::initialize ( )
protected

Initialize ZLangRegistry.

Reimplemented from MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry.

◆ isLanguageKnownGivenCode()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::isLanguageKnownGivenCode ( $code)

Check if a given language code, is a known ZLanguage Zid.

Parameters
string$code
Returns
bool

◆ isValidLanguageZid()

MediaWiki\Extension\WikiLambda\Registry\ZLangRegistry::isValidLanguageZid ( $zid)

Checks if the given Zid is a valid language Zid.

For that it first checks whether the Zid is registered, and if it's not, it fetches it from the database.

Parameters
string$zid
Returns
bool Is a valid ZLanguage Zid

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