Elgg  Version master
i18n.php
Go to the documentation of this file.
1 <?php
7  '#type' => 'select',
8  'name' => 'language',
9  '#label' => elgg_echo('installation:language'),
10  'value' => elgg_get_config('language'),
11  'options_values' => elgg()->translator->getInstalledTranslations(true),
12 ]);
13 
14 $language_options = elgg()->translator->getInstalledTranslations();
15 
16 // lock site language and English, these can't be disabled
18 if ($config_language !== 'en') {
21  'value' => $config_language,
22  'disabled' => true,
23  ];
24 }
25 
27  'text' => $language_options['en'],
28  'value' => 'en',
29  'disabled' => true,
30 ];
31 
33  '#type' => 'checkboxes',
34  '#label' => elgg_echo('config:i18n:allowed_languages'),
35  '#help' => elgg_echo('config:i18n:allowed_languages:help'),
36  'name' => 'allowed_languages',
37  'value' => elgg()->translator->getAllowedLanguages(),
38  'options_values' => $language_options,
39  'align' => 'horizontal',
40 ]);
41 
43  '#type' => 'select',
44  '#label' => elgg_echo('config:i18n:who_can_change_language'),
45  'name' => 'who_can_change_language',
46  'value' => elgg_get_config('who_can_change_language'),
47  'options_values' => [
48  'everyone' => elgg_echo('config:i18n:who_can_change_language:everyone'),
49  'admin_only' => elgg_echo('config:i18n:who_can_change_language:admin_only'),
50  'nobody' => elgg_echo('config:i18n:who_can_change_language:nobody'),
51  ],
52 ]);
53 
54 echo elgg_view_module('info', elgg_echo('admin:settings:i18n'), $result);
elgg
Definition: install.js:27
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:919
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$config_language
Definition: i18n.php:17
$language_options
Definition: i18n.php:14
$result
Site settings, i18n section.
Definition: i18n.php:6