8000 minor #14041 Translator component has default domain for null impleme… · symfony/symfony@8593b90 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8593b90

Browse files
committed
minor #14041 Translator component has default domain for null implemented (Tobion)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #14041). Discussion ---------- Translator component has default domain for null implemented no need to have default translation domain logic in 3 different places | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | hopefully | Fixed tickets | | License | MIT | Doc PR | Commits ------- ccd32d5 Translator component has default domain for null implemented no need to have default translation domain logic in 3 different places
2 parents d5673c2 + ccd32d5 commit 8593b90

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

src/Symfony/Bridge/Twig/Extension/TranslationExtension.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,11 @@ public function getTranslationNodeVisitor()
9090

9191
public function trans($message, array $arguments = array(), $domain = null, $locale = null)
9292
{
93-
if (null === $domain) {
94-
$domain = 'messages';
95-
}
96-
9793
return $this->translator->trans($message, $arguments, $domain, $locale);
9894
}
9995

10096
public function transchoice($message, $count, array $arguments = array(), $domain = null, $locale = null)
10197
{
102-
if (null === $domain) {
103-
$domain = 'messages';
104-
}
105-
10698
return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain, $locale);
10799
}
108100

src/Symfony/Component/Form/Extension/Core/Type/BaseType.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
5656
$uniqueBlockPrefix = '_'.$blockName;
5757
}
5858

59-
if (!$translationDomain) {
59+
if (null === $translationDomain) {
6060
$translationDomain = $view->parent->vars['translation_domain'];
6161
}
6262
} else {
@@ -76,10 +76,6 @@ public function buildView(FormView $view, FormInterface $form, array $options)
7676
}
7777
$blockPrefixes[] = $uniqueBlockPrefix;
7878

79-
if (!$translationDomain) {
80-
$translationDomain = 'messages';
81-
}
82-
8379
$view->vars = array_replace($view->vars, array(
8480
'form' => $view,
8581
'id' => $id,

src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php

73B2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testDefaultTranslationDomain()
112112
->getForm()
113113
->createView();
114114

115-
$this->assertEquals('messages', $view['child']->vars['translation_domain']);
115+
$this->assertNull($view['child']->vars['translation_domain']);
116116
}
117117

118118
public function testPassLabelToView()

0 commit comments

Comments
 (0)
0