66use wcf \data \file \FileEditor ;
77use wcf \data \IToggleAction ;
88use wcf \data \TDatabaseObjectToggle ;
9+ use wcf \data \TI18nDatabaseObjectAction ;
910use wcf \data \user \trophy \UserTrophyAction ;
1011use wcf \data \user \trophy \UserTrophyList ;
1112use wcf \data \user \UserAction ;
2728class TrophyAction extends AbstractDatabaseObjectAction implements IToggleAction
2829{
2930 use TDatabaseObjectToggle;
31+ use TI18nDatabaseObjectAction;
3032
3133 /**
3234 * @inheritDoc
@@ -56,6 +58,8 @@ public function create()
5658
5759 $ trophy = parent ::create ();
5860
61+ $ this ->saveI18nValue ($ trophy );
62+
5963 $ trophyEditor = new TrophyEditor ($ trophy );
6064 $ trophyEditor ->setShowOrder ($ showOrder );
6165
@@ -99,6 +103,8 @@ public function delete()
99103
100104 $ returnValues = parent ::delete ();
101105
106+ $ this ->deleteI18nValues ();
107+
102108 UserStorageHandler::getInstance ()->resetAll ('specialTrophies ' );
103109
104110 return $ returnValues ;
@@ -114,6 +120,10 @@ public function update()
114120 if (\count ($ this ->objects ) == 1 && isset ($ this ->parameters ['data ' ]['showOrder ' ]) && $ this ->parameters ['data ' ]['showOrder ' ] != \reset ($ this ->objects )->showOrder ) {
115121 \reset ($ this ->objects )->setShowOrder ($ this ->parameters ['data ' ]['showOrder ' ]);
116122 }
123+
124+ foreach ($ this ->objects as $ object ) {
125+ $ this ->saveI18nValue ($ object ->getDecoratedObject ());
126+ }
117127 }
118128
119129 /**
@@ -185,4 +195,25 @@ public function toggle()
185195
186196 UserStorageHandler::getInstance ()->resetAll ('specialTrophies ' );
187197 }
198+
199+ #[\Override]
200+ public function getI18nSaveTypes (): array
201+ {
202+ return [
203+ 'title ' => 'wcf.user.trophy.title\d+ ' ,
204+ 'description ' => 'wcf.user.trophy.description\d+ ' ,
205+ ];
206+ }
207+
208+ #[\Override]
209+ public function getLanguageCategory (): string
210+ {
211+ return 'wcf.user.trophy ' ;
212+ }
213+
214+ #[\Override]
215+ public function getPackageID (): int
216+ {
217+ return 1 ;
218+ }
188219}
0 commit comments