Nos\I18n¶Provides the translation related functions.
Nos\I18n::setLocale($locale)¶Configure the locale to use for translations.
| Parameters: |
|
|---|
Nos\I18n::load($file)¶Loads a dictionary for the current locale.
| Parameters: |
|
|---|
Nos\I18n::get($message, $default = null)¶Retrieves a translation from the last loaded dictionary.
| Parameters: |
|
|---|---|
| Returns: | The translation or |
Nos\I18n::gget($file, $message, $default = null)¶Retrieves a translation from a specific dictionary.
| Parameters: |
|
|---|---|
| Returns: | The translation or |
Warning
The dictionary must have been loaded manually before.
Nos\I18n::nget($singular, $plural, $n)¶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 |
Nos\I18n::gget($group, $singular, $plural, $n)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.
Nos\I18n::current_dictionary($list)¶Set the current dictionary
| Parameters: |
|
|---|
Nos\I18n::dictionary($files)¶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');