TranslatorAdapter
class TranslatorAdapter implements TranslatorAdapterInterface (View source)
Translator adapter that wraps the plain translator to provide the translator methods needed in concrete5.
Properties
protected string | $locale |
Methods
The plain translator does not have any translator object attached to it, so null is returned instead.
Get the locale from the translator object.
Sets the locale to the translator object.
Dummy translate method for the plain translator adapter.
Dummy plural translate method for the plain translator.
Dummy translate context method for the plain translator adapter.
Formats the string in the with the PHP sprintf format with the given arguments.
Details
mixed
getTranslator()
The plain translator does not have any translator object attached to it, so null is returned instead.
string
getLocale()
Get the locale from the translator object.
setLocale(string $locale)
Sets the locale to the translator object.
string
translate(string $text)
Dummy translate method for the plain translator adapter.
Returns the same string that is passed to this method formatted with the sprintf format in case multiple arguments are passed.
int
translatePlural(string $singular, string $plural, int $number)
Dummy plural translate method for the plain translator.
Does not do any actual translation but returns the correct format of the two provided strings ($singular and $plural) based on the passed number parameter ($number).
If the $number is equal to 1, the singular format will be returned.
If the $number is not equal to 1, the plural format will be returned.
string
translateContext(string $context, string $text)
Dummy translate context method for the plain translator adapter.
Does exactly the same as the translate()
method, skipping the passed
context string as it is not used.
Calls the translate()
method with other arguments than the context.
protected
formatString(string $string, array $args)
Formats the string in the with the PHP sprintf format with the given arguments.