Provides the translation related functions.
Configure the locale to use for translations.
Parameters: |
|
---|
Loads a dictionary for the current locale.
Parameters: |
|
---|
Retrieves a translation from the last loaded dictionary.
Parameters: |
|
---|---|
Returns: | The translation or null if not founded |
Retrieves a translation from a specific dictionary.
Parameters: |
|
---|---|
Returns: | The translation or null if not founded |
Warning
The dictionary must have been loaded manually before.
The plural version of I18n::get. Some languages have more than one form for plural messages dependent on the count.
Parameters: |
|
---|---|
Returns: | The translation or, if not founded, $singular is returned if n == 1, otherwise $plural |
Retrieves a plural translation from a specific dictionary.
Parameters: |
|
---|---|
Returns: | The translation or, if not founded, $singular is returned if n == 1, otherwise $plural |
Warning
The dictionary must have been loaded manually before.
Set the current dictionary
Parameters: |
|
---|
Returns a closure that translate messages from a specific dictionary.
Parameters: |
|
---|---|
Returns: | A callable to translate a message |
<?php
// Retrieves an anonymous function
$dictionary = Nos\I18n::dictionary('mon_appli::common');
echo $dictionary('Translate this');