\Aura\IntlTranslator

Translator to translate the message

Summary

Methods
Properties
Constants
__construct()
translate()
getPackage()
No public properties found
No constants found
getMessage()
$fallback
$formatter
$locale
$package
N/A
No private methods found
No private properties found
N/A

Properties

$locale

$locale : string

The locale being used for translations.

Type

string

$package

$package : \Aura\Intl\Package

The Package containing keys and translations.

Type

\Aura\Intl\Package

Methods

__construct()

__construct(string  $locale, \Aura\Intl\Package  $package, \Aura\Intl\FormatterInterface  $formatter, \Aura\Intl\TranslatorInterface  $fallback = null) 

Constructor

Parameters

string $locale

The locale being used.

\Aura\Intl\Package $package

The Package containing keys and translations.

\Aura\Intl\FormatterInterface $formatter

A message formatter.

\Aura\Intl\TranslatorInterface $fallback

A fallback translator.

translate()

translate(string  $key, array  $tokens_values = array()) : string

Translates the message indicated by they key, replacing token values along the way.

Parameters

string $key

The message key.

array $tokens_values

Token values to interpolate into the message.

Returns

string —

The translated message with tokens replaced.

getPackage()

getPackage() : \Aura\Intl\Package

An object of type Package

Returns

\Aura\Intl\Package

getMessage()

getMessage(string  $key) : mixed

Gets the message translation by its key.

Parameters

string $key

The message key.

Returns

mixed —

The message translation string, or false if not found.