ITranslationManager.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Translation;
  8. use InvalidArgumentException;
  9. use OCP\PreConditionNotMetException;
  10. /**
  11. * @since 26.0.0
  12. * @deprecated 30.0.0
  13. */
  14. interface ITranslationManager {
  15. /**
  16. * @since 26.0.0
  17. */
  18. public function hasProviders(): bool;
  19. /**
  20. * @return ITranslationProvider[]
  21. * @since 27.1.0
  22. */
  23. public function getProviders(): array;
  24. /**
  25. * @since 26.0.0
  26. */
  27. public function canDetectLanguage(): bool;
  28. /**
  29. * @since 26.0.0
  30. * @return LanguageTuple[]
  31. */
  32. public function getLanguages(): array;
  33. /**
  34. * @since 26.0.0
  35. * @throws PreConditionNotMetException If no provider was registered but this method was still called
  36. * @throws InvalidArgumentException If no matching provider was found that can detect a language
  37. * @throws CouldNotTranslateException If the translation failed for other reasons
  38. */
  39. public function translate(string $text, ?string &$fromLanguage, string $toLanguage): string;
  40. }