From 6a05265a4846c14c706488f82cd5aebd8daca1a1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 21 Jul 2016 15:50:27 +0200 Subject: [PATCH] Added translator and translations to ProcessVisitsCommand --- module/CLI/lang/es.mo | Bin 2749 -> 3165 bytes module/CLI/lang/es.po | 20 +++++++++- .../CLI/src/Command/ProcessVisitsCommand.php | 35 +++++++++++++----- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/module/CLI/lang/es.mo b/module/CLI/lang/es.mo index 002ecddd3c899feefce8fafe3ebbccf18725531c..8c24a7b497614ef7e8e972d2c9326a246ca0d746 100644 GIT binary patch delta 1050 zcmYk)Pe>I(9Ki8;K3_iVm1U{V)EtFM!~O_j8T~Od;X%-oqEnac?dDt9cH_-bWQ34` zoq||`qDy(|;LSrBbn;RVbSgVk6hYT6UW$UgzumDmFNYw@?rM-R&DhEn*_;SNs}X%swHDie7#A+k}So<*S0-L^Y7L5Dv=tFjR zR8}}fUv-Te8hx$m)SP4|H}JJ$}pIHA7ogsS{+gHm}ZUw2?a7QTE#`Xb zx+mP4Q>nNsOMbGMJ7d|FcKjsYHw~-(U=grtiyr~^XpNkcbB zbEJ>d&isd-!f&p8*QVy5F~|NRGj4B~vOVAUwu_cEYxV;vYp!t-NczlE@X0)ec1visitService = $visitService; $this->ipLocationResolver = $ipLocationResolver; + $this->translator = $translator; + parent::__construct(null); } public function configure() { $this->setName('visit:process') - ->setDescription('Processes visits where location is not set already'); + ->setDescription( + $this->translator->translate('Processes visits where location is not set yet') + ); } public function execute(InputInterface $input, OutputInterface $output) @@ -51,9 +63,11 @@ class ProcessVisitsCommand extends Command foreach ($visits as $visit) { $ipAddr = $visit->getRemoteAddr(); - $output->write(sprintf('Processing IP %s', $ipAddr)); + $output->write(sprintf('%s %s', $this->translator->translate('Processing IP'), $ipAddr)); if ($ipAddr === self::LOCALHOST) { - $output->writeln(' (Ignored localhost address)'); + $output->writeln( + sprintf(' (%s)', $this->translator->translate('Ignored localhost address')) + ); continue; } @@ -63,12 +77,15 @@ class ProcessVisitsCommand extends Command $location->exchangeArray($result); $visit->setVisitLocation($location); $this->visitService->saveVisit($visit); - $output->writeln(sprintf(' (Address located at "%s")', $location->getCityName())); + $output->writeln(sprintf( + ' (' . $this->translator->translate('Address located at "%s"') . ')', + $location->getCityName() + )); } catch (WrongIpException $e) { continue; } } - $output->writeln('Finished processing all IPs'); + $output->writeln($this->translator->translate('Finished processing all IPs')); } }