19declare(strict_types=1);
42 public function __construct(?array $a_data,
int $a_id,
bool $a_call_by_reference)
48 $this->
lng->loadLanguageModule(
"lng");
49 $this->
http = $DIC->http();
63 $refresh->setUrl($this->
ctrl->getLinkTarget($this,
"confirmRefresh"));
64 $refresh->setCaption(
"refresh_languages");
65 $this->
toolbar->addButtonInstance($refresh);
69 $check->setUrl($this->
ctrl->getLinkTarget($this,
"checkLanguage"));
70 $check->setCaption(
"check_languages");
74 $ilClientIniFile =
$DIC[
"ilClientIniFile"];
75 if ($ilClientIniFile->variableExists(
"system",
"LANGUAGE_LOG")) {
77 $download->setUrl($this->
ctrl->getLinkTarget($this,
"listDeprecated"));
78 $download->setCaption(
"lng_download_deprecated");
79 $this->
toolbar->addButtonInstance($download);
83 if (!$this->
settings->get(
"lang_detection")) {
85 $toggleButton =
$DIC->ui()->factory()->button()->toggle(
"",
$DIC->ctrl()->getLinkTarget($this,
"enableLanguageDetection"),
$DIC->ctrl()->getLinkTarget($this,
"disableLanguageDetection"),
false)
86 ->withLabel($this->
lng->txt(
"language_detection"))->withAriaLabel($this->
lng->txt(
"lng_enable_language_detection"));
89 $toggleButton =
$DIC->ui()->factory()->button()->toggle(
"",
$DIC->ctrl()->getLinkTarget($this,
"enableLanguageDetection"),
$DIC->ctrl()->getLinkTarget($this,
"disableLanguageDetection"),
true)
90 ->withLabel($this->
lng->txt(
"language_detection"))->withAriaLabel($this->
lng->txt(
"lng_disable_language_detection"));
92 $this->
toolbar->addComponent($toggleButton);
96 $this->tpl->setContent($ltab->getHTML());
105 $this->
lng->loadLanguageModule(
"meta");
109 $key = $langObj->install();
112 $lang_installed[] =
$key;
118 if (isset($lang_installed)) {
119 if (count($lang_installed) === 1) {
120 $this->data = $this->
lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
123 foreach ($lang_installed as $lang_key) {
124 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
126 $this->data = implode(
", ", $langnames) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
129 $this->data = $this->
lng->txt(
"languages_already_installed");
142 $this->
lng->loadLanguageModule(
"meta");
146 $key = $langObj->install();
149 $lang_installed[] =
$key;
155 $key = $langObj->install(
"local");
158 $local_installed[] =
$key;
164 if (isset($lang_installed)) {
165 if (count($lang_installed) === 1) {
166 $this->data = $this->
lng->txt(
"meta_l_" . $lang_installed[0]) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
169 foreach ($lang_installed as $lang_key) {
170 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
172 $this->data = implode(
", ", $langnames) .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
176 if (isset($local_installed)) {
177 if (count($local_installed) === 1) {
178 $this->data .=
" " . $this->
lng->txt(
"meta_l_" . $local_installed[0]) .
" " . $this->
lng->txt(
"local_language_file") .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
181 foreach ($local_installed as $lang_key) {
182 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
184 $this->data .=
" " . implode(
", ", $langnames) .
" " . $this->
lng->txt(
"local_language_files") .
" " . strtolower($this->
lng->txt(
"installed")) .
".";
187 $this->data .=
" " . $this->
lng->txt(
"local_languages_already_installed");
200 $this->
lng->loadLanguageModule(
"meta");
208 if (!($sys_lang = $langObj->isSystemLanguage()) && !($usr_lang = $langObj->isUserLanguage())) {
209 $key = $langObj->uninstall();
211 $lang_uninstalled[] =
$key;
218 if (isset($lang_uninstalled)) {
219 if (count($lang_uninstalled) === 1) {
220 $this->data = $this->
lng->txt(
"meta_l_" . $lang_uninstalled[0]) .
" " . $this->
lng->txt(
"uninstalled");
223 foreach ($lang_uninstalled as $lang_key) {
224 $langnames[] = $this->
lng->txt(
"meta_l_" . $lang_key);
227 $this->data = implode(
", ", $langnames) .
" " . $this->
lng->txt(
"uninstalled");
229 } elseif ($sys_lang) {
230 $this->data = $this->
lng->txt(
"cannot_uninstall_systemlanguage");
231 } elseif ($usr_lang) {
232 $this->data = $this->
lng->txt(
"cannot_uninstall_language_in_use");
234 $this->data = $this->
lng->txt(
"languages_already_uninstalled");
248 $this->data = $this->
lng->txt(
"selected_languages_updated");
249 $this->
lng->loadLanguageModule(
"meta");
255 if ($langObj->isInstalled()) {
256 if ($langObj->check()) {
257 $langObj->flush(
"all");
259 $langObj->setTitle($langObj->getKey());
260 $langObj->setDescription(
"installed");
262 $refreshed[] = $langObj->getKey();
264 $this->data .=
"<br />" . $this->
lng->txt(
"meta_l_" . $langObj->getKey());
281 $this->data = $this->
lng->txt(
"languages_updated");
292 $this->data = $this->
lng->txt(
"selected_languages_updated");
293 $this->
lng->loadLanguageModule(
"meta");
295 $refreshed = array();
298 if ($langObj->refresh()) {
299 $refreshed[] = $langObj->getKey();
300 $this->data .=
"<br />" . $this->
lng->txt(
"meta_l_" . $langObj->getKey());
318 $this->
lng->loadLanguageModule(
"meta");
320 require_once
"./Services/User/classes/class.ilObjUser.php";
324 if (count($post_id) !== 1) {
325 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"choose_only_one_language") .
"<br/>" . $this->lng->txt(
"action_aborted"),
true);
326 $this->
ctrl->redirect($this,
"view");
333 if ($newUserLangObj->isUserLanguage()) {
334 $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);
335 $this->
ctrl->redirect($this,
"view");
338 if (!$newUserLangObj->isInstalled()) {
339 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newUserLangObj->getKey()) .
" " . $this->lng->txt(
"language_not_installed") .
"<br/>" . $this->lng->txt(
"action_aborted"),
true);
340 $this->
ctrl->redirect($this,
"view");
344 $curUser->setLanguage($newUserLangObj->getKey());
347 $this->data = $this->
lng->txt(
"user_language") .
" " . $this->
lng->txt(
"changed_to") .
" " . $this->
lng->txt(
"meta_l_" . $newUserLangObj->getKey()) .
".";
359 $this->
lng->loadLanguageModule(
"meta");
363 if (count($post_id) !== 1) {
364 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"choose_only_one_language") .
"<br/>" . $this->lng->txt(
"action_aborted"),
true);
365 $this->
ctrl->redirect($this,
"view");
372 if ($newSysLangObj->isSystemLanguage()) {
373 $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);
374 $this->
ctrl->redirect($this,
"view");
377 if (!$newSysLangObj->isInstalled()) {
378 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"meta_l_" . $newSysLangObj->getKey()) .
" " . $this->lng->txt(
"language_not_installed") .
"<br/>" . $this->lng->txt(
"action_aborted"),
true);
379 $this->
ctrl->redirect($this,
"view");
382 $this->
ilias->setSetting(
"language", $newSysLangObj->getKey());
385 $this->
ilias->ini->setVariable(
"language",
"default", $newSysLangObj->getKey());
386 $this->
ilias->ini->write();
388 $this->data = $this->
lng->txt(
"system_language") .
" " . $this->
lng->txt(
"changed_to") .
" " . $this->
lng->txt(
"meta_l_" . $newSysLangObj->getKey()) .
".";
399 $this->data = $this->
object->checkAllLanguages();
403 public function out(): void
405 $this->tpl->setOnScreenMessage(
'info', $this->data,
true);
406 $this->
ctrl->redirect($this,
"view");
421 $this->tabs_gui->addTab(
"settings", $this->
lng->txt(
"settings"), $this->ctrl->getLinkTarget($this,
"view"));
425 $this->tabs_gui->addTab(
"perm_settings", $this->
lng->txt(
"perm_settings"), $this->ctrl->getLinkTargetByClass(array(self::class,
"ilpermissiongui"),
"perm"));
434 $next_class = $this->
ctrl->getNextClass($this);
435 $cmd = $this->
ctrl->getCmd();
438 switch ($next_class) {
439 case "ilpermissiongui":
440 include_once
"Services/AccessControl/classes/class.ilPermissionGUI.php";
442 $this->tabs_gui->activateTab(
"perm_settings");
443 $this->
ctrl->forwardCommand($perm_gui);
447 $this->tabs_gui->activateTab(
"settings");
467 foreach ($languages as
$lang) {
469 if ($langObj->isInstalled()) {
470 $ids[] =
$lang[
"obj_id"];
479 $this->
lng->loadLanguageModule(
"meta");
483 if (!empty($a_ids)) {
485 $header = $this->
lng->txt(
"lang_refresh_confirm");
486 } elseif (!empty($post_id = $this->
getPostId())) {
488 $header = $this->
lng->txt(
"lang_refresh_confirm_selected");
490 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
491 $this->
ctrl->redirect($this,
"view");
495 $some_changed =
false;
496 foreach ($ids as
$id) {
498 $lang_title = $this->
lng->txt(
"meta_l_" . $lang_key);
500 if (!empty($last_change)) {
501 $some_changed =
true;
502 $lang_title .=
" (" . $this->
lng->txt(
"last_change") .
" "
505 $conf_screen->addItem(
"id[]", (
string)
$id, $lang_title);
508 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
510 $header .=
"<br />" . $this->
lng->txt(
"lang_refresh_confirm_info");
512 $conf_screen->setHeaderText($header);
513 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
514 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"refreshSelected");
515 $this->tpl->setContent($conf_screen->getHTML());
522 $this->
lng->loadLanguageModule(
"meta");
524 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
525 $conf_screen->setHeaderText($this->
lng->txt(
"lang_uninstall_confirm"));
528 $conf_screen->addItem(
"id[]", (
string)
$id, $this->
lng->txt(
"meta_l_" . $lang_title));
530 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
531 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"uninstall");
532 $this->tpl->setContent($conf_screen->getHTML());
539 $this->
lng->loadLanguageModule(
"meta");
541 $conf_screen->setFormAction($this->
ctrl->getFormAction($this));
542 $conf_screen->setHeaderText($this->
lng->txt(
"lang_uninstall_changes_confirm"));
545 $conf_screen->addItem(
"id[]", (
string)
$id, $this->
lng->txt(
"meta_l_" . $lang_title));
547 $conf_screen->setCancel($this->
lng->txt(
"cancel"),
"view");
548 $conf_screen->setConfirm($this->
lng->txt(
"ok"),
"uninstallChanges");
549 $this->tpl->setContent($conf_screen->getHTML());
560 "install" => array(
"name" =>
"install",
"lng" =>
"install"),
561 "installLocal" => array(
"name" =>
"installLocal",
"lng" =>
"install_local"),
562 "uninstall" => array(
"name" =>
"uninstall",
"lng" =>
"uninstall"),
563 "refresh" => array(
"name" =>
"confirmRefreshSelected",
"lng" =>
"refresh"),
564 "setSystemLanguage" => array(
"name" =>
"setSystemLanguage",
"lng" =>
"setSystemLanguage"),
565 "setUserLanguage" => array(
"name" =>
"setUserLanguage",
"lng" =>
"setUserLanguage")
574 $this->
settings->set(
"lang_detection",
'0');
575 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"));
584 $this->
settings->set(
"lang_detection",
'1');
585 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"));
595 $button->setCaption(
"download");
596 $button->setUrl($this->
ctrl->getLinkTarget($this,
"downloadDeprecated"));
597 $this->
toolbar->addButtonInstance($button);
599 include_once
"./Services/Language/classes/class.ilLangDeprecated.php";
603 foreach (
$d->getDeprecatedLangVars() as
$key => $mod) {
607 $this->tpl->setContent(
"<pre>" .
$res .
"</pre>");
615 include_once
"./Services/Language/classes/class.ilLangDeprecated.php";
618 foreach (
$d->getDeprecatedLangVars() as
$key => $mod) {
631 if ($this->
http->wrapper()->post()->has(
"id")) {
632 $post_field = $this->
http->wrapper()->post()->retrieve(
634 $this->
refinery->kindlyTo()->dictOf(
635 $this->refinery->kindlyTo()->int()
639 if ($post_field ==
null) {
640 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
641 $this->
ctrl->redirect($this,
"view");
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjLanguageFolderGUI.
checkLanguageObject()
check all languages
disableLanguageDetectionObject()
Disable language detection.
confirmUninstallChangesObject()
setSystemLanguageObject()
set the system language
installLocalObject()
Install local language modifications.
__construct(?array $a_data, int $a_id, bool $a_call_by_reference)
Constructor.
installObject()
install languages
enableLanguageDetectionObject()
Enable language detection.
refreshSelectedObject()
update selected languages
uninstallChangesObject()
Uninstall local changes in the database.
viewObject()
show installed languages
setUserLanguageObject()
set user language
refreshObject()
update all installed languages
downloadDeprecatedObject()
Download deprecated lang entries.
listDeprecatedObject()
Download deprecated lang entries.
confirmRefreshSelectedObject(array $a_ids=array())
getAdminTabs()
administration tabs show only permissions and trash folder
uninstallObject()
uninstall language
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"
static refreshAll()
Refresh all installed 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...
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
static _getObjectsByType(string $obj_type="", int $owner=null)
static _lookupTitle(int $obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
header include for all ilias files.