\Pop\I18nI18n

I18n and l10n class

Summary

Methods
Properties
Constants
__construct()
getLanguage()
getLocale()
loadFile()
__()
_e()
getLanguages()
No public properties found
No constants found
translate()
loadCurrentLanguage()
$directory
$language
$locale
$content
N/A
No private methods found
No private properties found
N/A

Properties

$directory

$directory : string

Directory with language files in it

Type

string

$language

$language : string

Default system language

Type

string

$locale

$locale : string

Default system locale

Type

string

$content

$content : array

Language content

Type

array

Methods

__construct()

__construct(string  $lang = null, string  $dir = null) : \Pop\I18n\I18n

Constructor

Instantiate the I18n object

Parameters

string $lang
string $dir

Returns

\Pop\I18n\I18n

getLanguage()

getLanguage() : string

Get current language setting

Returns

string

getLocale()

getLocale() : string

Get current locale setting

Returns

string

loadFile()

loadFile(string  $langFile) : void

Load language content from an XML file

Parameters

string $langFile

Throws

\Pop\I18n\Exception

__()

__(string  $str, string|array  $params = null) : string

Return the translated string

Parameters

string $str
string|array $params

Returns

string

_e()

_e(string  $str, string|array  $params = null) : void

Echo the translated string

Parameters

string $str
string|array $params

getLanguages()

getLanguages(string  $dir) : array

Get languages from the XML files

Parameters

string $dir

Returns

array

translate()

translate(string  $str, string|array  $params = null) : string

Translate and return the string

Parameters

string $str
string|array $params

Returns

string

loadCurrentLanguage()

loadCurrentLanguage() : void

Get language content from the XML file