Documentation

I18n
in package

I18n and l10n class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.2.0

Table of Contents

$content  : array<string|int, mixed>
Language content
$directory  : string
Directory with language files in it
$language  : string
Default system language
$locale  : string
Default system locale
__()  : 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 $directory = null

$language

Default system language

protected string $language = null

$locale

Default system locale

protected string $locale = null

Methods

__()

Return the translated string

public __(string $str[, string|array<string|int, mixed> $params = null ][, mixed $variation = null ]) : string
Parameters
$str : string
$params : string|array<string|int, mixed> = null
$variation : mixed = null
Return values
string

__construct()

Constructor

public __construct([string $lang = null ][, string $dir = null ]) : mixed

Instantiate the I18n object

Parameters
$lang : string = null
$dir : string = null
Return values
mixed

_e()

Echo the translated string

public _e(string $str[, string|array<string|int, mixed> $params = null ][, mixed $variation = null ]) : void
Parameters
$str : string
$params : string|array<string|int, mixed> = null
$variation : mixed = null
Return values
void

getLanguage()

Get current language setting

public getLanguage() : string
Return values
string

getLanguages()

Get languages from the XML files

public static getLanguages(string $dir) : array<string|int, mixed>
Parameters
$dir : string
Return values
array<string|int, mixed>

getLocale()

Get current locale setting

public getLocale() : string
Return values
string

loadFile()

Load language content from an XML file

public loadFile(string $langFile) : void
Parameters
$langFile : string
Tags
throws
Exception
Return values
void

loadCurrentLanguage()

Get language content from the XML file

protected loadCurrentLanguage() : void
Return values
void

translate()

Translate and return the string

protected translate(string $str[, string|array<string|int, mixed> $params = null ][, mixed $variation = null ]) : string
Parameters
$str : string
$params : string|array<string|int, mixed> = null
$variation : mixed = null
Return values
string

Search results