Exemplo n.º 1
0
 protected function setUp()
 {
     $this->testDir = realpath(__DIR__ . '/_files');
     $this->expectedDir = $this->testDir . '/expected';
     $this->source = $this->testDir . '/source';
     $this->outputFileName = $this->testDir . '/translate.csv';
     $this->generator = ServiceLocator::getDictionaryGenerator();
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     $this->_testDir = realpath(__DIR__ . '/_files');
     $this->_expectedDir = $this->_testDir . '/expected';
     $this->_dictionaryPath = $this->_testDir . '/source.csv';
     $this->_packPath = $this->_testDir . '/pack';
     $this->_locale = 'de_DE';
     $this->_expectedFiles = ["/app/code/Magento/FirstModule/i18n/{$this->_locale}.csv", "/app/code/Magento/SecondModule/i18n/{$this->_locale}.csv", "/app/design/adminhtml/default/i18n/{$this->_locale}.csv", "/lib/web/i18n/{$this->_locale}.csv"];
     $this->_generator = ServiceLocator::getPackGenerator();
     \Magento\Framework\System\Dirs::rm($this->_packPath);
 }
 /**
  * {@inheritdoc}
  * @throws \InvalidArgumentException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $generator = ServiceLocator::getPackGenerator();
     $mode = $input->getOption(self::INPUT_KEY_MODE);
     if ($mode !== self::MODE_MERGE && $mode !== self::MODE_REPLACE) {
         throw new \InvalidArgumentException("Possible values for 'mode' option are 'replace' and 'merge'");
     }
     $locale = $input->getArgument(self::INPUT_KEY_LOCALE);
     $generator->generate($input->getArgument(self::INPUT_KEY_SOURCE), $input->getArgument(self::INPUT_KEY_PACK), $locale, $input->getOption(self::INPUT_KEY_MODE), $input->getOption(self::INPUT_KEY_ALLOW_DUPLICATES));
     $output->writeln("<info>Successfully saved {$locale} language package.</info>");
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $directory = $input->getArgument(self::INPUT_KEY_DIRECTORY);
     if ($input->getOption(self::INPUT_KEY_MAGENTO)) {
         $directory = BP;
         if ($input->getArgument(self::INPUT_KEY_DIRECTORY)) {
             throw new \InvalidArgumentException('Directory path is not needed when --magento flag is set.');
         }
     } elseif (!$input->getArgument(self::INPUT_KEY_DIRECTORY)) {
         throw new \InvalidArgumentException('Directory path is needed when --magento flag is not set.');
     }
     $generator = ServiceLocator::getDictionaryGenerator();
     $generator->generate($directory, $input->getOption(self::INPUT_KEY_OUTPUT), $input->getOption(self::INPUT_KEY_MAGENTO));
     $output->writeln('<info>Dictionary successfully processed.</info>');
 }
Exemplo n.º 5
0
 protected function setUp()
 {
     $this->_testDir = realpath(__DIR__ . '/_files');
     $this->_expectedDir = $this->_testDir . '/expected';
     $this->_dictionaryPath = $this->_testDir . '/source.csv';
     $this->_packPath = $this->_testDir . '/pack';
     $this->_locale = 'de_DE';
     $this->_expectedFiles = ["/app/code/Magento/FirstModule/i18n/{$this->_locale}.csv", "/app/code/Magento/SecondModule/i18n/{$this->_locale}.csv", "/app/design/adminhtml/default/i18n/{$this->_locale}.csv"];
     $this->_generator = ServiceLocator::getPackGenerator();
     \Magento\Framework\System\Dirs::rm($this->_packPath);
     $reflection = new \ReflectionClass('Magento\\Framework\\Component\\ComponentRegistrar');
     $paths = $reflection->getProperty('paths');
     $paths->setAccessible(true);
     $this->backupRegistrar = $paths->getValue();
     $paths->setAccessible(false);
 }
Exemplo n.º 6
0
 protected function setUp()
 {
     $reflection = new \ReflectionClass('Magento\\Framework\\Component\\ComponentRegistrar');
     $paths = $reflection->getProperty('paths');
     $paths->setAccessible(true);
     $this->backupRegistrar = $paths->getValue();
     $paths->setAccessible(false);
     $this->testDir = realpath(__DIR__ . '/_files');
     $this->expectedDir = $this->testDir . '/expected';
     $this->source = $this->testDir . '/source';
     $this->outputFileName = $this->testDir . '/translate.csv';
     // Register the test modules
     ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_FirstModule', $this->source . '/app/code/Magento/FirstModule');
     ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SecondModule', $this->source . '/app/code/Magento/SecondModule');
     // Register the test theme
     ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/default/backend', $this->source . '/app/design/adminhtml/default/backend');
     $this->generator = ServiceLocator::getDictionaryGenerator();
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $generator = ServiceLocator::getDictionaryGenerator();
     $generator->generate($input->getArgument(self::INPUT_KEY_DIRECTORY), $input->getOption(self::INPUT_KEY_OUTPUT), $input->getOption(self::INPUT_KEY_MAGENTO));
     $output->writeln('<info>Dictionary successfully processed.</info>');
 }