PocketMine-MP 5.23.3 git-fbaa125d0ce21ffef98fc1630881a92bedfbaa73
Loading...
Searching...
No Matches
pocketmine\lang\Language Class Reference
+ Collaboration diagram for pocketmine\lang\Language:

Public Member Functions

 __construct (string $lang, ?string $path=null, string $fallback=self::FALLBACK_LANGUAGE)
 
 get (string $id)
 
 getAll ()
 
 getLang ()
 
 getName ()
 
 translate (Translatable $c)
 
 translateString (string $str, array $params=[], ?string $onlyPrefix=null)
 

Static Public Member Functions

static getLanguageList (string $path="")
 

Public Attributes

const FALLBACK_LANGUAGE = "eng"
 

Protected Member Functions

 internalGet (string $id)
 
 parseTranslation (string $text, ?string $onlyPrefix=null)
 

Static Protected Member Functions

static loadLang (string $path, string $languageCode)
 

Protected Attributes

array $fallbackLang = []
 
array $lang = []
 
string $langName
 

Detailed Description

Definition at line 47 of file Language.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\lang\Language::__construct ( string $lang,
?string $path = null,
string $fallback = self::FALLBACK_LANGUAGE )
Exceptions
LanguageNotFoundException

Definition at line 106 of file Language.php.

Member Function Documentation

◆ get()

pocketmine\lang\Language::get ( string $id)

Definition at line 176 of file Language.php.

◆ getAll()

pocketmine\lang\Language::getAll ( )
Returns
string[] @phpstan-return array<string, string>

Definition at line 184 of file Language.php.

◆ getLang()

pocketmine\lang\Language::getLang ( )

Definition at line 121 of file Language.php.

◆ getLanguageList()

static pocketmine\lang\Language::getLanguageList ( string $path = "")
static
Returns
string[] @phpstan-return array<string, string>
Exceptions
LanguageNotFoundException

Definition at line 57 of file Language.php.

◆ getName()

pocketmine\lang\Language::getName ( )

Definition at line 117 of file Language.php.

◆ internalGet()

pocketmine\lang\Language::internalGet ( string $id)
protected

Definition at line 172 of file Language.php.

◆ loadLang()

static pocketmine\lang\Language::loadLang ( string $path,
string $languageCode )
staticprotected
Returns
string[] @phpstan-return array<string, string>

Definition at line 129 of file Language.php.

◆ parseTranslation()

pocketmine\lang\Language::parseTranslation ( string $text,
?string $onlyPrefix = null )
protected

Replaces translation keys embedded inside a string with their raw values. Embedded translation keys must be prefixed by a "%" character.

This is used to allow the "text" field of a Translatable to contain formatting (e.g. colour codes) and multiple embedded translation keys.

Normal translations whose "text" is just a single translation key don't need to use this method, and can be processed via get() directly.

Parameters
string | null$onlyPrefixIf non-null, only translation keys with this prefix will be replaced. This is used to allow a client to do its own translating of vanilla strings.

Definition at line 201 of file Language.php.

◆ translate()

pocketmine\lang\Language::translate ( Translatable $c)

Definition at line 158 of file Language.php.

◆ translateString()

pocketmine\lang\Language::translateString ( string $str,
array $params = [],
?string $onlyPrefix = null )
Parameters
(float|int|string|Translatable)[]$params

Definition at line 144 of file Language.php.

Member Data Documentation

◆ $fallbackLang

array pocketmine\lang\Language::$fallbackLang = []
protected

Definition at line 101 of file Language.php.

◆ $lang

array pocketmine\lang\Language::$lang = []
protected

Definition at line 96 of file Language.php.

◆ $langName

string pocketmine\lang\Language::$langName
protected

Definition at line 91 of file Language.php.

◆ FALLBACK_LANGUAGE

const pocketmine\lang\Language::FALLBACK_LANGUAGE = "eng"

Definition at line 49 of file Language.php.


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