TranslatorInterface.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 $domain The domain for the message
  26. * @param string $locale The locale
  27. *
  28. * @return string The translated string
  29. *
  30. * @api
  31. */
  32. public function trans($id, array $parameters = array(), $domain = null, $locale = null);
  33. /**
  34. * Translates the given choice message by choosing a translation according to a number.
  35. *
  36. * @param string $id The message id (may also be an object that can be cast to string)
  37. * @param integer $number The number to use to find the indice of the message
  38. * @param array $parameters An array of parameters for the message
  39. * @param string $domain The domain for the message
  40. * @param string $locale The locale
  41. *
  42. * @return string The translated string
  43. *
  44. * @api
  45. */
  46. public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);
  47. /**
  48. * Sets the current locale.
  49. *
  50. * @param string $locale The locale
  51. *
  52. * @api
  53. */
  54. public function setLocale($locale);
  55. /**
  56. * Returns the current locale.
  57. *
  58. * @return string The locale
  59. *
  60. * @api
  61. */
  62. public function getLocale();
  63. }