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
- loadText() : mixed
- It ts at the moment supported as an alias for 'get' and will be removed later!
- out() : mixed
- Prints out the translation for $txt_id
- printText() : mixed
- It ts at the moment supported as an alias for 'out' and will be removed later!
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 ][, Settings $cfg = 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
- $cfg : Settings = null
-
The settings from app
__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
Tags
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 name of the translation File (not the Filename!)
Tags
Return values
bool —Returns true if the file was loaded, false otherwise
loadText()
It ts at the moment supported as an alias for 'get' and will be removed later!
public
loadText(mixed $lng, mixed $txt_id) : mixed
Use get() instead
Parameters
- $lng : mixed
- $txt_id : mixed
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()
It ts at the moment supported as an alias for 'out' and will be removed later!
public
printText(mixed $lng, mixed $txt_id) : mixed
Use out() instead
Parameters
- $lng : mixed
- $txt_id : mixed