FakeTranslationProvider.php 684 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Testing\Provider;
  7. use OCP\Translation\ITranslationProvider;
  8. use OCP\Translation\LanguageTuple;
  9. class FakeTranslationProvider implements ITranslationProvider {
  10. public function getName(): string {
  11. return 'Fake translation';
  12. }
  13. public function getAvailableLanguages(): array {
  14. return [
  15. new LanguageTuple('de', 'German', 'en', 'English'),
  16. new LanguageTuple('en', 'English', 'de', 'German'),
  17. ];
  18. }
  19. public function translate(?string $fromLanguage, string $toLanguage, string $text): string {
  20. return strrev($text);
  21. }
  22. }