Translations
in package
implements
JsonSerializable
Interfaces, Classes and Traits
- JsonSerializable
Table of Contents
- $textManager : TextManager
- $translations : array<string|int, mixed>
- __construct() : mixed
- Translator constructor.
- add() : void
- Adds a new translation.
- addSection() : void
- Adds a whole translated section.
- isEmpty() : bool
- jsonSerialize() : array<string|int, mixed>
- Returns the translations that will be json serialized.
Properties
$textManager
private
TextManager
$textManager
$translations
private
array<string|int, mixed>
$translations
= []
Methods
__construct()
Translator constructor.
public
__construct(TextManager $textManager) : mixed
Parameters
- $textManager : TextManager
Return values
mixed —add()
Adds a new translation.
public
add(string $key, string $phraseOrSection[, string|null $section = null ]) : void
// providing custom key
$instance->add('save', 'BUTTON_SAVE', 'admin_buttons');
// use phrase as key
$instance->add('BUTTON_SAVE', 'admin_buttons');
Parameters
- $key : string
- $phraseOrSection : string
- $section : string|null = null
Return values
void —addSection()
Adds a whole translated section.
public
addSection(string $section) : void
Parameters
- $section : string
Return values
void —isEmpty()
public
isEmpty() : bool
Return values
bool —jsonSerialize()
Returns the translations that will be json serialized.
public
jsonSerialize() : array<string|int, mixed>