1717use OCP \AppFramework \Http \Attribute \ApiRoute ;
1818use OCP \AppFramework \Http \DataResponse ;
1919use OCP \AppFramework \OCSController ;
20+ use OCP \IL10N ;
2021use OCP \IRequest ;
2122
2223/**
@@ -26,6 +27,7 @@ class FieldDefinitionApiController extends OCSController {
2627 public function __construct (
2728 IRequest $ request ,
2829 private FieldDefinitionService $ fieldDefinitionService ,
30+ private IL10N $ l10n ,
2931 ) {
3032 parent ::__construct (Application::APP_ID , $ request );
3133 }
@@ -129,7 +131,7 @@ public function update(
129131 ): DataResponse {
130132 $ existing = $ this ->fieldDefinitionService ->findById ($ id );
131133 if ($ existing === null ) {
132- return new DataResponse (['message ' => 'Field definition not found ' ], Http::STATUS_NOT_FOUND );
134+ return new DataResponse (['message ' => $ this -> l10n -> t ( 'Field definition not found ' ) ], Http::STATUS_NOT_FOUND );
133135 }
134136
135137 try {
@@ -167,7 +169,7 @@ public function update(
167169 public function delete (int $ id ): DataResponse {
168170 $ definition = $ this ->fieldDefinitionService ->delete ($ id );
169171 if ($ definition === null ) {
170- return new DataResponse (['message ' => 'Field definition not found ' ], Http::STATUS_NOT_FOUND );
172+ return new DataResponse (['message ' => $ this -> l10n -> t ( 'Field definition not found ' ) ], Http::STATUS_NOT_FOUND );
171173 }
172174
173175 return new DataResponse ($ definition ->jsonSerialize (), Http::STATUS_OK );
0 commit comments