I18n
in package
I18n and l10n class
Tags
Table of Contents
Properties
- $content : array<string|int, mixed>
- Language content
- $directory : string|null
- Directory with language files in it
- $language : string|null
- Default system language
- $locale : string
- Default system locale
Methods
- __() : string
- Return the translated string
- __construct() : mixed
- Constructor
- _e() : void
- Echo the translated string
- getLanguage() : string
- Get current language setting
- getLanguages() : array<string|int, mixed>
- Get languages from the XML files
- getLocale() : string
- Get current locale setting
- loadFile() : void
- Load language content from an XML file
- loadCurrentLanguage() : void
- Get language content from the XML file
- translate() : string
- Translate and return the string
Properties
$content
Language content
protected
array<string|int, mixed>
$content
= ['source' => [], 'output' => []]
$directory
Directory with language files in it
protected
string|null
$directory
= null
$language
Default system language
protected
string|null
$language
= null
$locale
Default system locale
protected
string
$locale
= null
Methods
__()
Return the translated string
public
__(string $str[, string|array<string|int, mixed>|null $params = null ][, mixed $variation = null ]) : string
Parameters
- $str : string
- $params : string|array<string|int, mixed>|null = null
- $variation : mixed = null
Return values
string__construct()
Constructor
public
__construct([string|null $lang = null ][, string|null $dir = null ]) : mixed
Instantiate the I18n object
Parameters
- $lang : string|null = null
- $dir : string|null = null
_e()
Echo the translated string
public
_e(string $str[, string|array<string|int, mixed>|null $params = null ][, mixed $variation = null ]) : void
Parameters
- $str : string
- $params : string|array<string|int, mixed>|null = null
- $variation : mixed = null
getLanguage()
Get current language setting
public
getLanguage() : string
Return values
stringgetLanguages()
Get languages from the XML files
public
static getLanguages(string $dir) : array<string|int, mixed>
Parameters
- $dir : string
Tags
Return values
array<string|int, mixed>getLocale()
Get current locale setting
public
getLocale() : string
Return values
stringloadFile()
Load language content from an XML file
public
loadFile(string $langFile) : void
Parameters
- $langFile : string
Tags
loadCurrentLanguage()
Get language content from the XML file
protected
loadCurrentLanguage() : void
Tags
translate()
Translate and return the string
protected
translate(string $str[, string|array<string|int, mixed>|null $params = null ][, mixed $variation = null ]) : string
Parameters
- $str : string
- $params : string|array<string|int, mixed>|null = null
- $variation : mixed = null