merged branch bschussek/fix-translator (PR #7915)
This PR was merged into the master branch.
Discussion
----------
[Translation] Made translation domain defaults in Translator consistent with TranslatorInterface
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
90a20d7
[Translation] Made translation domain defaults in Translator consistent with TranslatorInterface
This commit is contained in:
commit
2d9154f467
@ -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