Improved cli entry point so that the language is set to the translator based on the CLI_LANGUAGE env var

This commit is contained in:
Alejandro Celaya 2016-08-01 20:44:45 +02:00
parent 7b98527f2e
commit ce2b28a0b4
2 changed files with 10 additions and 0 deletions

View File

@ -3,7 +3,10 @@ APP_ENV=
SHORTENED_URL_SCHEMA= SHORTENED_URL_SCHEMA=
SHORTENED_URL_HOSTNAME= SHORTENED_URL_HOSTNAME=
SHORTCODE_CHARS= SHORTCODE_CHARS=
# Language
DEFAULT_LOCALE= DEFAULT_LOCALE=
CLI_LOCALE=
# Database # Database
DB_USER= DB_USER=

View File

@ -2,9 +2,16 @@
<?php <?php
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use Symfony\Component\Console\Application as CliApp; use Symfony\Component\Console\Application as CliApp;
use Symfony\Component\Console\Application;
use Zend\I18n\Translator\Translator;
/** @var ContainerInterface $container */ /** @var ContainerInterface $container */
$container = include __DIR__ . '/../config/container.php'; $container = include __DIR__ . '/../config/container.php';
/** @var Translator $translator */
$translator = $container->get('translator');
$translator->setLocale(env('CLI_LOCALE', 'en'));
/** @var Application $app */
$app = $container->get(CliApp::class); $app = $container->get(CliApp::class);
$app->run(); $app->run();