diff --git a/Services/AccessControl/classes/class.ilObjRole.php b/Services/AccessControl/classes/class.ilObjRole.php index 9efe2b11c574..10daeb7d9feb 100755 --- a/Services/AccessControl/classes/class.ilObjRole.php +++ b/Services/AccessControl/classes/class.ilObjRole.php @@ -450,10 +450,16 @@ public static function _getTranslation($a_role_title) global $DIC; $lng = $DIC['lng']; + $objDefinition = $DIC['objDefinition']; $role_title = self::_removeObjectId($a_role_title); - if (preg_match("/^il_./", $role_title)) { + if (preg_match("/^il_([a-z]{1,4})_./", $role_title, $type)) { + //BT ID 0032909: language variables for roles from plugins were not resolved properly + if ($objDefinition->isPlugin($type[1])) { + return ilObjectPlugin::lookupTxtById($type[1], $role_title); + } + return $lng->txt($role_title); } diff --git a/Services/AccessControl/classes/class.ilObjRoleGUI.php b/Services/AccessControl/classes/class.ilObjRoleGUI.php index f34af973ec8b..e8466b0bd8af 100755 --- a/Services/AccessControl/classes/class.ilObjRoleGUI.php +++ b/Services/AccessControl/classes/class.ilObjRoleGUI.php @@ -325,7 +325,7 @@ protected function readRoleProperties(ilObjRole $role) $rbacreview = $DIC['rbacreview']; - $data['title'] = $role->getTitle(); + $data['title'] = ilObjRole::_getTranslation($role->getTitle()); $data['desc'] = $role->getDescription(); $data['ilias_id'] = 'il_' . IL_INST_ID . '_' . ilObject::_lookupType($role->getId()) . '_' . $role->getId(); $data['reg'] = $role->getAllowRegister(); @@ -661,7 +661,7 @@ protected function confirmDeleteRoleObject() $confirm->addItem( 'role', $this->object->getId(), - $this->object->getTitle(), + ilObjRole::_getTranslation($this->object->getTitle()), ilUtil::getImagePath('icon_role.svg') ); @@ -855,7 +855,8 @@ public function adoptPermSaveObject() // send info $obj_data = &$this->ilias->obj_factory->getInstanceByObjId($_POST["adopt"]); - ilUtil::sendSuccess($this->lng->txt("msg_perm_adopted_from1") . " '" . $obj_data->getTitle() . "'.
" . + ilUtil::sendSuccess($this->lng->txt("msg_perm_adopted_from1") . " '" . + ilObjRole::_getTranslation($obj_data->getTitle()) . "'.
" . $this->lng->txt("msg_perm_adopted_from2"), true); } @@ -1190,7 +1191,7 @@ protected function addAdminLocatorItems($a_do_not_add_object = false) if ($_GET["obj_id"] > 0) { $ilLocator->addItem( - $this->object->getTitle(), + ilObjRole::_getTranslation($this->object->getTitle()), $this->ctrl->getLinkTarget($this, 'perm') ); } diff --git a/Services/AccessControl/classes/class.ilObjRoleTemplate.php b/Services/AccessControl/classes/class.ilObjRoleTemplate.php index 301de8f43ab3..917980492476 100755 --- a/Services/AccessControl/classes/class.ilObjRoleTemplate.php +++ b/Services/AccessControl/classes/class.ilObjRoleTemplate.php @@ -46,6 +46,14 @@ public function __construct($a_id = 0, $a_call_by_reference = false) } + /** + * return translated title for autogenerated templates + */ + public function getPresentationTitle() : string + { + return ilObjRole::_getTranslation($this->getTitle()); + } + /** * delete role template and all related data * diff --git a/Services/AccessControl/classes/class.ilObjRoleTemplateGUI.php b/Services/AccessControl/classes/class.ilObjRoleTemplateGUI.php index d7a3dc3f281a..d3284304ff8c 100755 --- a/Services/AccessControl/classes/class.ilObjRoleTemplateGUI.php +++ b/Services/AccessControl/classes/class.ilObjRoleTemplateGUI.php @@ -107,7 +107,7 @@ protected function initFormRoleTemplate($a_mode = self::FORM_MODE_CREATE) if ($this->object->isInternalTemplate()) { $title->setDisabled(true); } - $title->setValue($this->object->getTitle()); + $title->setValue(ilObjRole::_getTranslation($this->object->getTitle())); } $title->setSize(40); $title->setMaxLength(70); diff --git a/Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php b/Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php index a7bf097c9a59..2e41a3096142 100644 --- a/Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php +++ b/Services/AccessControl/classes/class.ilObjectRolePermissionTableGUI.php @@ -316,7 +316,14 @@ public function fillRow($row) $this->getObjType() . "_" . $row['perm']['operation'] )); } elseif (substr($row['perm']['operation'], 0, 6) == 'create') { - $this->tpl->setVariable('PERM_LONG', $this->lng->txt('rbac_' . $row['perm']['operation'])); + if ($objDefinition->isPlugin(substr($row['perm']['operation'], 7))) { + $this->tpl->setVariable('PERM_LONG', ilObjectPlugin::lookupTxtById( + substr($row['perm']['operation'], 7), + $this->getObjType() . "_" . $row['perm']['operation'] + )); + } else { + $this->tpl->setVariable('PERM_LONG', $this->lng->txt('rbac_' . $row['perm']['operation'])); + } } else { $this->tpl->setVariable('PERM_LONG', $this->lng->txt($this->getObjType() . '_' . $row['perm']['operation'])); } diff --git a/Services/AccessControl/classes/class.ilRbacLogTableGUI.php b/Services/AccessControl/classes/class.ilRbacLogTableGUI.php index a8ccca3f2c39..6006bc5374cc 100644 --- a/Services/AccessControl/classes/class.ilRbacLogTableGUI.php +++ b/Services/AccessControl/classes/class.ilRbacLogTableGUI.php @@ -140,7 +140,7 @@ protected function parseChangesFaPa(array $raw) // added only foreach ($raw["ops"] as $role_id => $ops) { foreach ($ops as $op) { - $result[] = array("action" => sprintf($this->lng->txt("rbac_log_operation_add"), ilObject::_lookupTitle($role_id)), + $result[] = array("action" => sprintf($this->lng->txt("rbac_log_operation_add"), ilObjRole::_getTranslation(ilObject::_lookupTitle($role_id))), "operation" => $this->getOPCaption($type, $op)); } } @@ -148,7 +148,7 @@ protected function parseChangesFaPa(array $raw) foreach ($raw["ops"] as $role_id => $actions) { foreach ($actions as $action => $ops) { foreach ((array) $ops as $op) { - $result[] = array("action" => sprintf($this->lng->txt("rbac_log_operation_" . $action), ilObject::_lookupTitle($role_id)), + $result[] = array("action" => sprintf($this->lng->txt("rbac_log_operation_" . $action), ilObjRole::_getTranslation(ilObject::_lookupTitle($role_id))), "operation" => $this->getOPCaption($type, $op)); } } @@ -158,7 +158,7 @@ protected function parseChangesFaPa(array $raw) if (isset($raw["inht"])) { foreach ($raw["inht"] as $action => $role_ids) { foreach ((array) $role_ids as $role_id) { - $result[] = array("action" => sprintf($this->lng->txt("rbac_log_inheritance_" . $action), ilObject::_lookupTitle($role_id))); + $result[] = array("action" => sprintf($this->lng->txt("rbac_log_inheritance_" . $action), ilObjRole::_getTranslation(ilObject::_lookupTitle($role_id)))); } } } diff --git a/Services/Repository/RecommendedContent/classes/class.ilRecommendedContentRoleTableGUI.php b/Services/Repository/RecommendedContent/classes/class.ilRecommendedContentRoleTableGUI.php index ba35f65b2b76..1f53402955f7 100644 --- a/Services/Repository/RecommendedContent/classes/class.ilRecommendedContentRoleTableGUI.php +++ b/Services/Repository/RecommendedContent/classes/class.ilRecommendedContentRoleTableGUI.php @@ -54,7 +54,7 @@ public function __construct( parent::__construct($a_parent_obj, $a_parent_cmd); $this->setTitle($this->lng->txt('rep_recommended_content') . - ', ' . $this->lng->txt("obj_role") . ': ' . ilObject::_lookupTitle($this->role_id)); + ', ' . $this->lng->txt("obj_role") . ': ' . ilObjRole::_getTranslation(ilObject::_lookupTitle($this->role_id))); $this->addColumn('', '', 1); $this->addColumn($this->lng->txt('title'), 'title');