8000 [FrameworkBundle][Translations] Fix debug:translation command · symfony/symfony@435e87d · GitHub
[go: up one dir, main page]

Skip to content

Commit 435e87d

Browse files
[FrameworkBundle][Translations] Fix debug:translation command
Search for translations also in the new translations dir at the project root Search for .yaml file as well as .yml
1 parent 7ac01bc commit 435e87d

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
113113
$kernel = $this->getContainer()->get('kernel');
114114

115115
// Define Root Path to App folder
116-
$transPaths = array($kernel->getRootDir().'/Resources/');
116+
$transPaths = array(
117+
$kernel->getRootDir().'/Resources/',
118+
$kernel->getProjectDir().'/',
119+
);
117120

118121
// Override with provided Bundle info
119122
if (null !== $input->getArgument('bundle')) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</service>
3434

3535
<service id="translation.loader.yml" class="Symfony\Component\Translation\Loader\YamlFileLoader" public="true">
36-
<tag name="translation.loader" alias="yml" />
36+
<tag name="translation.loader" alias="yaml" legacy-alias="yml" />
3737
</service>
3838

3939
<service id="translation.loader.xliff" class="Symfony\Component\Translation\Loader\XliffFileLoader" public="true">

src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public function testDebugDefaultDirectory()
6565

6666
public function testDebugCustomDirectory()
6767
{
68-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
68+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
69+
->disableOriginalConstructor()
70+
->getMock();
71+
6972
$kernel->expects($this->once())
7073
->method('getBundle')
7174
->with($this->equalTo($this->translationDir))
@@ -83,7 +86,10 @@ public function testDebugCustomDirectory()
8386
*/
8487
public function testDebugInvalidDirectory()
8588
{
86-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
89+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
90+
->disableOriginalConstructor()
91+
->getMock();
92+
8793
$kernel->expects($this->once())
8894
->method('getBundle')
8995
->with($this->equalTo('dir'))
@@ -152,7 +158,10 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
152158
);
153159

154160
if (null === $kernel) {
155-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
161+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
162+
->disableOriginalConstructor()
163+
->getMock();
164+
156165
$kernel
157166
->expects($this->any())
158167
->method('getBundle')
@@ -167,6 +176,10 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
167176
->method('getRootDir')
168177
->will($this->returnValue($this->translationDir));
169178

179+
$kernel
180+
->method('getProjectDir')
181+
->will($this->returnValue($this->translationDir));
182+
170183
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
171184
$container
172185
->expects($this->any())

0 commit comments

Comments
 (0)
0