Languages
in package
Languages class that work as connector to Packagist vendor's class.
Tags
Table of Contents
Constants
- DEFAULT_DOMAIN = 'rdbadmin'
- Default domain is set to 'rdbadmin' and will be use when none specify.
Properties
- $currentTextDomain : string
- $domains : array<string|int, mixed>
- $registeredTextDomains : array<string|int, mixed>
- $staticThis : Languages
- $Container : Container
- $currentTextDomain : string
- $domains : array<string|int, mixed>
- $registeredTextDomains : array<string|int, mixed>
Methods
- __construct() : mixed
- Class constructor.
- __get() : mixed
- Magic get.
- bindTextDomain() : bool
- Bind text domain file.
- getHelpers() : $this
- Get helpers functions.
- getTranslator() : Translator
- Get `Translator` object.
- registerTextDomain() : mixed
- Register text domain.
Constants
DEFAULT_DOMAIN
Default domain is set to 'rdbadmin' and will be use when none specify.
public
mixed
DEFAULT_DOMAIN
= 'rdbadmin'
Properties
$currentTextDomain read-only
public
string
$currentTextDomain
Currently loaded text domain.
$domains read-only
public
array<string|int, mixed>
$domains
Loaded domains
$registeredTextDomains read-only
public
array<string|int, mixed>
$registeredTextDomains
The text domains that was registered via registerTextDomain()
method.
$staticThis
public
static Languages
$staticThis
$Container
protected
Container
$Container
$currentTextDomain
protected
string
$currentTextDomain
Currently loaded text domain.
$domains
protected
array<string|int, mixed>
$domains
= []
Loaded domains
$registeredTextDomains
protected
array<string|int, mixed>
$registeredTextDomains
= []
The text domains that was registered via registerTextDomain()
method.
Methods
__construct()
Class constructor.
public
__construct(Container $Container) : mixed
You maybe load this class via framework's Container
object named Languages
. Example: $Languages = $Container->get('Languages');
.
This is depended on if you extended your controller from Rdb\Modules\RdbAdmin\Controllers\BaseController
.
Parameters
- $Container : Container
-
The DI container class.
__get()
Magic get.
public
__get(string $name) : mixed
Parameters
- $name : string
Tags
bindTextDomain()
Bind text domain file.
public
bindTextDomain(string $domain[, string $directory = '' ]) : bool
Load the translation file to get ready to use.
Parameters
- $domain : string
-
The text domain. Example: 'mymdoule'.
- $directory : string = ''
-
The full path to folder that contain translations (mo file). No trailing slash. Example: '/var/www/Modules/MyModule/languages/translations'.
Return values
bool —Return true
on success, false
on failure.
getHelpers()
Get helpers functions.
public
getHelpers() : $this
This method will be called automatically once call to bindTextDomain()
.
Return values
$thisgetTranslator()
Get `Translator` object.
public
getTranslator([string $domain = '' ]) : Translator
Parameters
- $domain : string = ''
Return values
TranslatorregisterTextDomain()
Register text domain.
protected
registerTextDomain(string $domain, string $directory) : mixed
Parameters
- $domain : string
-
The text domain. Example: 'mymodule'.
- $directory : string
-
The full path to folder that contain translations (mo file). No trailing slash or back slash. Example: '/var/www/Modules/MyModule/languages/translations'.