SimpleTranslation
in package
Uses
Log
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructs a new Settings Object
- __get() : mixed
- Not to be confused with the the {@see get()} method.
- get() : string
- Returns the translation for $txt_id
- load() : bool
- Loads a translation File with some logic
- loadLangArray() : mixed
- loadText() : mixed
- loadTranslationFile() : bool
- Loads a translation File
- out() : mixed
- Prints out the translation for $txt_id
- printText() : mixed
Properties
$name
protected
mixed
$name
$parent
protected
mixed
$parent
= null
Methods
__construct()
Constructs a new Settings Object
public
__construct([string $lng = null ][, string $name = null ][, string $parent = null ]) : mixed
Parameters
- $lng : string = null
-
The language to translate to
- $name : string = null
-
The name of the translation File (not the Filename!)
- $parent : string = null
-
The parent SimpleTranslation Object
__get()
Not to be confused with the the {@see get()} method.
public
__get(mixed $name) : mixed
This method is for namespacing and loading different translation files
Parameters
- $name : mixed
get()
Returns the translation for $txt_id
public
get(int $txt_id, mixed ...$params) : string
Parameters
- $txt_id : int
- $params : mixed
-
Passed on to printf for substitution
Return values
string —The translated text
load()
Loads a translation File with some logic
public
load(string $name) : bool
Loads a file called $name_{$this->lng}.xml
Parameters
- $name : string
-
The filename prefix
Tags
Return values
bool —Returns true if the file was loaded, false otherwise
loadLangArray()
public
loadLangArray(mixed $lng) : mixed
Parameters
- $lng : mixed
Tags
loadText()
public
loadText(mixed $lng, mixed $txt_id) : mixed
Parameters
- $lng : mixed
- $txt_id : mixed
Tags
loadTranslationFile()
Loads a translation File
public
loadTranslationFile(string $file) : bool
Parameters
- $file : string
-
The fully quallified filename to load
Tags
Return values
bool —true on succsess dies if not :(
out()
Prints out the translation for $txt_id
public
out(int $txt_id, mixed ...$params) : mixed
Parameters
- $txt_id : int
- $params : mixed
-
Passed on to printf for substitution
printText()
public
printText(mixed $lng, mixed $txt_id) : mixed
Parameters
- $lng : mixed
- $txt_id : mixed