Documentation

I18n
in package

I18n and l10n class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
4.0.0

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
string

getLanguages()

Get languages from the XML files

public static getLanguages(string $dir) : array<string|int, mixed>
Parameters
$dir : string
Tags
throws
Exception
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|Exception

loadCurrentLanguage()

Get language content from the XML file

protected loadCurrentLanguage() : void
Tags
throws
Exception

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
Return values
string

        
On this page

Search results