2010-09-27 08:45:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-09-27 08:45:29 +01:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-09-27 08:45:29 +01:00
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-09-27 08:45:29 +01:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Component\Translation;
|
|
|
|
|
2018-10-01 12:27:53 +01:00
|
|
|
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
2018-12-05 07:43:42 +00:00
|
|
|
use Symfony\Contracts\Translation\LocaleAwareInterface;
|
2017-03-03 13:58:29 +00:00
|
|
|
|
2010-09-27 08:45:29 +01:00
|
|
|
/**
|
2018-10-01 12:27:53 +01:00
|
|
|
* TranslatorInterface.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
2018-08-16 14:45:57 +01:00
|
|
|
*
|
2018-10-01 12:27:53 +01:00
|
|
|
* @deprecated since Symfony 4.2, use Symfony\Contracts\Translation\TranslatorInterface instead
|
2010-09-27 08:45:29 +01:00
|
|
|
*/
|
2018-12-05 07:43:42 +00:00
|
|
|
interface TranslatorInterface extends LocaleAwareInterface
|
2010-09-27 08:45:29 +01:00
|
|
|
{
|
2018-09-05 20:29:06 +01:00
|
|
|
/**
|
2018-10-01 12:27:53 +01:00
|
|
|
* Translates the given message.
|
2018-09-05 20:29:06 +01:00
|
|
|
*
|
2018-10-01 12:27:53 +01:00
|
|
|
* @param string $id The message id (may also be an object that can be cast to string)
|
|
|
|
* @param array $parameters An array of parameters for the message
|
|
|
|
* @param string|null $domain The domain for the message or null to use the default
|
|
|
|
* @param string|null $locale The locale or null to use the default
|
2018-09-05 20:29:06 +01:00
|
|
|
*
|
2018-10-01 12:27:53 +01:00
|
|
|
* @return string The translated string
|
2018-09-05 20:29:06 +01:00
|
|
|
*
|
2018-10-01 12:27:53 +01:00
|
|
|
* @throws InvalidArgumentException If the locale contains invalid characters
|
|
|
|
*/
|
2019-01-16 09:39:14 +00:00
|
|
|
public function trans($id, array $parameters = [], $domain = null, $locale = null);
|
2018-10-01 12:27:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translates the given choice message by choosing a translation according to a number.
|
2018-09-05 20:29:06 +01:00
|
|
|
*
|
|
|
|
* @param string $id The message id (may also be an object that can be cast to string)
|
2018-12-28 11:28:01 +00:00
|
|
|
* @param int $number The number to use to find the index of the message
|
2018-09-05 20:29:06 +01:00
|
|
|
* @param array $parameters An array of parameters for the message
|
|
|
|
* @param string|null $domain The domain for the message or null to use the default
|
|
|
|
* @param string|null $locale The locale or null to use the default
|
|
|
|
*
|
|
|
|
* @return string The translated string
|
|
|
|
*
|
2018-10-01 12:27:53 +01:00
|
|
|
* @throws InvalidArgumentException If the locale contains invalid characters
|
2018-09-05 20:29:06 +01:00
|
|
|
*/
|
2019-01-16 09:39:14 +00:00
|
|
|
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null);
|
2018-10-01 12:27:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the current locale.
|
|
|
|
*
|
|
|
|
* @param string $locale The locale
|
|
|
|
*
|
|
|
|
* @throws InvalidArgumentException If the locale contains invalid characters
|
|
|
|
*/
|
|
|
|
public function setLocale($locale);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current locale.
|
|
|
|
*
|
|
|
|
* @return string The locale
|
|
|
|
*/
|
|
|
|
public function getLocale();
|
2010-09-27 08:45:29 +01:00
|
|
|
}
|