No Description

TranslatorInterface.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. * @api
  17. */
  18. interface TranslatorInterface
  19. {
  20. /**
  21. * Translates the given message.
  22. *
  23. * @param string $id The message id (may also be an object that can be cast to string)
  24. * @param array $parameters An array of parameters for the message
  25. * @param string|null $domain The domain for the message or null to use the default
  26. * @param string|null $locale The locale or null to use the default
  27. *
  28. * @throws \InvalidArgumentException If the locale contains invalid characters
  29. *
  30. * @return string The translated string
  31. *
  32. * @api
  33. */
  34. public function trans($id, array $parameters = array(), $domain = null, $locale = null);
  35. /**
  36. * Translates the given choice message by choosing a translation according to a number.
  37. *
  38. * @param string $id The message id (may also be an object that can be cast to string)
  39. * @param int $number The number to use to find the indice of the message
  40. * @param array $parameters An array of parameters for the message
  41. * @param string|null $domain The domain for the message or null to use the default
  42. * @param string|null $locale The locale or null to use the default
  43. *
  44. * @throws \InvalidArgumentException If the locale contains invalid characters
  45. *
  46. * @return string The translated string
  47. *
  48. * @api
  49. */
  50. public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);
  51. /**
  52. * Sets the current locale.
  53. *
  54. * @param string $locale The locale
  55. *
  56. * @throws \InvalidArgumentException If the locale contains invalid characters
  57. *
  58. * @api
  59. */
  60. public function setLocale($locale);
  61. /**
  62. * Returns the current locale.
  63. *
  64. * @return string The locale
  65. *
  66. * @api
  67. */
  68. public function getLocale();
  69. }