From: Joshua Rüsweg Date: Sun, 6 Aug 2017 09:47:41 +0000 (+0200) Subject: Fix i18n language items for trophies X-Git-Tag: 3.1.0_Alpha_1~79 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15062be77bd6ac0c9d0f48c61b2620b76e37daa3;p=GitHub%2FWoltLab%2FWCF.git Fix i18n language items for trophies See #2315 --- 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();