diff --git a/module/CLI/lang/es.mo b/module/CLI/lang/es.mo index 8c24a7b4..5d5830b3 100644 Binary files a/module/CLI/lang/es.mo and b/module/CLI/lang/es.mo differ diff --git a/module/CLI/lang/es.po b/module/CLI/lang/es.po index 2af67aaa..b8fd2f7a 100644 --- a/module/CLI/lang/es.po +++ b/module/CLI/lang/es.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Shlink 1.0\n" -"POT-Creation-Date: 2016-07-21 15:48+0200\n" -"PO-Revision-Date: 2016-07-21 15:49+0200\n" +"POT-Creation-Date: 2016-07-21 15:54+0200\n" +"PO-Revision-Date: 2016-07-21 15:56+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: es_ES\n" @@ -112,3 +112,24 @@ msgstr "Dirección localizada en \"%s\"" msgid "Finished processing all IPs" msgstr "Finalizado el procesado de todas las IPs" + +msgid "Returns the long URL behind a short code" +msgstr "Devuelve la URL larga detrás de un código corto" + +msgid "The short code to parse" +msgstr "El código corto a convertir" + +msgid "A short code was not provided. Which short code do you want to parse?:" +msgstr "" +"No se proporcionó un código corto. ¿Qué código corto quieres convertir?" + +#, php-format +msgid "No URL found for short code \"%s\"" +msgstr "No se ha encontrado ninguna URL para el código corto \"%s\"" + +msgid "Long URL:" +msgstr "URL larga:" + +#, php-format +msgid "Provided short code \"%s\" has an invalid format." +msgstr "El código corto proporcionado \"%s\" tiene un formato inválido." diff --git a/module/CLI/src/Command/ResolveUrlCommand.php b/module/CLI/src/Command/ResolveUrlCommand.php index 01dad903..62d81f41 100644 --- a/module/CLI/src/Command/ResolveUrlCommand.php +++ b/module/CLI/src/Command/ResolveUrlCommand.php @@ -11,6 +11,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; +use Zend\I18n\Translator\TranslatorInterface; class ResolveUrlCommand extends Command { @@ -18,24 +19,34 @@ class ResolveUrlCommand extends Command * @var UrlShortenerInterface */ private $urlShortener; + /** + * @var TranslatorInterface + */ + private $translator; /** * ResolveUrlCommand constructor. * @param UrlShortenerInterface|UrlShortener $urlShortener + * @param TranslatorInterface $translator * - * @Inject({UrlShortener::class}) + * @Inject({UrlShortener::class, "translator"}) */ - public function __construct(UrlShortenerInterface $urlShortener) + public function __construct(UrlShortenerInterface $urlShortener, TranslatorInterface $translator) { - parent::__construct(null); $this->urlShortener = $urlShortener; + $this->translator = $translator; + parent::__construct(null); } public function configure() { $this->setName('shortcode:parse') - ->setDescription('Returns the long URL behind a short code') - ->addArgument('shortCode', InputArgument::REQUIRED, 'The short code to parse'); + ->setDescription($this->translator->translate('Returns the long URL behind a short code')) + ->addArgument( + 'shortCode', + InputArgument::REQUIRED, + $this->translator->translate('The short code to parse') + ); } public function interact(InputInterface $input, OutputInterface $output) @@ -47,9 +58,10 @@ class ResolveUrlCommand extends Command /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); - $question = new Question( - 'A short code was not provided. Which short code do you want to parse?: ' - ); + $question = new Question(sprintf( + '%s ', + $this->translator->translate('A short code was not provided. Which short code do you want to parse?:') + )); $shortCode = $helper->ask($input, $output, $question); if (! empty($shortCode)) { @@ -64,15 +76,18 @@ class ResolveUrlCommand extends Command try { $longUrl = $this->urlShortener->shortCodeToUrl($shortCode); if (! isset($longUrl)) { - $output->writeln(sprintf('No URL found for short code "%s"', $shortCode)); + $output->writeln(sprintf( + '' . $this->translator->translate('No URL found for short code "%s"') . '', + $shortCode + )); return; } - $output->writeln(sprintf('Long URL %s', $longUrl)); + $output->writeln(sprintf('%s %s', $this->translator->translate('Long URL:'), $longUrl)); } catch (InvalidShortCodeException $e) { - $output->writeln( - sprintf('Provided short code "%s" has an invalid format.', $shortCode) - ); + $output->writeln(sprintf('' . $this->translator->translate( + 'Provided short code "%s" has an invalid format.' + ) . '', $shortCode)); } } }