TranslatorInterface.php 759 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\Core\StringTranslation\Translator;
  3. /**
  4. * Interface for objects capable of string translation.
  5. */
  6. interface TranslatorInterface {
  7. /**
  8. * Retrieves English string to given language.
  9. *
  10. * @param string $langcode
  11. * Language code to translate to.
  12. * @param string $string
  13. * The source string.
  14. * @param string $context
  15. * The string context.
  16. *
  17. * @return string|false
  18. * Translated string if there is a translation, FALSE if not.
  19. */
  20. public function getStringTranslation($langcode, $string, $context);
  21. /**
  22. * Resets translation cache.
  23. *
  24. * Since most translation systems implement some form of caching, this
  25. * provides a way to delete that cache.
  26. */
  27. public function reset();
  28. }