From 15062be77bd6ac0c9d0f48c61b2620b76e37daa3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sun, 6 Aug 2017 11:47:41 +0200 Subject: [PATCH] Fix i18n language items for trophies See #2315 --- .../install/files/lib/acp/form/TrophyAddForm.class.php | 7 +++++-- .../install/files/lib/acp/form/UserTrophyAddForm.class.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php index 8c41182f8c..490b701369 100644 --- a/wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TrophyAddForm.class.php @@ -5,6 +5,7 @@ use wcf\data\object\type\ObjectType; use wcf\data\trophy\category\TrophyCategoryCache; use wcf\data\trophy\Trophy; use wcf\data\trophy\TrophyAction; +use wcf\data\trophy\TrophyEditor; use wcf\system\condition\ConditionHandler; use wcf\system\exception\UserInputException; use wcf\system\language\I18nValue; @@ -139,11 +140,11 @@ class TrophyAddForm extends AbstractAcpForm { parent::readParameters(); $titleI18n = new I18nValue('title'); - $titleI18n->setLanguageItem('wcf.trophy.title', 'wcf.trophy', 'com.woltlab.wcf'); + $titleI18n->setLanguageItem('wcf.user.trophy.title', 'wcf.user.trophy', 'com.woltlab.wcf'); $this->registerI18nValue($titleI18n); $descriptionI18n = new I18nValue('description'); - $descriptionI18n->setLanguageItem('wcf.trophy.description', 'wcf.trophy', 'com.woltlab.wcf'); + $descriptionI18n->setLanguageItem('wcf.user.trophy.description', 'wcf.user.trophy', 'com.woltlab.wcf'); $this->registerI18nValue($descriptionI18n); if (isset($_POST['tmpHash'])) { @@ -283,6 +284,8 @@ class TrophyAddForm extends AbstractAcpForm { ]); $this->objectAction->executeAction(); + $this->saveI18n($this->objectAction->getReturnValues()['returnValues'], TrophyEditor::class); + // transform conditions array into one-dimensional array $conditions = []; foreach ($this->conditions as $groupedObjectTypes) { diff --git a/wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php index 301431e736..0b2b984349 100644 --- a/wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserTrophyAddForm.class.php @@ -3,6 +3,7 @@ namespace wcf\acp\form; use wcf\data\trophy\category\TrophyCategoryCache; use wcf\data\trophy\Trophy; use wcf\data\user\trophy\UserTrophyAction; +use wcf\data\user\trophy\UserTrophyEditor; use wcf\data\user\UserProfile; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; @@ -78,7 +79,7 @@ class UserTrophyAddForm extends AbstractAcpForm { parent::readParameters(); $descriptionI18n = new I18nValue('description'); - $descriptionI18n->setLanguageItem('wcf.user.trophy.description', 'wcf.trophy', 'com.woltlab.wcf'); + $descriptionI18n->setLanguageItem('wcf.user.trophy.userTrophy.description', 'wcf.user.trophy', 'com.woltlab.wcf'); $descriptionI18n->setFlags(I18nValue::ALLOW_EMPTY); $this->registerI18nValue($descriptionI18n); } @@ -160,7 +161,7 @@ class UserTrophyAddForm extends AbstractAcpForm { parent::save(); foreach ($this->userIDs as $user) { - (new UserTrophyAction([], 'create', [ + $databaseObject = (new UserTrophyAction([], 'create', [ 'data' => array_merge($this->additionalFields, [ 'trophyID' => $this->trophy->trophyID, 'userID' => $user, @@ -169,6 +170,8 @@ class UserTrophyAddForm extends AbstractAcpForm { 'useCustomDescription' => $this->useCustomDescription ]) ]))->executeAction(); + + $this->saveI18n($databaseObject, UserTrophyEditor::class); } $this->reset(); -- 2.20.1