Brak opisu

TranslatorInterface.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Translation;
  11. /**
  12. * TranslatorInterface.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface TranslatorInterface
  17. {
  18. /**
  19. * Translates the given message.
  20. *
  21. * @param string $id The message id (may also be an object that can be cast to string)
  22. * @param array $parameters An array of parameters for the message
  23. * @param string|null $domain The domain for the message or null to use the default
  24. * @param string|null $locale The locale or null to use the default
  25. *
  26. * @return string The translated string
  27. *
  28. * @throws InvalidArgumentException If the locale contains invalid characters
  29. */
  30. public function trans($id, array $parameters = array(), $domain = null, $locale = null);
  31. /**
  32. * Translates the given choice message by choosing a translation according to a number.
  33. *
  34. * @param string $id The message id (may also be an object that can be cast to string)
  35. * @param int $number The number to use to find the indice of the message
  36. * @param array $parameters An array of parameters for the message
  37. * @param string|null $domain The domain for the message or null to use the default
  38. * @param string|null $locale The locale or null to use the default
  39. *
  40. * @return string The translated string
  41. *
  42. * @throws InvalidArgumentException If the locale contains invalid characters
  43. */
  44. public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);
  45. /**
  46. * Sets the current locale.
  47. *
  48. * @param string $locale The locale
  49. *
  50. * @throws InvalidArgumentException If the locale contains invalid characters
  51. */
  52. public function setLocale($locale);
  53. /**
  54. * Returns the current locale.
  55. *
  56. * @return string The locale
  57. */
  58. public function getLocale();
  59. }