4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Behat\Translator\Cli;
13 use Behat\Testwork\Cli\Controller;
14 use Symfony\Component\Console\Command\Command as SymfonyCommand;
15 use Symfony\Component\Console\Input\InputInterface;
16 use Symfony\Component\Console\Output\OutputInterface;
17 use Symfony\Component\Translation\Translator;
20 * Configures translator service and loads default translations.
22 * @author Konstantin Kudryashov <ever.zet@gmail.com>
24 final class GherkinTranslationsController implements Controller
32 * Initializes controller.
34 * @param Translator $translator
36 public function __construct(Translator $translator)
38 $this->translator = $translator;
44 public function configure(SymfonyCommand $command)
51 public function execute(InputInterface $input, OutputInterface $output)
53 $i18nPath = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . DIRECTORY_SEPARATOR . 'i18n.php';
55 foreach (require($i18nPath) as $lang => $messages) {
56 $this->translator->addResource('array', $messages, $lang, 'output');