From 8e51b51cae5d3f7dc8e66c1dad2609da4bf83d97 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 21 Jul 2016 15:43:19 +0200 Subject: [PATCH] Added translator and translations to ListShortcodesCommand --- module/CLI/lang/es.mo | Bin 2199 -> 2749 bytes module/CLI/lang/es.po | 43 +++++++++++++++--- .../CLI/src/Command/ListShortcodesCommand.php | 36 ++++++++++----- 3 files changed, 62 insertions(+), 17 deletions(-) diff --git a/module/CLI/lang/es.mo b/module/CLI/lang/es.mo index 2dcd57bcde8e004d9f701961ff46710a00bf1717..002ecddd3c899feefce8fafe3ebbccf18725531c 100644 GIT binary patch delta 1004 zcmX|;O-K}B7{_0Cx75B&%RbEL4Ky_f68t!}nQ-qz0 zAu@;{ymlz|CUsgm*1d}mc?vpojfj5F?C1l}`P{NA8kv0XX$p*z} zk^bWJk{!&gO0q&}Cf0$oMRiOrnEWR(8II+s!?8KKfv7WnGj?{GMF1WtsC4X}pqqFIIJ8+D; zRWbU$81|hx zqdhCDll;t=aw8X$3x#vJk>UDW;d5>{8{Z1a_W4vVHr~oeYRcG^?9`4)mDp~h?k8tj z?+%F;QsTg|BB`IMp+Xp2kwTdcc7(0Aew>_W)E##rNaKMj(<5}NCfx0%tyCTbMWFFa y)%bCM$N-VeafXu7wtFKt8k^(=GS9L|rrA}RTb^zCtCqu-EZx}jVz;_mTm1+4iNRX{ delta 456 zcmX}nJxc>Y5P;#iz1x_?uS5ufSZEW2h)4vr5l@X`5!7HS$RUCJ0I{)16Cv6zVy7sU zX(U*QV55y_;SUf6I}3X&-#LQ|bI;E0-OSEi?lfC}8wgH>l_iFWD`JqC@OZGAsQD2t z;02cO0~axGM3%9J0k*IYuQ9~?PVV_4v*a1$ zh}d|e lUV^e)vY{!?xrWV~>0-NOABshortUrlService = $shortUrlService; + $this->translator = $translator; + parent::__construct(null); } public function configure() { $this->setName('shortcode:list') - ->setDescription('List all short URLs') + ->setDescription($this->translator->translate('List all short URLs')) ->addOption( 'page', 'p', InputOption::VALUE_OPTIONAL, - sprintf('The first page to list (%s items per page)', PaginableRepositoryAdapter::ITEMS_PER_PAGE), + sprintf( + $this->translator->translate('The first page to list (%s items per page)'), + PaginableRepositoryAdapter::ITEMS_PER_PAGE + ), 1 ); } @@ -59,10 +69,10 @@ class ListShortcodesCommand extends Command $page++; $table = new Table($output); $table->setHeaders([ - 'Short code', - 'Original URL', - 'Date created', - 'Visits count', + $this->translator->translate('Short code'), + $this->translator->translate('Original URL'), + $this->translator->translate('Date created'), + $this->translator->translate('Visits count'), ]); foreach ($result as $row) { @@ -72,10 +82,14 @@ class ListShortcodesCommand extends Command if ($this->isLastPage($result)) { $continue = false; - $output->writeln('You have reached last page'); + $output->writeln( + sprintf('%s', $this->translator->translate('You have reached last page')) + ); } else { $continue = $helper->ask($input, $output, new ConfirmationQuestion( - sprintf('Continue with page %s? (y/N) ', $page), + sprintf('' . $this->translator->translate( + 'Continue with page' + ) . ' %s? (y/N) ', $page), false )); }