[Translation] Made translation domain defaults in Translator consistent with TranslatorInterface
This commit is contained in:
parent
6a4100c615
commit
90a20d7835
@ -90,8 +90,12 @@ class Translator implements TranslatorInterface
|
|||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function addResource($format, $resource, $locale, $domain = 'messages')
|
public function addResource($format, $resource, $locale, $domain = null)
|
||||||
{
|
{
|
||||||
|
if (null === $domain) {
|
||||||
|
$domain = 'messages';
|
||||||
|
}
|
||||||
|
|
||||||
$this->resources[$locale][] = array($format, $resource, $domain);
|
$this->resources[$locale][] = array($format, $resource, $domain);
|
||||||
|
|
||||||
if(in_array($locale, $this->fallbackLocales)) {
|
if(in_array($locale, $this->fallbackLocales)) {
|
||||||
@ -167,12 +171,16 @@ class Translator implements TranslatorInterface
|
|||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null)
|
public function trans($id, array $parameters = array(), $domain = null, $locale = null)
|
||||||
{
|
{
|
||||||
if (null === $locale) {
|
if (null === $locale) {
|
||||||
$locale = $this->getLocale();
|
$locale = $this->getLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $domain) {
|
||||||
|
$domain = 'messages';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($this->catalogues[$locale])) {
|
if (!isset($this->catalogues[$locale])) {
|
||||||
$this->loadCatalogue($locale);
|
$this->loadCatalogue($locale);
|
||||||
}
|
}
|
||||||
@ -185,12 +193,16 @@ class Translator implements TranslatorInterface
|
|||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null)
|
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
|
||||||
{
|
{
|
||||||
if (null === $locale) {
|
if (null === $locale) {
|
||||||
$locale = $this->getLocale();
|
$locale = $this->getLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $domain) {
|
||||||
|
$domain = 'messages';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($this->catalogues[$locale])) {
|
if (!isset($this->catalogues[$locale])) {
|
||||||
$this->loadCatalogue($locale);
|
$this->loadCatalogue($locale);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user