19 declare(strict_types=1);
38 protected \ILIAS\DI\UIServices
$ui;
43 public function __construct(?array $a_data,
int $a_id,
bool $a_call_by_reference)
48 $this->
lng->loadLanguageModule(
"lng");
49 $this->
http = $DIC->http();
51 $this->
ui = $DIC->ui();
63 $refresh = $this->
ui->factory()->button()->standard(
64 $this->
lng->txt(
"refresh_languages"),
65 $this->
ctrl->getLinkTarget($this,
"confirmRefresh")
67 $this->
toolbar->addComponent($refresh);
70 $check = $this->
ui->factory()->button()->standard(
71 $this->
lng->txt(
"check_languages"),
72 $this->
ctrl->getLinkTarget($this,
"checkLanguage")
77 $ilClientIniFile = $DIC[
"ilClientIniFile"];
78 if ($ilClientIniFile->variableExists(
"system",
"LANGUAGE_LOG")) {
79 $download = $this->
ui->factory()->button()->standard(
80 $this->
lng->txt(
"lng_download_deprecated"),
81 $this->
ctrl->getLinkTarget($this,
"listDeprecated")
83 $this->
toolbar->addComponent($download);
87 $modal_on = $this->
ui->factory()->modal()->interruptive(
89 $this->
lng->txt(
"lng_enable_language_detection"),
90 $this->
ctrl->getFormActionByClass(self::class,
"enableLanguageDetection")
92 ->withActionButtonLabel($this->
lng->txt(
'ok'));
93 $modal_off = $this->
ui->factory()->modal()->interruptive(
95 $this->
lng->txt(
"lng_disable_language_detection"),
96 $this->
ctrl->getFormActionByClass(self::class,
"disableLanguageDetection")
98 ->withActionButtonLabel($this->
lng->txt(
'ok'));
99 $toggleButton = $this->
ui->factory()->button()->toggle(
100 $this->
lng->txt(
"language_detection"),
101 $modal_on->getShowSignal(),
102 $modal_off->getShowSignal(),
103 (bool) ($this->
settings->get(
"lang_detection"))
105 ->withAriaLabel($this->
lng->txt(
"lng_switch_language_detection"));
106 $this->
toolbar->addComponent($modal_on);
107 $this->
toolbar->addComponent($modal_off);
108 $this->
toolbar->addComponent($toggleButton);
112 $this->tpl->setContent($ltab->getHTML());
121 $this->
lng->loadLanguageModule(
"meta");
125 $key = $langObj->install();
128 $lang_installed[] =
$key;
134 if (isset($lang_installed)) {
135 if (count($lang_installed) === 1) {
136 $this->data = $this->
lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
139 foreach ($lang_installed as $lang_key) {
140 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
142 $this->data = implode(
", ", $langnames) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
145 $this->data = $this->
lng->txt(
"languages_already_installed");
158 $this->
lng->loadLanguageModule(
"meta");
162 $key = $langObj->install();
165 $lang_installed[] =
$key;
171 $key = $langObj->install(
"local");
174 $local_installed[] =
$key;
180 if (isset($lang_installed)) {
181 if (count($lang_installed) === 1) {
182 $this->data = $this->
lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
185 foreach ($lang_installed as $lang_key) {
186 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
188 $this->data = implode(
", ", $langnames) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
192 if (isset($local_installed)) {
193 if (count($local_installed) === 1) {
194 $this->data .=
" " . $this->
lng->txt(
"meta_l_" . $local_installed[0]) .
" " . $this->
lng->txt(
"local_language_file") .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
197 foreach ($local_installed as $lang_key) {
198 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
200 $this->data .=
" " . implode(
", ", $langnames) .
" " . $this->
lng->txt(
"local_language_files") .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
203 $this->data .=
" " . $this->
lng->txt(
"local_languages_already_installed");
216 $this->
lng->loadLanguageModule(
"meta");
224 if (!($sys_lang = $langObj->isSystemLanguage()) && !($usr_lang = $langObj->isUserLanguage())) {
225 $key = $langObj->uninstall();
227 $lang_uninstalled[] =
$key;
234 if (isset($lang_uninstalled)) {
235 if (count($lang_uninstalled) === 1) {
236 $this->data = $this->
lng->txt(
"meta_l_" . $lang_uninstalled[0]) .
" " . $this->
lng->txt(
"uninstalled");
239 foreach ($lang_uninstalled as $lang_key) {
240 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
243 $this->data = implode(
", ", $langnames) .
" " . $this->
lng->txt(
"uninstalled");
245 } elseif ($sys_lang) {
246 $this->data = $this->
lng->txt(
"cannot_uninstall_systemlanguage");
247 } elseif ($usr_lang) {
248 $this->data = $this->
lng->txt(
"cannot_uninstall_language_in_use");
250 $this->data = $this->
lng->txt(
"languages_already_uninstalled");
264 $this->data = $this->
lng->txt(
"selected_languages_updated");
265 $this->
lng->loadLanguageModule(
"meta");
271 if ($langObj->isInstalled()) {
272 if ($langObj->check()) {
273 $langObj->flush(
"all");
275 $langObj->setTitle($langObj->getKey());
276 $langObj->setDescription(
"installed");
278 $refreshed[] = $langObj->getKey();
280 $this->data .=
"<br />" . $this->
lng->txt(
"meta_l_" . $langObj->getKey());
297 $this->data = $this->
lng->txt(
"languages_updated");
308 $this->data = $this->
lng->txt(
"selected_languages_updated");
309 $this->
lng->loadLanguageModule(
"meta");
311 $refreshed = array();
314 if ($langObj->refresh()) {
315 $refreshed[] = $langObj->getKey();
316 $this->data .=
"<br />" . $this->
lng->txt(
"meta_l_" . $langObj->getKey());
331 $ilUser = $DIC->user();
334 $this->
lng->loadLanguageModule(
"meta");
336 require_once
"./Services/User/classes/class.ilObjUser.php";
340 if (count($post_id) !== 1) {
341 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"choose_only_one_language") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
342 $this->
ctrl->redirect($this,
"view");
349 if ($newUserLangObj->isUserLanguage()) {
350 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newUserLangObj->getKey()) .
" " . $this->
lng->txt(
"is_already_your") .
" " . $this->
lng->txt(
"user_language") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
351 $this->
ctrl->redirect($this,
"view");
354 if (!$newUserLangObj->isInstalled()) {
355 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newUserLangObj->getKey()) .
" " . $this->
lng->txt(
"language_not_installed") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
356 $this->
ctrl->redirect($this,
"view");
359 $curUser =
new ilObjUser($ilUser->getId());
360 $curUser->setLanguage($newUserLangObj->getKey());
363 $this->data = $this->
lng->txt(
"user_language") .
" " . $this->
lng->txt(
"changed_to") .
" " . $this->
lng->txt(
"meta_l_" . $newUserLangObj->getKey()) .
".";
375 $this->
lng->loadLanguageModule(
"meta");
379 if (count($post_id) !== 1) {
380 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"choose_only_one_language") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
381 $this->
ctrl->redirect($this,
"view");
388 if ($newSysLangObj->isSystemLanguage()) {
389 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newSysLangObj->getKey()) .
" " . $this->
lng->txt(
"is_already_your") .
" " . $this->
lng->txt(
"system_language") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
390 $this->
ctrl->redirect($this,
"view");
393 if (!$newSysLangObj->isInstalled()) {
394 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newSysLangObj->getKey()) .
" " . $this->
lng->txt(
"language_not_installed") .
"<br/>" . $this->
lng->txt(
"action_aborted"),
true);
395 $this->
ctrl->redirect($this,
"view");
398 $this->
ilias->setSetting(
"language", $newSysLangObj->getKey());
401 $this->
ilias->ini->setVariable(
"language",
"default", $newSysLangObj->getKey());
402 $this->
ilias->ini->write();
404 $this->data = $this->
lng->txt(
"system_language") .
" " . $this->
lng->txt(
"changed_to") .
" " . $this->
lng->txt(
"meta_l_" . $newSysLangObj->getKey()) .
".";
415 $this->data = $this->
object->checkAllLanguages();
419 public function out(): void
421 $this->tpl->setOnScreenMessage(
'info', $this->data,
true);
422 $this->
ctrl->redirect($this,
"view");
437 $this->tabs_gui->addTab(
"settings", $this->
lng->txt(
"settings"), $this->
ctrl->getLinkTarget($this,
"view"));
441 $this->tabs_gui->addTab(
"perm_settings", $this->
lng->txt(
"perm_settings"), $this->
ctrl->getLinkTargetByClass(array(self::class,
"ilpermissiongui"),
"perm"));
450 $next_class = $this->
ctrl->getNextClass($this);
451 $cmd = $this->
ctrl->getCmd();
454 switch ($next_class) {
455 case "ilpermissiongui":
456 include_once
"Services/AccessControl/classes/class.ilPermissionGUI.php";
458 $this->tabs_gui->activateTab(
"perm_settings");
459 $this->
ctrl->forwardCommand($perm_gui);
463 $this->tabs_gui->activateTab(
"settings");
483 foreach ($languages as
$lang) {
485 if ($langObj->isInstalled()) {
486 $ids[] = $lang[
"obj_id"];
495 $this->
lng->loadLanguageModule(
"meta");
499 if (!empty($a_ids)) {
501 $header = $this->
lng->txt(
"lang_refresh_confirm");
502 } elseif (!empty($post_id = $this->
getPostId())) {
504 $header = $this->
lng->txt(
"lang_refresh_confirm_selected");
506 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
507 $this->
ctrl->redirect($this,
"view");
511 $some_changed =
false;
512 foreach ($ids as
$id) {
514 $lang_title = $this->
lng->txt(
"meta_l_" . $lang_key);
516 if (!empty($last_change)) {
517 $some_changed =
true;
518 $lang_title .=
" (" . $this->
lng->txt(
"last_change") .
" " 521 $conf_screen->addItem(
"id[]", (
string) $id, $lang_title);
524 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
526 $header .=
"<br />" . $this->
lng->txt(
"lang_refresh_confirm_info");
528 $conf_screen->setHeaderText($header);
529 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
530 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"refreshSelected");
531 $this->tpl->setContent($conf_screen->getHTML());
538 $this->
lng->loadLanguageModule(
"meta");
540 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
541 $conf_screen->setHeaderText($this->
lng->txt(
"lang_uninstall_confirm"));
544 $conf_screen->addItem(
"id[]", (
string)
$id, $this->
lng->txt(
"meta_l_" . $lang_title));
546 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
547 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"uninstall");
548 $this->tpl->setContent($conf_screen->getHTML());
555 $this->
lng->loadLanguageModule(
"meta");
557 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
558 $conf_screen->setHeaderText($this->
lng->txt(
"lang_uninstall_changes_confirm"));
561 $conf_screen->addItem(
"id[]", (
string)
$id, $this->
lng->txt(
"meta_l_" . $lang_title));
563 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
564 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"uninstallChanges");
565 $this->tpl->setContent($conf_screen->getHTML());
576 "install" => array(
"name" =>
"install",
"lng" =>
"install"),
577 "installLocal" => array(
"name" =>
"installLocal",
"lng" =>
"install_local"),
578 "uninstall" => array(
"name" =>
"uninstall",
"lng" =>
"uninstall"),
579 "refresh" => array(
"name" =>
"confirmRefreshSelected",
"lng" =>
"refresh"),
580 "setSystemLanguage" => array(
"name" =>
"setSystemLanguage",
"lng" =>
"setSystemLanguage"),
581 "setUserLanguage" => array(
"name" =>
"setUserLanguage",
"lng" =>
"setUserLanguage")
590 $this->
settings->set(
"lang_detection",
'0');
591 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"));
600 $this->
settings->set(
"lang_detection",
'1');
601 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"));
610 $button = $this->
ui->factory()->button()->standard(
611 $this->
lng->txt(
"download"),
612 $this->
ctrl->getLinkTarget($this,
"downloadDeprecated")
614 $this->
toolbar->addComponent($button);
616 include_once
"./Services/Language/classes/class.ilLangDeprecated.php";
620 foreach (
$d->getDeprecatedLangVars() as
$key => $mod) {
621 $res .= $mod .
"," . $key .
"\n";
624 $this->tpl->setContent(
"<pre>" .
$res .
"</pre>");
632 include_once
"./Services/Language/classes/class.ilLangDeprecated.php";
635 foreach (
$d->getDeprecatedLangVars() as
$key => $mod) {
636 $res .= $mod .
"," . $key .
"\n";
648 if ($this->
http->wrapper()->post()->has(
"id")) {
649 $post_field = $this->
http->wrapper()->post()->retrieve(
651 $this->
refinery->kindlyTo()->dictOf(
656 if ($post_field == null) {
657 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
658 $this->
ctrl->redirect($this,
"view");
refreshSelectedObject()
update selected languages
installObject()
install languages
static refreshPlugins(array $a_lang_keys=null)
Refresh languages of activated plugins $a_lang_keys keys of languages to be refreshed (not yet suppor...
prepareOutput(bool $show_sub_objects=true)
refreshObject()
update all installed languages
setSystemLanguageObject()
set the system language
setUserLanguageObject()
set user language
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
listDeprecatedObject()
Download deprecated lang entries.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
static _getObjectsByType(string $obj_type="", int $owner=null)
confirmRefreshSelectedObject(array $a_ids=array())
installLocalObject()
Install local language modifications.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
uninstallChangesObject()
Uninstall local changes in the database.
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
Class ilObjectGUI Basic methods of all Output classes.
header include for all ilias files.
downloadDeprecatedObject()
Download deprecated lang entries.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
enableLanguageDetectionObject()
Enable language detection.
viewObject()
show installed languages
confirmUninstallChangesObject()
uninstallObject()
uninstall language
disableLanguageDetectionObject()
Disable language detection.
static refreshAll()
Refresh all installed languages.
__construct(?array $a_data, int $a_id, bool $a_call_by_reference)
Constructor.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getLastLocalChange(string $a_key)
get the date of the last local change $a_key language key Return change_date "yyyy-mm-dd hh:mm:ss" ...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkLanguageObject()
check all languages
Class ilObjLanguageFolderGUI.