Skip to content

Commit

Permalink
Merge pull request #36890 from nextcloud/bugfix/noid/translation-api-…
Browse files Browse the repository at this point in the history
…annotation

fix(translation): Allow regular users to use translation api endpoints
  • Loading branch information
juliusknorr authored Mar 1, 2023
2 parents 7145d8a + a0ecc37 commit 416efc1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/Controller/TranslationApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ public function __construct($appName, IRequest $request, ITranslationManager $tr
$this->translationManager = $translationManager;
}

/**
* @NoAdminRequired
*/
public function languages(): DataResponse {
return new DataResponse([
'languages' => $this->translationManager->getLanguages(),
'languageDetection' => $this->translationManager->canDetectLanguage(),
]);
}

/**
* @NoAdminRequired
*/
public function translate(string $text, ?string $fromLanguage, string $toLanguage): DataResponse {
try {
return new DataResponse([
Expand Down

0 comments on commit 416efc1

Please sign in to comment.