Usage:
Message::translate('Mind the gap.');
Message::translate('house', array('count' => 23));
String::insert()-style placeholders may be used within the message
and replacements provided directly within the options argument.
Example:
Message::translate('I can see {:count} bike.');
Message::translate('This painting is {:color}.', array(
'color' => Message::translate('silver'),
));
public static translate ( string $id, array $options = [] ) : string | ||
$id | string | The id to use when looking up the translation. |
$options | array | Valid options are: - `'count'`: Used to determine the correct plural form. You can either pass a signed or unsigned integer, the behavior when passing other types is yet undefined. The count is made absolute before being passed to the pluralization function. This has the effect that that with i.e. an English pluralization function passing `-1` results in a singular translation. - `'locale'`: The target locale, defaults to current locale. - `'scope'`: The scope of the message. - `'context'`: The disambiguating context (optional). - `'default'`: Is used as a fall back if `_translated()` returns without a result. - `'noop'`: If `true` no whatsoever lookup takes place. |
return | string | The translation or the value of the `'default'` option if none could be found. |