diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 85f22bfc78..8dc7b9db74 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -90,8 +90,12 @@ class Translator implements TranslatorInterface * * @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); if(in_array($locale, $this->fallbackLocales)) { @@ -167,12 +171,16 @@ class Translator implements TranslatorInterface * * @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) { $locale = $this->getLocale(); } + if (null === $domain) { + $domain = 'messages'; + } + if (!isset($this->catalogues[$locale])) { $this->loadCatalogue($locale); } @@ -185,12 +193,16 @@ class Translator implements TranslatorInterface * * @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) { $locale = $this->getLocale(); } + if (null === $domain) { + $domain = 'messages'; + } + if (!isset($this->catalogues[$locale])) { $this->loadCatalogue($locale); }