Skip to content

Commit 3151fbd

Browse files
Pooja.ManralPooja.Manral
authored andcommitted
AC-9843:: i18n:collect-phrases breaks the translations integrity
1 parent 5d2cf66 commit 3151fbd

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Js.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
class Js extends AbstractAdapter
1616
{
1717
/**
18-
* @var \Magento\Framework\Filesystem\Driver\File
18+
* @var File
1919
*/
20-
protected $_filesystem;
20+
private $filesystem;
2121

2222
/**
2323
* Adapter construct
2424
*
25-
* @param \Magento\Framework\Filesystem\Driver\File $fileSystem
25+
* @param File $filesystem
2626
*/
27-
public function __construct()
27+
public function __construct(File $filesystem)
2828
{
29-
$this->_filesystem = new \Magento\Framework\Filesystem\Driver\File();
29+
$this->filesystem = $filesystem;
3030
}
3131
/**
3232
* Covers
@@ -47,10 +47,11 @@ public function __construct()
4747

4848
/**
4949
* @inheritdoc
50+
* @throws FileSystemException
5051
*/
5152
protected function _parse()
5253
{
53-
$fileHandle = $this->_filesystem->fileOpen($this->_file, 'r');
54+
$fileHandle = $this->filesystem->fileOpen($this->_file, 'r');
5455
$lineNumber = 0;
5556
try {
5657
while (($line = $this->fileReadLine($fileHandle, 0)) !== false) {
@@ -74,12 +75,12 @@ protected function _parse()
7475
}
7576
}
7677
} catch (\Exception $e) {
77-
$this->_filesystem->fileClose($fileHandle);
78+
$this->filesystem->fileClose($fileHandle);
7879
throw new FileSystemException(
7980
new \Magento\Framework\Phrase('Stream get line failed %1', [$e->getMessage()])
8081
);
8182
}
82-
$this->_filesystem->fileClose($fileHandle);
83+
$this->filesystem->fileClose($fileHandle);
8384
}
8485

8586
/**

setup/src/Magento/Setup/Module/I18n/ServiceLocator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Setup\Module\I18n;
77

88
use Magento\Framework\Component\ComponentRegistrar;
9+
use Magento\Framework\Filesystem\Driver\File;
910

1011
/**
1112
* Service Locator (instead DI container)
@@ -52,10 +53,11 @@ public static function getDictionaryGenerator()
5253
$filesCollector = new FilesCollector();
5354

5455
$phraseCollector = new Parser\Adapter\Php\Tokenizer\PhraseCollector(new Parser\Adapter\Php\Tokenizer());
56+
$fileSystem = new File;
5557
$adapters = [
5658
'php' => new Parser\Adapter\Php($phraseCollector),
5759
'html' => new Parser\Adapter\Html(),
58-
'js' => new Parser\Adapter\Js(),
60+
'js' => new Parser\Adapter\Js($fileSystem),
5961
'xml' => new Parser\Adapter\Xml(),
6062
];
6163

0 commit comments

Comments
 (0)