language
class language
Wrapper class for loading translations
Constants
FALLBACK_LANGUAGE |
Global fallback language ISO code of the language to fallback to when the specified language entries cannot be found. |
Properties
protected array | $common_language_files | ||
protected bool | $common_language_files_loaded | ||
protected string|null | $default_language | ||
protected string|null | $user_language | ||
protected array | $language_fallback | ||
protected array | $lang | ||
protected array | $loaded_language_sets | ||
protected language_file_loader | $loader |
Methods
Function to set user's language to display.
Function to set the board's default language to display.
Returns language array
Add Language Items
No description
Advanced language substitution
Returns the raw value associated to a language key or the language key no translation is available.
Act like lang() but takes a key and an array of parameters instead of using variadic
Loads common language files
Inject default values based on composer.json
Determine which plural form we should use.
Returns the ISO code of the used language
Returns language fallback data
Load core language file
Load extension language file
Reload language files
Details
at line 79
__construct(language_file_loader $loader, array|null $common_modules = null)
Constructor
at line 115
set_user_language(string $user_lang_iso, bool $reload = false)
Function to set user's language to display.
at line 128
set_default_language(string $default_lang_iso, bool $reload = false)
Function to set the board's default language to display.
at line 143
array
get_lang_array()
Returns language array
Note: This function is needed for the BC purposes, until \phpbb\user::lang[] is not removed.
at line 167
add_lang(string|array $component, string|null $extension_name = null)
Add Language Items
Examples:
$component = array('posting');
$component = array('posting', 'viewtopic')
$component = 'posting'
at line 201
bool
is_set(array|string $key)
No description
at line 240
string
lang()
Advanced language substitution
Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms. Params are the language key and the parameters to be substituted. This function/functionality is inspired by SHS` and Ashe.
Example call: $user->lang('NUM_POSTS_IN_QUEUE', 1);
If the first parameter is an array, the elements are used as keys and subkeys to get the language entry: Example: $user->lang(array('datetime', 'AGO'), 1) uses $user->lang['datetime']['AGO'] as language entry.
at line 256
array|string
lang_raw(string|array $key)
Returns the raw value associated to a language key or the language key no translation is available.
No parameter substitution is performed, can be a string or an array.
at line 295
string
lang_array(string|array $key, array $args = [])
Act like lang() but takes a key and an array of parameters instead of using variadic
at line 378
protected
load_common_language_files()
Loads common language files
at line 398
protected void
inject_default_variables()
Inject default values based on composer.json
at line 422
int
get_plural_form(int|float $number, int|bool $force_rule = false)
Determine which plural form we should use.
For some languages this is not as simple as for English.
at line 590
string
get_used_language()
Returns the ISO code of the used language
at line 600
protected
set_fallback_array(bool $reload = false)
Returns language fallback data
at line 629
protected
load_core_file(string $component)
Load core language file
at line 647
protected
load_extension(string $extension_name, string $component)
Load extension language file
at line 662
protected
reload_language_files()
Reload language files