Nessuna descrizione

TranslatorInterface.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. use Symfony\Component\Translation\Exception\InvalidArgumentException;
  12. use Symfony\Contracts\Translation\LocaleAwareInterface;
  13. /**
  14. * TranslatorInterface.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. *
  18. * @deprecated since Symfony 4.2, use Symfony\Contracts\Translation\TranslatorInterface instead
  19. */
  20. interface TranslatorInterface extends LocaleAwareInterface
  21. {
  22. /**
  23. * Translates the given message.
  24. *
  25. * @param string $id The message id (may also be an object that can be cast to string)
  26. * @param array $parameters An array of parameters for the message
  27. * @param string|null $domain The domain for the message or null to use the default
  28. * @param string|null $locale The locale or null to use the default
  29. *
  30. * @return string The translated string
  31. *
  32. * @throws InvalidArgumentException If the locale contains invalid characters
  33. */
  34. public function trans($id, array $parameters = [], $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 index 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. * @return string The translated string
  45. *
  46. * @throws InvalidArgumentException If the locale contains invalid characters
  47. */
  48. public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null);
  49. /**
  50. * Sets the current locale.
  51. *
  52. * @param string $locale The locale
  53. *
  54. * @throws InvalidArgumentException If the locale contains invalid characters
  55. */
  56. public function setLocale($locale);
  57. /**
  58. * Returns the current locale.
  59. *
  60. * @return string The locale
  61. */
  62. public function getLocale();
  63. }