4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation;
15 * TranslatorInterface.
17 * @author Fabien Potencier <fabien@symfony.com>
19 interface TranslatorInterface
22 * Translates the given message.
24 * @param string $id The message id (may also be an object that can be cast to string)
25 * @param array $parameters An array of parameters for the message
26 * @param string|null $domain The domain for the message or null to use the default
27 * @param string|null $locale The locale or null to use the default
29 * @return string The translated string
31 * @throws \InvalidArgumentException If the locale contains invalid characters
33 public function trans($id, array $parameters = array(), $domain = null, $locale = null);
36 * Translates the given choice message by choosing a translation according to a number.
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
44 * @return string The translated string
46 * @throws \InvalidArgumentException If the locale contains invalid characters
48 public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);
51 * Sets the current locale.
53 * @param string $locale The locale
55 * @throws \InvalidArgumentException If the locale contains invalid characters
57 public function setLocale($locale);
60 * Returns the current locale.
62 * @return string The locale
64 public function getLocale();