Documentation

pm_Locale
in package

Localization facilities

Tags
since
11.0

Table of Contents

FALLBACK_LOCALE  = 'en-US'
getCode()  : string
Return current locale code
getSection()  : array<string|int, mixed>
Get translated messages by key according to current locale
keyExists()  : bool
Check if key exists in translations
lmsg()  : string
Translate message by key according to current locale
setCode()  : mixed
Set current locale code
setTranslation()  : mixed
Set translation from array

Constants

FALLBACK_LOCALE

public mixed FALLBACK_LOCALE = 'en-US'

Methods

getCode()

Return current locale code

public static getCode() : string
Return values
string

getSection()

Get translated messages by key according to current locale

public static getSection(string $sectionKey) : array<string|int, mixed>
Parameters
$sectionKey : string
Tags
since
17.0
Return values
array<string|int, mixed>

keyExists()

Check if key exists in translations

public static keyExists(string $key[, bool $findSection = false ]) : bool
Parameters
$key : string
$findSection : bool = false
Tags
since
17.0

added argument $findSection

Return values
bool

lmsg()

Translate message by key according to current locale

public static lmsg(string $key[, array<string|int, mixed> $params = [] ]) : string
Parameters
$key : string
$params : array<string|int, mixed> = []
Tags
since
12.0

added argument $params

Return values
string

setCode()

Set current locale code

public static setCode(string $localeCode) : mixed
Parameters
$localeCode : string
Tags
since
11.5
Return values
mixed

setTranslation()

Set translation from array

public static setTranslation(string $localeCode, array<string|int, mixed> $messages) : mixed
Parameters
$localeCode : string
$messages : array<string|int, mixed>
Return values
mixed

Search results