From c5015f582899f2d983cd46b4b5781c37ff048f81 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 18 Nov 2018 16:02:52 +0100 Subject: [PATCH] Removed translations from CLI module --- config/autoload/local.php.dist | 5 +- config/autoload/zend-expressive.global.php | 4 +- module/CLI/config/cli.config.php | 3 - module/CLI/config/dependencies.config.php | 53 +-- module/CLI/config/translator.config.php | 16 - module/CLI/lang/es.mo | Bin 10803 -> 0 bytes module/CLI/lang/es.po | 403 ------------------ .../CLI/src/Command/Api/DisableKeyCommand.php | 18 +- .../src/Command/Api/GenerateKeyCommand.php | 29 +- .../CLI/src/Command/Api/ListKeysCommand.php | 33 +- .../Command/Config/GenerateCharsetCommand.php | 28 +- .../Command/Config/GenerateSecretCommand.php | 23 +- .../ShortUrl/DeleteShortUrlCommand.php | 47 +- .../ShortUrl/GeneratePreviewCommand.php | 27 +- .../ShortUrl/GenerateShortUrlCommand.php | 75 ++-- .../src/Command/ShortUrl/GetVisitsCommand.php | 33 +- .../Command/ShortUrl/ListShortUrlsCommand.php | 56 +-- .../Command/ShortUrl/ResolveUrlCommand.php | 34 +- .../CLI/src/Command/Tag/CreateTagCommand.php | 18 +- .../CLI/src/Command/Tag/DeleteTagsCommand.php | 18 +- .../CLI/src/Command/Tag/ListTagsCommand.php | 16 +- .../CLI/src/Command/Tag/RenameTagCommand.php | 20 +- .../Command/Visit/ProcessVisitsCommand.php | 46 +- .../CLI/src/Command/Visit/UpdateDbCommand.php | 22 +- module/CLI/src/Factory/ApplicationFactory.php | 3 - .../Command/Api/DisableKeyCommandTest.php | 3 +- .../Command/Api/GenerateKeyCommandTest.php | 3 +- .../test/Command/Api/ListKeysCommandTest.php | 3 +- .../Config/GenerateCharsetCommandTest.php | 3 +- .../ShortUrl/DeleteShortCodeCommandTest.php | 3 +- .../ShortUrl/GeneratePreviewCommandTest.php | 7 +- .../ShortUrl/GenerateShortUrlCommandTest.php | 3 +- .../Command/ShortUrl/GetVisitsCommandTest.php | 3 +- .../ShortUrl/ListShortUrlsCommandTest.php | 3 +- .../ShortUrl/ResolveUrlCommandTest.php | 3 +- .../test/Command/Tag/CreateTagCommandTest.php | 3 +- .../Command/Tag/DeleteTagsCommandTest.php | 3 +- .../test/Command/Tag/ListTagsCommandTest.php | 3 +- .../test/Command/Tag/RenameTagCommandTest.php | 3 +- .../Visit/ProcessVisitsCommandTest.php | 4 +- .../Command/Visit/UpdateDbCommandTest.php | 3 +- module/CLI/test/ConfigProviderTest.php | 3 +- .../test/Factory/ApplicationFactoryTest.php | 2 - 43 files changed, 213 insertions(+), 875 deletions(-) delete mode 100644 module/CLI/config/translator.config.php delete mode 100644 module/CLI/lang/es.mo delete mode 100644 module/CLI/lang/es.po diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index cd1996b9..2b149bb5 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -1,8 +1,11 @@ true, - 'config_cache_enabled' => false, + ConfigAggregator::ENABLE_CACHE => false, ]; diff --git a/config/autoload/zend-expressive.global.php b/config/autoload/zend-expressive.global.php index 9a6e582e..89102d12 100644 --- a/config/autoload/zend-expressive.global.php +++ b/config/autoload/zend-expressive.global.php @@ -1,9 +1,11 @@ false, - 'config_cache_enabled' => true, + ConfigAggregator::ENABLE_CACHE => true, ]; diff --git a/module/CLI/config/cli.config.php b/module/CLI/config/cli.config.php index 42b8ab4c..84969d1a 100644 --- a/module/CLI/config/cli.config.php +++ b/module/CLI/config/cli.config.php @@ -3,12 +3,9 @@ declare(strict_types=1); namespace Shlinkio\Shlink\CLI; -use function Shlinkio\Shlink\Common\env; - return [ 'cli' => [ - 'locale' => env('CLI_LOCALE', 'en'), 'commands' => [ Command\ShortUrl\GenerateShortUrlCommand::NAME => Command\ShortUrl\GenerateShortUrlCommand::class, Command\ShortUrl\ResolveUrlCommand::NAME => Command\ShortUrl\ResolveUrlCommand::class, diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index 2781e115..7c34f580 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -10,8 +10,8 @@ use Shlinkio\Shlink\Core\Service; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console\Application; use Symfony\Component\Lock; -use Zend\I18n\Translator\Translator; use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory; +use Zend\ServiceManager\Factory\InvokableFactory; return [ @@ -29,8 +29,8 @@ return [ Command\Visit\ProcessVisitsCommand::class => ConfigAbstractFactory::class, Command\Visit\UpdateDbCommand::class => ConfigAbstractFactory::class, - Command\Config\GenerateCharsetCommand::class => ConfigAbstractFactory::class, - Command\Config\GenerateSecretCommand::class => ConfigAbstractFactory::class, + Command\Config\GenerateCharsetCommand::class => InvokableFactory::class, + Command\Config\GenerateSecretCommand::class => InvokableFactory::class, Command\Api\GenerateKeyCommand::class => ConfigAbstractFactory::class, Command\Api\DisableKeyCommand::class => ConfigAbstractFactory::class, @@ -44,47 +44,28 @@ return [ ], ConfigAbstractFactory::class => [ - Command\ShortUrl\GenerateShortUrlCommand::class => [ - Service\UrlShortener::class, - 'translator', - 'config.url_shortener.domain', - ], - Command\ShortUrl\ResolveUrlCommand::class => [Service\UrlShortener::class, 'translator'], - Command\ShortUrl\ListShortUrlsCommand::class => [ - Service\ShortUrlService::class, - 'translator', - 'config.url_shortener.domain', - ], - Command\ShortUrl\GetVisitsCommand::class => [Service\VisitsTracker::class, 'translator'], - Command\ShortUrl\GeneratePreviewCommand::class => [ - Service\ShortUrlService::class, - PreviewGenerator::class, - 'translator', - ], - Command\ShortUrl\DeleteShortUrlCommand::class => [ - Service\ShortUrl\DeleteShortUrlService::class, - 'translator', - ], + Command\ShortUrl\GenerateShortUrlCommand::class => [Service\UrlShortener::class, 'config.url_shortener.domain'], + Command\ShortUrl\ResolveUrlCommand::class => [Service\UrlShortener::class], + Command\ShortUrl\ListShortUrlsCommand::class => [Service\ShortUrlService::class, 'config.url_shortener.domain'], + Command\ShortUrl\GetVisitsCommand::class => [Service\VisitsTracker::class], + Command\ShortUrl\GeneratePreviewCommand::class => [Service\ShortUrlService::class, PreviewGenerator::class], + Command\ShortUrl\DeleteShortUrlCommand::class => [Service\ShortUrl\DeleteShortUrlService::class], Command\Visit\ProcessVisitsCommand::class => [ Service\VisitService::class, IpLocationResolverInterface::class, Lock\Factory::class, - 'translator', ], - Command\Visit\UpdateDbCommand::class => [DbUpdater::class, 'translator'], + Command\Visit\UpdateDbCommand::class => [DbUpdater::class], - Command\Config\GenerateCharsetCommand::class => ['translator'], - Command\Config\GenerateSecretCommand::class => ['translator'], + Command\Api\GenerateKeyCommand::class => [ApiKeyService::class], + Command\Api\DisableKeyCommand::class => [ApiKeyService::class], + Command\Api\ListKeysCommand::class => [ApiKeyService::class], - Command\Api\GenerateKeyCommand::class => [ApiKeyService::class, 'translator'], - Command\Api\DisableKeyCommand::class => [ApiKeyService::class, 'translator'], - Command\Api\ListKeysCommand::class => [ApiKeyService::class, 'translator'], - - Command\Tag\ListTagsCommand::class => [Service\Tag\TagService::class, Translator::class], - Command\Tag\CreateTagCommand::class => [Service\Tag\TagService::class, Translator::class], - Command\Tag\RenameTagCommand::class => [Service\Tag\TagService::class, Translator::class], - Command\Tag\DeleteTagsCommand::class => [Service\Tag\TagService::class, Translator::class], + Command\Tag\ListTagsCommand::class => [Service\Tag\TagService::class], + Command\Tag\CreateTagCommand::class => [Service\Tag\TagService::class], + Command\Tag\RenameTagCommand::class => [Service\Tag\TagService::class], + Command\Tag\DeleteTagsCommand::class => [Service\Tag\TagService::class], ], ]; diff --git a/module/CLI/config/translator.config.php b/module/CLI/config/translator.config.php deleted file mode 100644 index 659d4cae..00000000 --- a/module/CLI/config/translator.config.php +++ /dev/null @@ -1,16 +0,0 @@ - [ - 'translation_file_patterns' => [ - [ - 'type' => 'gettext', - 'base_dir' => __DIR__ . '/../lang', - 'pattern' => '%s.mo', - ], - ], - ], - -]; diff --git a/module/CLI/lang/es.mo b/module/CLI/lang/es.mo deleted file mode 100644 index 9be4edfd8c95d20ee11d7d590c11f76e0d7b1977..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10803 zcmbuEU5q5xRmZQfV>@dToP^KBgzGgnUNY0(U7M^k>#ytyB49p3ceqd{+|XP0e8R!@Lk^>*LfN|$?pu*yf1+s{A;iT zUk6dyCGT>s2WB89c3%di@85&Bfd2++-WyO3Q#ub~B6kSX{kuR^bEiPPw+1HQ0PKK& z2{M)YFHqyJyUDp@;LYG1xCY({{vvo5{3B3yb?=UPUk^UO&x7C{;5x_<_eoHC{4V%D z@DISd!9Qz$e-qUD-i@=q54;(aUye4vk2UxhsJQ5YN5NkK6<2=(Zh?Q(;3*a-dwv1b z{p(oFIq(<29|yk#YM%cF<(HfIA-ofm9nOOCG7waP;;HSX5 zz%PN1f>$$%^gRd4P6KcR{yL~Q`XBJ8z#DzkV*oO>%R%|+lORLfAA^dwe*op5uYwx) z4G`D4>k*FY-3P!7ybF}wUjP;VUvHlOC-@-058zbcqu>MJr@*JczXGoXZ@)F>>pb`o zexC)8fG>cu!{36^=W8IZxc>kj0^j?i@%Q7P=G|_7KL=|3XF;v!<>vn1fgj}ew?Msr z>uoV^`{3{J`pzQVA zpvJ%4;5Wbz^ZVeTDF34%sq0<=6%StonacemsP$ikQ?3Gkf=hnJ&6Zz)eRynoH9w70 zNEQ1iPW6#IagXf!Fqb~75gc^qFoo%$TZ{VBeB`J5xwH<{vG@XZeUx+3^ZMqlVo#qt zBiLH?Rkp}2Yk#AfmGoR!=Uk!?~UMhM4@geI;tldHz?(J2xBbk|-tMS#fYD(>$#P7?ChgHp(VRmSM!|iqFul zau0_*#B6L-XiPP|AG3wQ3zNZGVRzQPzDkB8oOf|dMk_G~<9!{xU^6LG#r7^m2v8nm zX>V%8R(a`JLITB*8E{hVtGbL@kqph;Mla%zN1j+C!7rg$$h+nCNY>po)5H=+H!ZUn z+ZgAGZek8qtc_Rq#H5@PbJXINxIW#V5ab-DN-JMwV^IRG!z`v+npbs5dLqh==qz*Y z3`M!q8#(a`p^`fpSxdCU+@CzL6mO`eAS(6@fDQ0dmGncs?IRs<2lg0{ytq1aFU=`G zVa9GT=GHK|#CTDwR$fKPLt=FDcA*6%-7e&x*MuU(WUU2HfyHP>Z;#+ZS z6ZNK3J4c)%PHEI_Y`Gq~306`l4X8LVZN*i$RgESc_h{I5XH;sG5L2D)9udM#O_XdV zX(p}OFseGu2xD7|8tN1`DK1*{SXj(FVw^hj%~6=J&@EAGs`dLFZ!R^be(-)t%_N5JejfupNfgwhJ@)0OUPl3r0FG0W!W~QQy9$oN~$r` zI#;|iofcX%QY*)l3wtGsc_Q?36J+zMHv4`_{fXomDZX_g$r5?K$sejgRSbgyjxr@G zz(m$ui{I7*@x&A9Be}2v>?sMm(?{#Id5QdX)~R8d6$JGUq2n)*8phgIKvzz!OtNYs zhW;qcCX$$Z;-v3P|D-R5dQ0kCr#@@9Ep_U#|1L^(lk3|Zzmm}0F0L-AUpui3PInf{ z_UJToLv)S$J(<+D9e3QO8Xbm2C*t(zkPV&WBLl6~x4V1D-8>UR{EClbtlQ&gFe_T3 z1O@xlhRj10Pcmcj%!cn$Vn$5#YeP9R#@V3O;5fnrKeY^Klu75UQqlCUMv`q%6DQ%B z&>dU9v!?K}sLIkI0VZYh@o*g@@oqC?T*YiCble5C;)+>b*q?4}?V5ImC2fQv?n!1E zkx)5evGh11uifLeBT=uxk0%BJq1erGdX$l*nxq!BU{0dnJ;erXkZhWJ8^-l?cv(ou zY|AHzOHNd=xEQ+i{OR8O@+!pjEx(k8}? zi&Mq#yRde0{+{VLsYflFU(N|83i*P+XFaVCJUQR=$I^SH2tC|gA<^ z-CMUVCdU)6UZydF^#+O6rK0TO>x51II8RiFZ*dp+B95Soq4L)$?Nm+Y5!t23w-Hf? z4-vo?(@rhQgf=as7U|>yVI~7z>?i$4(tCr!etleZcP_I{$r36Z{TT&^{S?q1WN1g# z9AmhszN&E4edi@q_uZYBdg(@iUS(Z${Hve;$av>7yYF(Gl0prtW;qqBPRj@0hOl1X z^o1f?C5Vy9T1!bhNjY4Hg^XwNLdLFAY|O@rATBY7I|D&yN?DAos@)E?R*RN#Y2QO; z93<;$mSSPCyE&GeCM($Yy8fa!zNkoS zjz*GfvKlE3U3R?f^%P=Pc!4vIv8~_U&{2pi3^x-_d}*oKJzS1Q+G!DL@th=(+-9w% zcuInuz0GEwGBZP}VCTn&Xr=9|)1OXDf=;nON>bBQroD49UbzeJ^Q` zSLFVU{mvnQbi`ue?uX$SWGZ6OH4YXjanK^Jvl%)bLyaH-_-Y(jg{mtx-cm!EDCe{X zDq1CZ#5qgh_Z+~uSS-xcmI}L8<2QFMbM%sQW`}hX_WZ`4)7YXL;ef5+{KhhAMx`k^ zcGJGH)6QTj9mmWHof^zo7v*&)OUjMiM4tF{XM&WlE12&lrwxKzYST6`4}8;yIB!I~08If6tuM1mz1#nXcry{722FgwE*Vx zHpLp<$c!pJoJl{+Bcm}@3^sV9BG;Kwb5ujwW-%?{@J+|$Di1uL1k3ar=QdD#(bg)| z+eKH#BUZcE6t-Q!^z8{nkhm+6Er`4r2BrrKRoh@kIYRXcWQN7<92tDEu%k(NiJf#0 z>!PY{ItXYcR9`}|){zda0DGsD?cd~7C$6;P8u&#p4NsH1xjVC|U@a1ez2Qn)v(iGOW zR*VJ}O~g@?9-(+^0%C-bckD_ycqt~T#rG{|zst{)flQ&_E{OjyGx+S$!bQx26&)*)ksb}UMmz)Wgy$onEQg~6n~ zEoJd5wr+@;Rx8oRs7!}Qe~kaFK^O=$n&Iq{x{#CV$0kpd&O9s9>x#fkga{SP@$+iSCR zVvbl-t~PY*o^r@WderAo73si-p2i_9Sqm@41-92sbv zg_g<@y)OscV%ucur9S^oYhJo?uFsUE=GaUPJX8`pMQahL--{F@8dU5zuEzYAv~Xwl vsnoQ!#9>JIPZ|FTMUKqT)-3`H$HH#wWcy6XBtbJ$KPNt@EmPOG@45d6rQX00 diff --git a/module/CLI/lang/es.po b/module/CLI/lang/es.po deleted file mode 100644 index 4698d723..00000000 --- a/module/CLI/lang/es.po +++ /dev/null @@ -1,403 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Shlink 1.0\n" -"POT-Creation-Date: 2018-11-17 14:29+0100\n" -"PO-Revision-Date: 2018-11-17 14:29+0100\n" -"Last-Translator: Alejandro Celaya \n" -"Language-Team: \n" -"Language: es_ES\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.6\n" -"X-Poedit-Basepath: ..\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: translate;translatePlural\n" -"X-Poedit-SearchPath-0: src\n" -"X-Poedit-SearchPath-1: config\n" - -msgid "Disables an API key." -msgstr "Desahbilita una clave de API." - -msgid "The API key to disable" -msgstr "La clave de API a deshabilitar" - -#, php-format -msgid "API key \"%s\" properly disabled" -msgstr "Clave de API \"%s\" deshabilitada correctamente" - -#, php-format -msgid "API key \"%s\" does not exist." -msgstr "La clave de API \"%s\" no existe." - -msgid "Generates a new valid API key." -msgstr "Genera una nueva clave de API válida." - -msgid "The date in which the API key should expire. Use any valid PHP format." -msgstr "" -"La fecha en la que la clave de API debe expirar. Utiliza cualquier valor " -"válido en PHP." - -#, php-format -msgid "Generated API key: \"%s\"" -msgstr "Generada clave de API. \"%s\"" - -msgid "Lists all the available API keys." -msgstr "Lista todas las claves de API disponibles." - -msgid "Tells if only enabled API keys should be returned." -msgstr "Define si sólo las claves de API habilitadas deben ser devueltas." - -msgid "Key" -msgstr "Clave" - -msgid "Is enabled" -msgstr "Está habilitada" - -msgid "Expiration date" -msgstr "Fecha de caducidad" - -#, php-format -msgid "" -"Generates a character set sample just by shuffling the default one, \"%s\". " -"Then it can be set in the SHORTCODE_CHARS environment variable" -msgstr "" -"Genera un grupo de caracteres simplemente mexclando el grupo por defecto \"%s" -"\". Después puede ser utilizado en la variable de entrono SHORTCODE_CHARS" - -#, php-format -msgid "Character set: \"%s\"" -msgstr "Grupo de caracteres: \"%s\"" - -msgid "" -"Generates a random secret string that can be used for JWT token encryption" -msgstr "" -"Genera una cadena de caracteres aleatoria que puede ser usada para cifrar " -"tokens JWT" - -#, php-format -msgid "Secret key: \"%s\"" -msgstr "Clave secreta: \"%s\"" - -msgid "Deletes a short URL" -msgstr "Elimina una URL" - -msgid "The short code for the short URL to be deleted" -msgstr "El código corto de la URL corta a eliminar" - -msgid "" -"Ignores the safety visits threshold check, which could make short URLs with " -"many visits to be accidentally deleted" -msgstr "" -"Ignora el límite de seguridad de visitas, pudiendo resultar en el borrado " -"accidental de URLs con muchas visitas" - -#, php-format -msgid "Provided short code \"%s\" could not be found." -msgstr "El código corto proporcionado \"%s\" no ha podido ser encontrado." - -#, php-format -msgid "" -"It was not possible to delete the short URL with short code \"%s\" because " -"it has more than %s visits." -msgstr "" -"No se pudo eliminar la URL acortada con código corto \"%s\" porque tiene más " -"de %s visitas." - -msgid "Do you want to delete it anyway?" -msgstr "¿Aún así quieres eliminarla?" - -msgid "Short URL was not deleted." -msgstr "La URL corta no ha sido eliminada." - -#, php-format -msgid "Short URL with short code \"%s\" successfully deleted." -msgstr "La URL acortada con el código corto \"%s\" eliminada correctamente." - -msgid "" -"Processes and generates the previews for every URL, improving performance " -"for later web requests." -msgstr "" -"Procesa y genera las vistas previas para cada URL, mejorando el rendimiento " -"para peticiones web posteriores." - -msgid "Finished processing all URLs" -msgstr "Finalizado el procesado de todas las URLs" - -#, php-format -msgid "Processing URL %s..." -msgstr "Procesando URL %s..." - -msgid " Success!" -msgstr " ¡Correcto!" - -msgid "Error" -msgstr "Error" - -msgid "Generates a short URL for provided long URL and returns it" -msgstr "Genera una URL corta para la URL larga proporcionada y la devuelve" - -msgid "The long URL to parse" -msgstr "La URL larga a procesar" - -msgid "Tags to apply to the new short URL" -msgstr "Etiquetas a aplicar a la nueva URL acortada" - -msgid "" -"The date from which this short URL will be valid. If someone tries to access " -"it before this date, it will not be found." -msgstr "" -"La fecha desde la cual será válida esta URL acortada. Si alguien intenta " -"acceder a ella antes de esta fecha, no será encontrada." - -msgid "" -"The date until which this short URL will be valid. If someone tries to " -"access it after this date, it will not be found." -msgstr "" -"La fecha hasta la cual será válida está URL acortada. Si alguien intenta " -"acceder a ella después de esta fecha, no será encontrada." - -msgid "If provided, this slug will be used instead of generating a short code" -msgstr "" -"Si se proporciona, este slug será usado en vez de generar un código corto" - -msgid "This will limit the number of visits for this short URL." -msgstr "Esto limitará el número de visitas a esta URL acortada." - -#, fuzzy -#| msgid "A long URL was not provided. Which URL do you want to shorten?:" -msgid "A long URL was not provided. Which URL do you want to be shortened?" -msgstr "No se ha proporcionado una URL larga. ¿Qué URL deseas acortar?" - -msgid "A URL was not provided!" -msgstr "¡No se ha proporcionado una URL!" - -msgid "Processed long URL:" -msgstr "URL larga procesada:" - -msgid "Generated short URL:" -msgstr "URL corta generada:" - -#, php-format -msgid "Provided URL \"%s\" is invalid. Try with a different one." -msgstr "La URL proporcionada \"%s\" e inválida. Prueba con una diferente." - -#, php-format -msgid "" -"Provided slug \"%s\" is already in use by another URL. Try with a different " -"one." -msgstr "" -"El slug proporcionado \"%s\" ya está siendo usado para otra URL. Prueba con " -"uno diferente." - -msgid "Returns the detailed visits information for provided short code" -msgstr "" -"Devuelve la información detallada de visitas para el código corto " -"proporcionado" - -msgid "The short code which visits we want to get" -msgstr "El código corto del cual queremos obtener las visitas" - -msgid "Allows to filter visits, returning only those older than start date" -msgstr "" -"Permite filtrar las visitas, devolviendo sólo aquellas más antiguas que " -"startDate" - -msgid "Allows to filter visits, returning only those newer than end date" -msgstr "" -"Permite filtrar las visitas, devolviendo sólo aquellas más nuevas que endDate" - -msgid "A short code was not provided. Which short code do you want to use?" -msgstr "No se proporcionó un código corto. ¿Qué código corto deseas usar?" - -msgid "Referer" -msgstr "Origen" - -msgid "Date" -msgstr "Fecha" - -msgid "User agent" -msgstr "Agente de usuario" - -msgid "Country" -msgstr "País" - -msgid "List all short URLs" -msgstr "Listar todas las URLs cortas" - -#, php-format -msgid "The first page to list (%s items per page)" -msgstr "La primera página a listar (%s elementos por página)" - -msgid "" -"A query used to filter results by searching for it on the longUrl and " -"shortCode fields" -msgstr "" -"Una consulta usada para filtrar el resultado buscándola en los campos " -"longUrl y shortCode" - -msgid "A comma-separated list of tags to filter results" -msgstr "Una lista de etiquetas separadas por coma para filtrar el resultado" - -msgid "" -"The field from which we want to order by. Pass ASC or DESC separated by a " -"comma" -msgstr "" -"El campo por el cual queremos ordernar. Pasa ASC o DESC separado por una coma" - -msgid "Whether to display the tags or not" -msgstr "Si se desea mostrar las etiquetas o no" - -msgid "Short code" -msgstr "Código corto" - -msgid "Short URL" -msgstr "URL corta" - -msgid "Long URL" -msgstr "URL larga" - -msgid "Date created" -msgstr "Fecha de creación" - -msgid "Visits count" -msgstr "Número de visitas" - -msgid "Tags" -msgstr "Etiquetas" - -msgid "Short URLs properly listed" -msgstr "URLs cortas listadas correctamente" - -msgid "Continue with page" -msgstr "Continuar con la página" - -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?" - -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." - -msgid "Creates one or more tags." -msgstr "Crea una o más etiquetas." - -msgid "The name of the tags to create" -msgstr "El nombre de las etiquetas a crear" - -msgid "You have to provide at least one tag name" -msgstr "Debes proporcionar al menos un nombre de etiqueta" - -msgid "Tags properly created" -msgstr "Etiquetas correctamente creadas" - -msgid "Deletes one or more tags." -msgstr "Elimina una o más etiquetas." - -msgid "The name of the tags to delete" -msgstr "El nombre de las etiquetas a eliminar" - -msgid "Tags properly deleted" -msgstr "Etiquetas correctamente eliminadas" - -msgid "Lists existing tags." -msgstr "Lista las etiquetas existentes." - -#, fuzzy -msgid "Name" -msgstr "Nombre" - -msgid "No tags yet" -msgstr "Aún no hay etiquetas" - -msgid "Renames one existing tag." -msgstr "Renombra una etiqueta existente." - -msgid "Current name of the tag." -msgstr "Nombre actual de la etiqueta." - -msgid "New name of the tag." -msgstr "Nuevo nombre de la etiqueta." - -msgid "Tag properly renamed." -msgstr "Etiqueta correctamente renombrada." - -#, php-format -msgid "A tag with name \"%s\" was not found" -msgstr "Una etiqueta con nombre \"%s\" no ha sido encontrada" - -msgid "Processes visits where location is not set yet" -msgstr "Procesa las visitas donde la localización no ha sido establecida aún" - -#, php-format -msgid "There is already an instance of the \"%s\" command in execution" -msgstr "Ya existe una instancia del comando \"%s\" en ejecución" - -#, php-format -msgid "Address located at \"%s\"" -msgstr "Dirección localizada en \"%s\"" - -msgid "Finished processing all IPs" -msgstr "Finalizado el procesado de todas las IPs" - -msgid "Ignored visit with no IP address" -msgstr "Ignorada visita sin dirección IP" - -msgid "Processing IP" -msgstr "Procesando IP" - -msgid "Ignored localhost address" -msgstr "Ignorada IP de localhost" - -msgid "An error occurred while locating IP. Skipped" -msgstr "Se produjo un error al localizar la IP. Ignorado" - -msgid "Updates the GeoLite2 database file used to geolocate IP addresses" -msgstr "" -"Actualiza el fichero de base de datos de GeoLite2 usado para geolocalizar " -"direcciones IP" - -msgid "" -"The GeoLite2 database is updated first Tuesday every month, so this command " -"should be ideally run every first Wednesday" -msgstr "" -"La base de datos de GeoLite2 se actualiza el primer Martes de cada mes, por " -"lo que la opción ideal es ejecutar este comando cada primer miércoles de mes" - -msgid "GeoLite2 database properly updated" -msgstr "Base de datos de GeoLite2 correctamente actualizada" - -msgid "An error occurred while updating GeoLite2 database" -msgstr "Se produjo un error al actualizar la base de datos de GeoLite2" - -#~ msgid "IP location resolver limit reached. Waiting %s seconds..." -#~ msgstr "Limite del localizador de IPs alcanzado. Esperando %s segundos..." - -#~ msgid "Remote Address" -#~ msgstr "Dirección remota" - -#~ msgid "Original URL" -#~ msgstr "URL original" - -#~ msgid "You have reached last page" -#~ msgstr "Has alcanzado la última página" - -#~ msgid "No URL found for short code \"%s\"" -#~ msgstr "No se ha encontrado ninguna URL para el código corto \"%s\"" - -#~ msgid "Created tags" -#~ msgstr "Etiquetas creadas" - -#~ msgid "Deleted tags" -#~ msgstr "Etiquetas eliminadas" diff --git a/module/CLI/src/Command/Api/DisableKeyCommand.php b/module/CLI/src/Command/Api/DisableKeyCommand.php index 09bf52dc..5d865fb7 100644 --- a/module/CLI/src/Command/Api/DisableKeyCommand.php +++ b/module/CLI/src/Command/Api/DisableKeyCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class DisableKeyCommand extends Command @@ -21,23 +20,18 @@ class DisableKeyCommand extends Command * @var ApiKeyServiceInterface */ private $apiKeyService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator) + public function __construct(ApiKeyServiceInterface $apiKeyService) { - $this->apiKeyService = $apiKeyService; - $this->translator = $translator; parent::__construct(); + $this->apiKeyService = $apiKeyService; } protected function configure(): void { $this->setName(self::NAME) - ->setDescription($this->translator->translate('Disables an API key.')) - ->addArgument('apiKey', InputArgument::REQUIRED, $this->translator->translate('The API key to disable')); + ->setDescription('Disables an API key.') + ->addArgument('apiKey', InputArgument::REQUIRED, 'The API key to disable'); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -47,9 +41,9 @@ class DisableKeyCommand extends Command try { $this->apiKeyService->disable($apiKey); - $io->success(sprintf($this->translator->translate('API key "%s" properly disabled'), $apiKey)); + $io->success(sprintf('API key "%s" properly disabled', $apiKey)); } catch (InvalidArgumentException $e) { - $io->error(sprintf($this->translator->translate('API key "%s" does not exist.'), $apiKey)); + $io->error(sprintf('API key "%s" does not exist.', $apiKey)); } } } diff --git a/module/CLI/src/Command/Api/GenerateKeyCommand.php b/module/CLI/src/Command/Api/GenerateKeyCommand.php index 0b6baafa..8a958cbb 100644 --- a/module/CLI/src/Command/Api/GenerateKeyCommand.php +++ b/module/CLI/src/Command/Api/GenerateKeyCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class GenerateKeyCommand extends Command @@ -21,28 +20,24 @@ class GenerateKeyCommand extends Command * @var ApiKeyServiceInterface */ private $apiKeyService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator) + public function __construct(ApiKeyServiceInterface $apiKeyService) { $this->apiKeyService = $apiKeyService; - $this->translator = $translator; parent::__construct(); } protected function configure(): void { - $this->setName(self::NAME) - ->setDescription($this->translator->translate('Generates a new valid API key.')) - ->addOption( - 'expirationDate', - 'e', - InputOption::VALUE_OPTIONAL, - $this->translator->translate('The date in which the API key should expire. Use any valid PHP format.') - ); + $this + ->setName(self::NAME) + ->setDescription('Generates a new valid API key.') + ->addOption( + 'expirationDate', + 'e', + InputOption::VALUE_OPTIONAL, + 'The date in which the API key should expire. Use any valid PHP format.' + ); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -50,8 +45,6 @@ class GenerateKeyCommand extends Command $expirationDate = $input->getOption('expirationDate'); $apiKey = $this->apiKeyService->create(isset($expirationDate) ? Chronos::parse($expirationDate) : null); - (new SymfonyStyle($input, $output))->success( - sprintf($this->translator->translate('Generated API key: "%s"'), $apiKey) - ); + (new SymfonyStyle($input, $output))->success(sprintf('Generated API key: "%s"', $apiKey)); } } diff --git a/module/CLI/src/Command/Api/ListKeysCommand.php b/module/CLI/src/Command/Api/ListKeysCommand.php index aabad7ec..720b8d2b 100644 --- a/module/CLI/src/Command/Api/ListKeysCommand.php +++ b/module/CLI/src/Command/Api/ListKeysCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function array_filter; use function array_map; use function sprintf; @@ -27,28 +26,24 @@ class ListKeysCommand extends Command * @var ApiKeyServiceInterface */ private $apiKeyService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(ApiKeyServiceInterface $apiKeyService, TranslatorInterface $translator) + public function __construct(ApiKeyServiceInterface $apiKeyService) { - $this->apiKeyService = $apiKeyService; - $this->translator = $translator; parent::__construct(); + $this->apiKeyService = $apiKeyService; } protected function configure(): void { - $this->setName(self::NAME) - ->setDescription($this->translator->translate('Lists all the available API keys.')) - ->addOption( - 'enabledOnly', - null, - InputOption::VALUE_NONE, - $this->translator->translate('Tells if only enabled API keys should be returned.') - ); + $this + ->setName(self::NAME) + ->setDescription('Lists all the available API keys.') + ->addOption( + 'enabledOnly', + 'e', + InputOption::VALUE_NONE, + 'Tells if only enabled API keys should be returned.' + ); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -70,9 +65,9 @@ class ListKeysCommand extends Command }, $this->apiKeyService->listKeys($enabledOnly)); $io->table(array_filter([ - $this->translator->translate('Key'), - ! $enabledOnly ? $this->translator->translate('Is enabled') : null, - $this->translator->translate('Expiration date'), + 'Key', + ! $enabledOnly ? 'Is enabled' : null, + 'Expiration date', ]), $rows); } diff --git a/module/CLI/src/Command/Config/GenerateCharsetCommand.php b/module/CLI/src/Command/Config/GenerateCharsetCommand.php index 93b48541..5fe417d7 100644 --- a/module/CLI/src/Command/Config/GenerateCharsetCommand.php +++ b/module/CLI/src/Command/Config/GenerateCharsetCommand.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; use function str_shuffle; @@ -16,31 +15,20 @@ class GenerateCharsetCommand extends Command { public const NAME = 'config:generate-charset'; - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct(TranslatorInterface $translator) - { - $this->translator = $translator; - parent::__construct(); - } - protected function configure(): void { - $this->setName(self::NAME) - ->setDescription(sprintf($this->translator->translate( - 'Generates a character set sample just by shuffling the default one, "%s". ' - . 'Then it can be set in the SHORTCODE_CHARS environment variable' - ), UrlShortener::DEFAULT_CHARS)); + $this + ->setName(self::NAME) + ->setDescription(sprintf( + 'Generates a character set sample just by shuffling the default one, "%s". ' + . 'Then it can be set in the SHORTCODE_CHARS environment variable', + UrlShortener::DEFAULT_CHARS + )); } protected function execute(InputInterface $input, OutputInterface $output): void { $charSet = str_shuffle(UrlShortener::DEFAULT_CHARS); - (new SymfonyStyle($input, $output))->success( - sprintf($this->translator->translate('Character set: "%s"'), $charSet) - ); + (new SymfonyStyle($input, $output))->success(sprintf('Character set: "%s"', $charSet)); } } diff --git a/module/CLI/src/Command/Config/GenerateSecretCommand.php b/module/CLI/src/Command/Config/GenerateSecretCommand.php index aaa7f2ef..07b051a1 100644 --- a/module/CLI/src/Command/Config/GenerateSecretCommand.php +++ b/module/CLI/src/Command/Config/GenerateSecretCommand.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class GenerateSecretCommand extends Command @@ -17,30 +16,16 @@ class GenerateSecretCommand extends Command public const NAME = 'config:generate-secret'; - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct(TranslatorInterface $translator) - { - $this->translator = $translator; - parent::__construct(); - } - protected function configure(): void { - $this->setName(self::NAME) - ->setDescription($this->translator->translate( - 'Generates a random secret string that can be used for JWT token encryption' - )); + $this + ->setName(self::NAME) + ->setDescription('[DEPRECATED] Generates a random secret string that can be used for JWT token encryption'); } protected function execute(InputInterface $input, OutputInterface $output): void { $secret = $this->generateRandomString(32); - (new SymfonyStyle($input, $output))->success( - sprintf($this->translator->translate('Secret key: "%s"'), $secret) - ); + (new SymfonyStyle($input, $output))->success(sprintf('Secret key: "%s"', $secret)); } } diff --git a/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php index 61618e8d..018130a1 100644 --- a/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php @@ -11,7 +11,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class DeleteShortUrlCommand extends Command @@ -23,16 +22,11 @@ class DeleteShortUrlCommand extends Command * @var DeleteShortUrlServiceInterface */ private $deleteShortUrlService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(DeleteShortUrlServiceInterface $deleteShortUrlService, TranslatorInterface $translator) + public function __construct(DeleteShortUrlServiceInterface $deleteShortUrlService) { - $this->deleteShortUrlService = $deleteShortUrlService; - $this->translator = $translator; parent::__construct(); + $this->deleteShortUrlService = $deleteShortUrlService; } protected function configure(): void @@ -40,22 +34,14 @@ class DeleteShortUrlCommand extends Command $this ->setName(self::NAME) ->setAliases(self::ALIASES) - ->setDescription( - $this->translator->translate('Deletes a short URL') - ) - ->addArgument( - 'shortCode', - InputArgument::REQUIRED, - $this->translator->translate('The short code for the short URL to be deleted') - ) + ->setDescription('Deletes a short URL') + ->addArgument('shortCode', InputArgument::REQUIRED, 'The short code for the short URL to be deleted') ->addOption( 'ignore-threshold', 'i', InputOption::VALUE_NONE, - $this->translator->translate( - 'Ignores the safety visits threshold check, which could make short URLs with many visits to be ' - . 'accidentally deleted' - ) + 'Ignores the safety visits threshold check, which could make short URLs with many visits to be ' + . 'accidentally deleted' ); } @@ -68,9 +54,7 @@ class DeleteShortUrlCommand extends Command try { $this->runDelete($io, $shortCode, $ignoreThreshold); } catch (Exception\InvalidShortCodeException $e) { - $io->error( - sprintf($this->translator->translate('Provided short code "%s" could not be found.'), $shortCode) - ); + $io->error(sprintf('Provided short code "%s" could not be found.', $shortCode)); } catch (Exception\DeleteShortUrlException $e) { $this->retry($io, $shortCode, $e); } @@ -78,25 +62,24 @@ class DeleteShortUrlCommand extends Command private function retry(SymfonyStyle $io, string $shortCode, Exception\DeleteShortUrlException $e): void { - $warningMsg = sprintf($this->translator->translate( - 'It was not possible to delete the short URL with short code "%s" because it has more than %s visits.' - ), $shortCode, $e->getVisitsThreshold()); + $warningMsg = sprintf( + 'It was not possible to delete the short URL with short code "%s" because it has more than %s visits.', + $shortCode, + $e->getVisitsThreshold() + ); $io->writeln('' . $warningMsg . ''); - $forceDelete = $io->confirm($this->translator->translate('Do you want to delete it anyway?'), false); + $forceDelete = $io->confirm('Do you want to delete it anyway?', false); if ($forceDelete) { $this->runDelete($io, $shortCode, true); } else { - $io->warning($this->translator->translate('Short URL was not deleted.')); + $io->warning('Short URL was not deleted.'); } } private function runDelete(SymfonyStyle $io, string $shortCode, bool $ignoreThreshold): void { $this->deleteShortUrlService->deleteByShortCode($shortCode, $ignoreThreshold); - $io->success(sprintf( - $this->translator->translate('Short URL with short code "%s" successfully deleted.'), - $shortCode - )); + $io->success(sprintf('Short URL with short code "%s" successfully deleted.', $shortCode)); } } diff --git a/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php b/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php index 129a7df9..38cb6ade 100644 --- a/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php +++ b/module/CLI/src/Command/ShortUrl/GeneratePreviewCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class GeneratePreviewCommand extends Command @@ -22,24 +21,16 @@ class GeneratePreviewCommand extends Command * @var PreviewGeneratorInterface */ private $previewGenerator; - /** - * @var TranslatorInterface - */ - private $translator; /** * @var ShortUrlServiceInterface */ private $shortUrlService; - public function __construct( - ShortUrlServiceInterface $shortUrlService, - PreviewGeneratorInterface $previewGenerator, - TranslatorInterface $translator - ) { + public function __construct(ShortUrlServiceInterface $shortUrlService, PreviewGeneratorInterface $previewGenerator) + { + parent::__construct(); $this->shortUrlService = $shortUrlService; $this->previewGenerator = $previewGenerator; - $this->translator = $translator; - parent::__construct(null); } protected function configure(): void @@ -48,9 +39,7 @@ class GeneratePreviewCommand extends Command ->setName(self::NAME) ->setAliases(self::ALIASES) ->setDescription( - $this->translator->translate( - 'Processes and generates the previews for every URL, improving performance for later web requests.' - ) + 'Processes and generates the previews for every URL, improving performance for later web requests.' ); } @@ -66,17 +55,17 @@ class GeneratePreviewCommand extends Command } } while ($page <= $shortUrls->count()); - (new SymfonyStyle($input, $output))->success($this->translator->translate('Finished processing all URLs')); + (new SymfonyStyle($input, $output))->success('Finished processing all URLs'); } private function processUrl($url, OutputInterface $output): void { try { - $output->write(sprintf($this->translator->translate('Processing URL %s...'), $url)); + $output->write(sprintf('Processing URL %s...', $url)); $this->previewGenerator->generatePreview($url); - $output->writeln($this->translator->translate(' Success!')); + $output->writeln(' Success!'); } catch (PreviewGenerationException $e) { - $output->writeln(' ' . $this->translator->translate('Error') . ''); + $output->writeln(' Error'); if ($output->isVerbose()) { $this->getApplication()->renderException($e, $output); } diff --git a/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php index d67e7d9e..43f5d046 100644 --- a/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/GenerateShortUrlCommand.php @@ -15,7 +15,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zend\Diactoros\Uri; -use Zend\I18n\Translator\TranslatorInterface; use function array_merge; use function explode; use function sprintf; @@ -35,20 +34,12 @@ class GenerateShortUrlCommand extends Command * @var array */ private $domainConfig; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct( - UrlShortenerInterface $urlShortener, - TranslatorInterface $translator, - array $domainConfig - ) { + public function __construct(UrlShortenerInterface $urlShortener, array $domainConfig) + { + parent::__construct(); $this->urlShortener = $urlShortener; - $this->translator = $translator; $this->domainConfig = $domainConfig; - parent::__construct(null); } protected function configure(): void @@ -56,30 +47,40 @@ class GenerateShortUrlCommand extends Command $this ->setName(self::NAME) ->setAliases(self::ALIASES) - ->setDescription( - $this->translator->translate('Generates a short URL for provided long URL and returns it') - ) - ->addArgument('longUrl', InputArgument::REQUIRED, $this->translator->translate('The long URL to parse')) + ->setDescription('Generates a short URL for provided long URL and returns it') + ->addArgument('longUrl', InputArgument::REQUIRED, 'The long URL to parse') ->addOption( 'tags', 't', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, - $this->translator->translate('Tags to apply to the new short URL') + 'Tags to apply to the new short URL' ) - ->addOption('validSince', 's', InputOption::VALUE_REQUIRED, $this->translator->translate( + ->addOption( + 'validSince', + 's', + InputOption::VALUE_REQUIRED, 'The date from which this short URL will be valid. ' . 'If someone tries to access it before this date, it will not be found.' - )) - ->addOption('validUntil', 'u', InputOption::VALUE_REQUIRED, $this->translator->translate( + ) + ->addOption( + 'validUntil', + 'u', + InputOption::VALUE_REQUIRED, 'The date until which this short URL will be valid. ' . 'If someone tries to access it after this date, it will not be found.' - )) - ->addOption('customSlug', 'c', InputOption::VALUE_REQUIRED, $this->translator->translate( + ) + ->addOption( + 'customSlug', + 'c', + InputOption::VALUE_REQUIRED, 'If provided, this slug will be used instead of generating a short code' - )) - ->addOption('maxVisits', 'm', InputOption::VALUE_REQUIRED, $this->translator->translate( + ) + ->addOption( + 'maxVisits', + 'm', + InputOption::VALUE_REQUIRED, 'This will limit the number of visits for this short URL.' - )); + ); } protected function interact(InputInterface $input, OutputInterface $output): void @@ -90,9 +91,7 @@ class GenerateShortUrlCommand extends Command return; } - $longUrl = $io->ask( - $this->translator->translate('A long URL was not provided. Which URL do you want to be shortened?') - ); + $longUrl = $io->ask('A long URL was not provided. Which URL do you want to be shortened?'); if (! empty($longUrl)) { $input->setArgument('longUrl', $longUrl); } @@ -103,7 +102,7 @@ class GenerateShortUrlCommand extends Command $io = new SymfonyStyle($input, $output); $longUrl = $input->getArgument('longUrl'); if (empty($longUrl)) { - $io->error($this->translator->translate('A URL was not provided!')); + $io->error('A URL was not provided!'); return; } @@ -129,21 +128,15 @@ class GenerateShortUrlCommand extends Command $shortUrl = $this->buildShortUrl($this->domainConfig, $shortCode); $io->writeln([ - sprintf('%s %s', $this->translator->translate('Processed long URL:'), $longUrl), - sprintf('%s %s', $this->translator->translate('Generated short URL:'), $shortUrl), + sprintf('Processed long URL: %s', $longUrl), + sprintf('Generated short URL: %s', $shortUrl), ]); } catch (InvalidUrlException $e) { - $io->error(sprintf( - $this->translator->translate('Provided URL "%s" is invalid. Try with a different one.'), - $longUrl - )); + $io->error(sprintf('Provided URL "%s" is invalid. Try with a different one.', $longUrl)); } catch (NonUniqueSlugException $e) { - $io->error(sprintf( - $this->translator->translate( - 'Provided slug "%s" is already in use by another URL. Try with a different one.' - ), - $customSlug - )); + $io->error( + sprintf('Provided slug "%s" is already in use by another URL. Try with a different one.', $customSlug) + ); } } diff --git a/module/CLI/src/Command/ShortUrl/GetVisitsCommand.php b/module/CLI/src/Command/ShortUrl/GetVisitsCommand.php index e2451406..ecedd707 100644 --- a/module/CLI/src/Command/ShortUrl/GetVisitsCommand.php +++ b/module/CLI/src/Command/ShortUrl/GetVisitsCommand.php @@ -13,7 +13,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function array_map; use function Functional\select_keys; @@ -26,15 +25,10 @@ class GetVisitsCommand extends Command * @var VisitsTrackerInterface */ private $visitsTracker; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(VisitsTrackerInterface $visitsTracker, TranslatorInterface $translator) + public function __construct(VisitsTrackerInterface $visitsTracker) { $this->visitsTracker = $visitsTracker; - $this->translator = $translator; parent::__construct(); } @@ -43,25 +37,19 @@ class GetVisitsCommand extends Command $this ->setName(self::NAME) ->setAliases(self::ALIASES) - ->setDescription( - $this->translator->translate('Returns the detailed visits information for provided short code') - ) - ->addArgument( - 'shortCode', - InputArgument::REQUIRED, - $this->translator->translate('The short code which visits we want to get') - ) + ->setDescription('Returns the detailed visits information for provided short code') + ->addArgument('shortCode', InputArgument::REQUIRED, 'The short code which visits we want to get') ->addOption( 'startDate', 's', InputOption::VALUE_OPTIONAL, - $this->translator->translate('Allows to filter visits, returning only those older than start date') + 'Allows to filter visits, returning only those older than start date' ) ->addOption( 'endDate', 'e', InputOption::VALUE_OPTIONAL, - $this->translator->translate('Allows to filter visits, returning only those newer than end date') + 'Allows to filter visits, returning only those newer than end date' ); } @@ -73,9 +61,7 @@ class GetVisitsCommand extends Command } $io = new SymfonyStyle($input, $output); - $shortCode = $io->ask( - $this->translator->translate('A short code was not provided. Which short code do you want to use?') - ); + $shortCode = $io->ask('A short code was not provided. Which short code do you want to use?'); if (! empty($shortCode)) { $input->setArgument('shortCode', $shortCode); } @@ -94,12 +80,7 @@ class GetVisitsCommand extends Command $rowData['country'] = $visit->getVisitLocation()->getCountryName(); return select_keys($rowData, ['referer', 'date', 'userAgent', 'country']); }, $visits); - $io->table([ - $this->translator->translate('Referer'), - $this->translator->translate('Date'), - $this->translator->translate('User agent'), - $this->translator->translate('Country'), - ], $rows); + $io->table(['Referer', 'Date', 'User agent', 'Country'], $rows); } private function getDateOption(InputInterface $input, $key) diff --git a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php index 0ca2a96c..2be854b4 100644 --- a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php +++ b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php @@ -12,7 +12,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function array_values; use function count; use function explode; @@ -30,23 +29,15 @@ class ListShortUrlsCommand extends Command * @var ShortUrlServiceInterface */ private $shortUrlService; - /** - * @var TranslatorInterface - */ - private $translator; /** * @var array */ private $domainConfig; - public function __construct( - ShortUrlServiceInterface $shortUrlService, - TranslatorInterface $translator, - array $domainConfig - ) { - $this->shortUrlService = $shortUrlService; - $this->translator = $translator; + public function __construct(ShortUrlServiceInterface $shortUrlService, array $domainConfig) + { parent::__construct(); + $this->shortUrlService = $shortUrlService; $this->domainConfig = $domainConfig; } @@ -55,45 +46,33 @@ class ListShortUrlsCommand extends Command $this ->setName(self::NAME) ->setAliases(self::ALIASES) - ->setDescription($this->translator->translate('List all short URLs')) + ->setDescription('List all short URLs') ->addOption( 'page', 'p', InputOption::VALUE_OPTIONAL, - sprintf( - $this->translator->translate('The first page to list (%s items per page)'), - PaginableRepositoryAdapter::ITEMS_PER_PAGE - ), + sprintf('The first page to list (%s items per page)', PaginableRepositoryAdapter::ITEMS_PER_PAGE), '1' ) ->addOption( 'searchTerm', 's', InputOption::VALUE_OPTIONAL, - $this->translator->translate( - 'A query used to filter results by searching for it on the longUrl and shortCode fields' - ) + 'A query used to filter results by searching for it on the longUrl and shortCode fields' ) ->addOption( 'tags', 't', InputOption::VALUE_OPTIONAL, - $this->translator->translate('A comma-separated list of tags to filter results') + 'A comma-separated list of tags to filter results' ) ->addOption( 'orderBy', 'o', InputOption::VALUE_OPTIONAL, - $this->translator->translate( - 'The field from which we want to order by. Pass ASC or DESC separated by a comma' - ) + 'The field from which we want to order by. Pass ASC or DESC separated by a comma' ) - ->addOption( - 'showTags', - null, - InputOption::VALUE_NONE, - $this->translator->translate('Whether to display the tags or not') - ); + ->addOption('showTags', null, InputOption::VALUE_NONE, 'Whether to display the tags or not'); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -110,15 +89,9 @@ class ListShortUrlsCommand extends Command $result = $this->shortUrlService->listShortUrls($page, $searchTerm, $tags, $this->processOrderBy($input)); $page++; - $headers = [ - $this->translator->translate('Short code'), - $this->translator->translate('Short URL'), - $this->translator->translate('Long URL'), - $this->translator->translate('Date created'), - $this->translator->translate('Visits count'), - ]; + $headers = ['Short code', 'Short URL', 'Long URL', 'Date created', 'Visits count']; if ($showTags) { - $headers[] = $this->translator->translate('Tags'); + $headers[] = 'Tags'; } $rows = []; @@ -137,12 +110,9 @@ class ListShortUrlsCommand extends Command if ($this->isLastPage($result)) { $continue = false; - $io->success($this->translator->translate('Short URLs properly listed')); + $io->success('Short URLs properly listed'); } else { - $continue = $io->confirm( - sprintf($this->translator->translate('Continue with page') . ' %s?', $page), - false - ); + $continue = $io->confirm(sprintf('Continue with page %s?', $page), false); } } while ($continue); } diff --git a/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php b/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php index cc06c869..02dc1840 100644 --- a/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php @@ -11,7 +11,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class ResolveUrlCommand extends Command @@ -23,16 +22,11 @@ class ResolveUrlCommand extends Command * @var UrlShortenerInterface */ private $urlShortener; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(UrlShortenerInterface $urlShortener, TranslatorInterface $translator) + public function __construct(UrlShortenerInterface $urlShortener) { + parent::__construct(); $this->urlShortener = $urlShortener; - $this->translator = $translator; - parent::__construct(null); } protected function configure(): void @@ -40,12 +34,8 @@ class ResolveUrlCommand extends Command $this ->setName(self::NAME) ->setAliases(self::ALIASES) - ->setDescription($this->translator->translate('Returns the long URL behind a short code')) - ->addArgument( - 'shortCode', - InputArgument::REQUIRED, - $this->translator->translate('The short code to parse') - ); + ->setDescription('Returns the long URL behind a short code') + ->addArgument('shortCode', InputArgument::REQUIRED, 'The short code to parse'); } protected function interact(InputInterface $input, OutputInterface $output): void @@ -56,9 +46,7 @@ class ResolveUrlCommand extends Command } $io = new SymfonyStyle($input, $output); - $shortCode = $io->ask( - $this->translator->translate('A short code was not provided. Which short code do you want to parse?') - ); + $shortCode = $io->ask('A short code was not provided. Which short code do you want to parse?'); if (! empty($shortCode)) { $input->setArgument('shortCode', $shortCode); } @@ -71,17 +59,11 @@ class ResolveUrlCommand extends Command try { $url = $this->urlShortener->shortCodeToUrl($shortCode); - $output->writeln( - sprintf('%s %s', $this->translator->translate('Long URL:'), $url->getLongUrl()) - ); + $output->writeln(sprintf('Long URL: %s', $url->getLongUrl())); } catch (InvalidShortCodeException $e) { - $io->error( - sprintf($this->translator->translate('Provided short code "%s" has an invalid format.'), $shortCode) - ); + $io->error(sprintf('Provided short code "%s" has an invalid format.', $shortCode)); } catch (EntityDoesNotExistException $e) { - $io->error( - sprintf($this->translator->translate('Provided short code "%s" could not be found.'), $shortCode) - ); + $io->error(sprintf('Provided short code "%s" could not be found.', $shortCode)); } } } diff --git a/module/CLI/src/Command/Tag/CreateTagCommand.php b/module/CLI/src/Command/Tag/CreateTagCommand.php index d50d2124..56a31239 100644 --- a/module/CLI/src/Command/Tag/CreateTagCommand.php +++ b/module/CLI/src/Command/Tag/CreateTagCommand.php @@ -9,7 +9,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; class CreateTagCommand extends Command { @@ -19,28 +18,23 @@ class CreateTagCommand extends Command * @var TagServiceInterface */ private $tagService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator) + public function __construct(TagServiceInterface $tagService) { - $this->tagService = $tagService; - $this->translator = $translator; parent::__construct(); + $this->tagService = $tagService; } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription($this->translator->translate('Creates one or more tags.')) + ->setDescription('Creates one or more tags.') ->addOption( 'name', 't', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - $this->translator->translate('The name of the tags to create') + 'The name of the tags to create' ); } @@ -50,11 +44,11 @@ class CreateTagCommand extends Command $tagNames = $input->getOption('name'); if (empty($tagNames)) { - $io->warning($this->translator->translate('You have to provide at least one tag name')); + $io->warning('You have to provide at least one tag name'); return; } $this->tagService->createTags($tagNames); - $io->success($this->translator->translate('Tags properly created')); + $io->success('Tags properly created'); } } diff --git a/module/CLI/src/Command/Tag/DeleteTagsCommand.php b/module/CLI/src/Command/Tag/DeleteTagsCommand.php index 0ea36e3f..e2d3d27d 100644 --- a/module/CLI/src/Command/Tag/DeleteTagsCommand.php +++ b/module/CLI/src/Command/Tag/DeleteTagsCommand.php @@ -9,7 +9,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; class DeleteTagsCommand extends Command { @@ -19,28 +18,23 @@ class DeleteTagsCommand extends Command * @var TagServiceInterface */ private $tagService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator) + public function __construct(TagServiceInterface $tagService) { - $this->tagService = $tagService; - $this->translator = $translator; parent::__construct(); + $this->tagService = $tagService; } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription($this->translator->translate('Deletes one or more tags.')) + ->setDescription('Deletes one or more tags.') ->addOption( 'name', 't', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - $this->translator->translate('The name of the tags to delete') + 'The name of the tags to delete' ); } @@ -50,11 +44,11 @@ class DeleteTagsCommand extends Command $tagNames = $input->getOption('name'); if (empty($tagNames)) { - $io->warning($this->translator->translate('You have to provide at least one tag name')); + $io->warning('You have to provide at least one tag name'); return; } $this->tagService->deleteTags($tagNames); - $io->success($this->translator->translate('Tags properly deleted')); + $io->success('Tags properly deleted'); } } diff --git a/module/CLI/src/Command/Tag/ListTagsCommand.php b/module/CLI/src/Command/Tag/ListTagsCommand.php index 9b848d02..dd318f63 100644 --- a/module/CLI/src/Command/Tag/ListTagsCommand.php +++ b/module/CLI/src/Command/Tag/ListTagsCommand.php @@ -9,7 +9,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function Functional\map; class ListTagsCommand extends Command @@ -20,36 +19,31 @@ class ListTagsCommand extends Command * @var TagServiceInterface */ private $tagService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator) + public function __construct(TagServiceInterface $tagService) { - $this->tagService = $tagService; - $this->translator = $translator; parent::__construct(); + $this->tagService = $tagService; } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription($this->translator->translate('Lists existing tags.')); + ->setDescription('Lists existing tags.'); } protected function execute(InputInterface $input, OutputInterface $output): void { $io = new SymfonyStyle($input, $output); - $io->table([$this->translator->translate('Name')], $this->getTagsRows()); + $io->table(['Name'], $this->getTagsRows()); } private function getTagsRows(): array { $tags = $this->tagService->listTags(); if (empty($tags)) { - return [[$this->translator->translate('No tags yet')]]; + return [['No tags yet']]; } return map($tags, function (Tag $tag) { diff --git a/module/CLI/src/Command/Tag/RenameTagCommand.php b/module/CLI/src/Command/Tag/RenameTagCommand.php index e95affed..a65ac04b 100644 --- a/module/CLI/src/Command/Tag/RenameTagCommand.php +++ b/module/CLI/src/Command/Tag/RenameTagCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class RenameTagCommand extends Command @@ -21,25 +20,20 @@ class RenameTagCommand extends Command * @var TagServiceInterface */ private $tagService; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(TagServiceInterface $tagService, TranslatorInterface $translator) + public function __construct(TagServiceInterface $tagService) { - $this->tagService = $tagService; - $this->translator = $translator; parent::__construct(); + $this->tagService = $tagService; } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription($this->translator->translate('Renames one existing tag.')) - ->addArgument('oldName', InputArgument::REQUIRED, $this->translator->translate('Current name of the tag.')) - ->addArgument('newName', InputArgument::REQUIRED, $this->translator->translate('New name of the tag.')); + ->setDescription('Renames one existing tag.') + ->addArgument('oldName', InputArgument::REQUIRED, 'Current name of the tag.') + ->addArgument('newName', InputArgument::REQUIRED, 'New name of the tag.'); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -50,9 +44,9 @@ class RenameTagCommand extends Command try { $this->tagService->renameTag($oldName, $newName); - $io->success($this->translator->translate('Tag properly renamed.')); + $io->success('Tag properly renamed.'); } catch (EntityDoesNotExistException $e) { - $io->error(sprintf($this->translator->translate('A tag with name "%s" was not found'), $oldName)); + $io->error(sprintf('A tag with name "%s" was not found', $oldName)); } } } diff --git a/module/CLI/src/Command/Visit/ProcessVisitsCommand.php b/module/CLI/src/Command/Visit/ProcessVisitsCommand.php index 128ed9b7..d1c76a4a 100644 --- a/module/CLI/src/Command/Visit/ProcessVisitsCommand.php +++ b/module/CLI/src/Command/Visit/ProcessVisitsCommand.php @@ -15,7 +15,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Lock\Factory as Locker; -use Zend\I18n\Translator\TranslatorInterface; use function sprintf; class ProcessVisitsCommand extends Command @@ -30,10 +29,6 @@ class ProcessVisitsCommand extends Command * @var IpLocationResolverInterface */ private $ipLocationResolver; - /** - * @var TranslatorInterface - */ - private $translator; /** * @var Locker */ @@ -46,21 +41,19 @@ class ProcessVisitsCommand extends Command public function __construct( VisitServiceInterface $visitService, IpLocationResolverInterface $ipLocationResolver, - Locker $locker, - TranslatorInterface $translator + Locker $locker ) { + parent::__construct(); $this->visitService = $visitService; $this->ipLocationResolver = $ipLocationResolver; - $this->translator = $translator; $this->locker = $locker; - parent::__construct(); } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription($this->translator->translate('Processes visits where location is not set yet')); + ->setDescription('Processes visits where location is not set yet'); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -70,10 +63,7 @@ class ProcessVisitsCommand extends Command $lock = $this->locker->createLock(self::NAME); if (! $lock->acquire()) { - $io->warning(sprintf( - $this->translator->translate('There is already an instance of the "%s" command in execution'), - self::NAME - )); + $io->warning(sprintf('There is already an instance of the "%s" command in execution', self::NAME)); return; } @@ -81,14 +71,11 @@ class ProcessVisitsCommand extends Command $this->visitService->locateVisits( [$this, 'getGeolocationDataForVisit'], function (VisitLocation $location) use ($output) { - $output->writeln(sprintf( - ' [' . $this->translator->translate('Address located at "%s"') . ']', - $location->getCountryName() - )); + $output->writeln(sprintf(' [Address located at "%s"]', $location->getCountryName())); } ); - $io->success($this->translator->translate('Finished processing all IPs')); + $io->success('Finished processing all IPs'); } finally { $lock->release(); } @@ -97,31 +84,24 @@ class ProcessVisitsCommand extends Command public function getGeolocationDataForVisit(Visit $visit): array { if (! $visit->hasRemoteAddr()) { - $this->output->writeln(sprintf( - '%s', - $this->translator->translate('Ignored visit with no IP address') - ), OutputInterface::VERBOSITY_VERBOSE); + $this->output->writeln( + 'Ignored visit with no IP address', + OutputInterface::VERBOSITY_VERBOSE + ); throw new IpCannotBeLocatedException('Ignored visit with no IP address'); } $ipAddr = $visit->getRemoteAddr(); - $this->output->write(sprintf('%s %s', $this->translator->translate('Processing IP'), $ipAddr)); + $this->output->write(sprintf('Processing IP %s', $ipAddr)); if ($ipAddr === IpAddress::LOCALHOST) { - $this->output->writeln( - sprintf(' [%s]', $this->translator->translate('Ignored localhost address')) - ); + $this->output->writeln(' [Ignored localhost address]'); throw new IpCannotBeLocatedException('Ignored localhost address'); } try { return $this->ipLocationResolver->resolveIpLocation($ipAddr); } catch (WrongIpException $e) { - $this->output->writeln( - sprintf( - ' [%s]', - $this->translator->translate('An error occurred while locating IP. Skipped') - ) - ); + $this->output->writeln(' [An error occurred while locating IP. Skipped]'); if ($this->output->isVerbose()) { $this->getApplication()->renderException($e, $this->output); } diff --git a/module/CLI/src/Command/Visit/UpdateDbCommand.php b/module/CLI/src/Command/Visit/UpdateDbCommand.php index a17c36fd..cb228300 100644 --- a/module/CLI/src/Command/Visit/UpdateDbCommand.php +++ b/module/CLI/src/Command/Visit/UpdateDbCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Zend\I18n\Translator\TranslatorInterface; class UpdateDbCommand extends Command { @@ -20,29 +19,22 @@ class UpdateDbCommand extends Command * @var DbUpdaterInterface */ private $geoLiteDbUpdater; - /** - * @var TranslatorInterface - */ - private $translator; - public function __construct(DbUpdaterInterface $geoLiteDbUpdater, TranslatorInterface $translator) + public function __construct(DbUpdaterInterface $geoLiteDbUpdater) { - $this->geoLiteDbUpdater = $geoLiteDbUpdater; - $this->translator = $translator; parent::__construct(); + $this->geoLiteDbUpdater = $geoLiteDbUpdater; } protected function configure(): void { $this ->setName(self::NAME) - ->setDescription( - $this->translator->translate('Updates the GeoLite2 database file used to geolocate IP addresses') - ) - ->setHelp($this->translator->translate( + ->setDescription('Updates the GeoLite2 database file used to geolocate IP addresses') + ->setHelp( 'The GeoLite2 database is updated first Tuesday every month, so this command should be ideally run ' . 'every first Wednesday' - )); + ); } protected function execute(InputInterface $input, OutputInterface $output): void @@ -60,12 +52,12 @@ class UpdateDbCommand extends Command $progressBar->finish(); $io->writeln(''); - $io->success($this->translator->translate('GeoLite2 database properly updated')); + $io->success('GeoLite2 database properly updated'); } catch (RuntimeException $e) { $progressBar->finish(); $io->writeln(''); - $io->error($this->translator->translate('An error occurred while updating GeoLite2 database')); + $io->error('An error occurred while updating GeoLite2 database'); if ($io->isVerbose()) { $this->getApplication()->renderException($e, $output); } diff --git a/module/CLI/src/Factory/ApplicationFactory.php b/module/CLI/src/Factory/ApplicationFactory.php index 21ae46fd..4bc867c3 100644 --- a/module/CLI/src/Factory/ApplicationFactory.php +++ b/module/CLI/src/Factory/ApplicationFactory.php @@ -10,7 +10,6 @@ use Psr\Container\NotFoundExceptionInterface; use Shlinkio\Shlink\Core\Options\AppOptions; use Symfony\Component\Console\Application as CliApp; use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; -use Zend\I18n\Translator\Translator; use Zend\ServiceManager\Exception\ServiceNotCreatedException; use Zend\ServiceManager\Exception\ServiceNotFoundException; use Zend\ServiceManager\Factory\FactoryInterface; @@ -34,8 +33,6 @@ class ApplicationFactory implements FactoryInterface { $config = $container->get('config')['cli']; $appOptions = $container->get(AppOptions::class); - $translator = $container->get(Translator::class); - $translator->setLocale($config['locale']); $commands = $config['commands'] ?? []; $app = new CliApp($appOptions->getName(), $appOptions->getVersion()); diff --git a/module/CLI/test/Command/Api/DisableKeyCommandTest.php b/module/CLI/test/Command/Api/DisableKeyCommandTest.php index dacfcf91..de214220 100644 --- a/module/CLI/test/Command/Api/DisableKeyCommandTest.php +++ b/module/CLI/test/Command/Api/DisableKeyCommandTest.php @@ -10,7 +10,6 @@ use Shlinkio\Shlink\Common\Exception\InvalidArgumentException; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class DisableKeyCommandTest extends TestCase { @@ -26,7 +25,7 @@ class DisableKeyCommandTest extends TestCase public function setUp() { $this->apiKeyService = $this->prophesize(ApiKeyService::class); - $command = new DisableKeyCommand($this->apiKeyService->reveal(), Translator::factory([])); + $command = new DisableKeyCommand($this->apiKeyService->reveal()); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); diff --git a/module/CLI/test/Command/Api/GenerateKeyCommandTest.php b/module/CLI/test/Command/Api/GenerateKeyCommandTest.php index 104b6e70..cfdb9130 100644 --- a/module/CLI/test/Command/Api/GenerateKeyCommandTest.php +++ b/module/CLI/test/Command/Api/GenerateKeyCommandTest.php @@ -12,7 +12,6 @@ use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class GenerateKeyCommandTest extends TestCase { @@ -28,7 +27,7 @@ class GenerateKeyCommandTest extends TestCase public function setUp() { $this->apiKeyService = $this->prophesize(ApiKeyService::class); - $command = new GenerateKeyCommand($this->apiKeyService->reveal(), Translator::factory([])); + $command = new GenerateKeyCommand($this->apiKeyService->reveal()); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); diff --git a/module/CLI/test/Command/Api/ListKeysCommandTest.php b/module/CLI/test/Command/Api/ListKeysCommandTest.php index da5908ef..6a2ad8a3 100644 --- a/module/CLI/test/Command/Api/ListKeysCommandTest.php +++ b/module/CLI/test/Command/Api/ListKeysCommandTest.php @@ -10,7 +10,6 @@ use Shlinkio\Shlink\Rest\Entity\ApiKey; use Shlinkio\Shlink\Rest\Service\ApiKeyService; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class ListKeysCommandTest extends TestCase { @@ -26,7 +25,7 @@ class ListKeysCommandTest extends TestCase public function setUp() { $this->apiKeyService = $this->prophesize(ApiKeyService::class); - $command = new ListKeysCommand($this->apiKeyService->reveal(), Translator::factory([])); + $command = new ListKeysCommand($this->apiKeyService->reveal()); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); diff --git a/module/CLI/test/Command/Config/GenerateCharsetCommandTest.php b/module/CLI/test/Command/Config/GenerateCharsetCommandTest.php index 8aaca745..b79dfe53 100644 --- a/module/CLI/test/Command/Config/GenerateCharsetCommandTest.php +++ b/module/CLI/test/Command/Config/GenerateCharsetCommandTest.php @@ -7,7 +7,6 @@ use PHPUnit\Framework\TestCase; use Shlinkio\Shlink\CLI\Command\Config\GenerateCharsetCommand; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use function implode; use function sort; use function str_split; @@ -21,7 +20,7 @@ class GenerateCharsetCommandTest extends TestCase public function setUp() { - $command = new GenerateCharsetCommand(Translator::factory([])); + $command = new GenerateCharsetCommand(); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/ShortUrl/DeleteShortCodeCommandTest.php b/module/CLI/test/Command/ShortUrl/DeleteShortCodeCommandTest.php index 61142a20..bab8c82c 100644 --- a/module/CLI/test/Command/ShortUrl/DeleteShortCodeCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/DeleteShortCodeCommandTest.php @@ -11,7 +11,6 @@ use Shlinkio\Shlink\Core\Exception; use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use function array_pop; use function sprintf; @@ -30,7 +29,7 @@ class DeleteShortCodeCommandTest extends TestCase { $this->service = $this->prophesize(DeleteShortUrlServiceInterface::class); - $command = new DeleteShortUrlCommand($this->service->reveal(), Translator::factory([])); + $command = new DeleteShortUrlCommand($this->service->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/ShortUrl/GeneratePreviewCommandTest.php b/module/CLI/test/Command/ShortUrl/GeneratePreviewCommandTest.php index 62b9496a..183872ac 100644 --- a/module/CLI/test/Command/ShortUrl/GeneratePreviewCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/GeneratePreviewCommandTest.php @@ -13,7 +13,6 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Service\ShortUrlService; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use Zend\Paginator\Adapter\ArrayAdapter; use Zend\Paginator\Paginator; use function count; @@ -39,11 +38,7 @@ class GeneratePreviewCommandTest extends TestCase $this->previewGenerator = $this->prophesize(PreviewGenerator::class); $this->shortUrlService = $this->prophesize(ShortUrlService::class); - $command = new GeneratePreviewCommand( - $this->shortUrlService->reveal(), - $this->previewGenerator->reveal(), - Translator::factory([]) - ); + $command = new GeneratePreviewCommand($this->shortUrlService->reveal(), $this->previewGenerator->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php b/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php index 7f3a339e..2720fb45 100644 --- a/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/GenerateShortUrlCommandTest.php @@ -14,7 +14,6 @@ use Shlinkio\Shlink\Core\Exception\InvalidUrlException; use Shlinkio\Shlink\Core\Service\UrlShortener; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class GenerateShortUrlCommandTest extends TestCase { @@ -30,7 +29,7 @@ class GenerateShortUrlCommandTest extends TestCase public function setUp() { $this->urlShortener = $this->prophesize(UrlShortener::class); - $command = new GenerateShortUrlCommand($this->urlShortener->reveal(), Translator::factory([]), [ + $command = new GenerateShortUrlCommand($this->urlShortener->reveal(), [ 'schema' => 'http', 'hostname' => 'foo.com', ]); diff --git a/module/CLI/test/Command/ShortUrl/GetVisitsCommandTest.php b/module/CLI/test/Command/ShortUrl/GetVisitsCommandTest.php index d36c798a..1b839e15 100644 --- a/module/CLI/test/Command/ShortUrl/GetVisitsCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/GetVisitsCommandTest.php @@ -16,7 +16,6 @@ use Shlinkio\Shlink\Core\Model\Visitor; use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use function strpos; class GetVisitsCommandTest extends TestCase @@ -33,7 +32,7 @@ class GetVisitsCommandTest extends TestCase public function setUp() { $this->visitsTracker = $this->prophesize(VisitsTrackerInterface::class); - $command = new GetVisitsCommand($this->visitsTracker->reveal(), Translator::factory([])); + $command = new GetVisitsCommand($this->visitsTracker->reveal()); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); diff --git a/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php b/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php index 4edd20f8..60710c31 100644 --- a/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php @@ -11,7 +11,6 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use Zend\Paginator\Adapter\ArrayAdapter; use Zend\Paginator\Paginator; @@ -30,7 +29,7 @@ class ListShortUrlsCommandTest extends TestCase { $this->shortUrlService = $this->prophesize(ShortUrlServiceInterface::class); $app = new Application(); - $command = new ListShortUrlsCommand($this->shortUrlService->reveal(), Translator::factory([]), []); + $command = new ListShortUrlsCommand($this->shortUrlService->reveal(), []); $app->add($command); $this->commandTester = new CommandTester($command); } diff --git a/module/CLI/test/Command/ShortUrl/ResolveUrlCommandTest.php b/module/CLI/test/Command/ShortUrl/ResolveUrlCommandTest.php index 0f17a7d7..c05aced3 100644 --- a/module/CLI/test/Command/ShortUrl/ResolveUrlCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/ResolveUrlCommandTest.php @@ -12,7 +12,6 @@ use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException; use Shlinkio\Shlink\Core\Service\UrlShortener; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; use const PHP_EOL; class ResolveUrlCommandTest extends TestCase @@ -29,7 +28,7 @@ class ResolveUrlCommandTest extends TestCase public function setUp() { $this->urlShortener = $this->prophesize(UrlShortener::class); - $command = new ResolveUrlCommand($this->urlShortener->reveal(), Translator::factory([])); + $command = new ResolveUrlCommand($this->urlShortener->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Tag/CreateTagCommandTest.php b/module/CLI/test/Command/Tag/CreateTagCommandTest.php index 39b6f59f..55871da1 100644 --- a/module/CLI/test/Command/Tag/CreateTagCommandTest.php +++ b/module/CLI/test/Command/Tag/CreateTagCommandTest.php @@ -11,7 +11,6 @@ use Shlinkio\Shlink\CLI\Command\Tag\CreateTagCommand; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class CreateTagCommandTest extends TestCase { @@ -28,7 +27,7 @@ class CreateTagCommandTest extends TestCase { $this->tagService = $this->prophesize(TagServiceInterface::class); - $command = new CreateTagCommand($this->tagService->reveal(), Translator::factory([])); + $command = new CreateTagCommand($this->tagService->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php index 819342c9..654431c5 100644 --- a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php +++ b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php @@ -10,7 +10,6 @@ use Shlinkio\Shlink\CLI\Command\Tag\DeleteTagsCommand; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class DeleteTagsCommandTest extends TestCase { @@ -31,7 +30,7 @@ class DeleteTagsCommandTest extends TestCase { $this->tagService = $this->prophesize(TagServiceInterface::class); - $command = new DeleteTagsCommand($this->tagService->reveal(), Translator::factory([])); + $command = new DeleteTagsCommand($this->tagService->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Tag/ListTagsCommandTest.php b/module/CLI/test/Command/Tag/ListTagsCommandTest.php index cc45d182..e21054ca 100644 --- a/module/CLI/test/Command/Tag/ListTagsCommandTest.php +++ b/module/CLI/test/Command/Tag/ListTagsCommandTest.php @@ -11,7 +11,6 @@ use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class ListTagsCommandTest extends TestCase { @@ -32,7 +31,7 @@ class ListTagsCommandTest extends TestCase { $this->tagService = $this->prophesize(TagServiceInterface::class); - $command = new ListTagsCommand($this->tagService->reveal(), Translator::factory([])); + $command = new ListTagsCommand($this->tagService->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Tag/RenameTagCommandTest.php b/module/CLI/test/Command/Tag/RenameTagCommandTest.php index ab9e1589..55cc2a24 100644 --- a/module/CLI/test/Command/Tag/RenameTagCommandTest.php +++ b/module/CLI/test/Command/Tag/RenameTagCommandTest.php @@ -12,7 +12,6 @@ use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class RenameTagCommandTest extends TestCase { @@ -33,7 +32,7 @@ class RenameTagCommandTest extends TestCase { $this->tagService = $this->prophesize(TagServiceInterface::class); - $command = new RenameTagCommand($this->tagService->reveal(), Translator::factory([])); + $command = new RenameTagCommand($this->tagService->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php b/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php index 9c691492..fa653d0d 100644 --- a/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php +++ b/module/CLI/test/Command/Visit/ProcessVisitsCommandTest.php @@ -21,7 +21,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Lock; use Throwable; -use Zend\I18n\Translator\Translator; use function array_shift; use function sprintf; @@ -63,8 +62,7 @@ class ProcessVisitsCommandTest extends TestCase $command = new ProcessVisitsCommand( $this->visitService->reveal(), $this->ipResolver->reveal(), - $this->locker->reveal(), - Translator::factory([]) + $this->locker->reveal() ); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/Command/Visit/UpdateDbCommandTest.php b/module/CLI/test/Command/Visit/UpdateDbCommandTest.php index 9e7d0736..0857c64b 100644 --- a/module/CLI/test/Command/Visit/UpdateDbCommandTest.php +++ b/module/CLI/test/Command/Visit/UpdateDbCommandTest.php @@ -11,7 +11,6 @@ use Shlinkio\Shlink\Common\Exception\RuntimeException; use Shlinkio\Shlink\Common\IpGeolocation\GeoLite2\DbUpdaterInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Zend\I18n\Translator\Translator; class UpdateDbCommandTest extends TestCase { @@ -28,7 +27,7 @@ class UpdateDbCommandTest extends TestCase { $this->dbUpdater = $this->prophesize(DbUpdaterInterface::class); - $command = new UpdateDbCommand($this->dbUpdater->reveal(), Translator::factory([])); + $command = new UpdateDbCommand($this->dbUpdater->reveal()); $app = new Application(); $app->add($command); diff --git a/module/CLI/test/ConfigProviderTest.php b/module/CLI/test/ConfigProviderTest.php index fe86d922..19a679ea 100644 --- a/module/CLI/test/ConfigProviderTest.php +++ b/module/CLI/test/ConfigProviderTest.php @@ -23,10 +23,9 @@ class ConfigProviderTest extends TestCase */ public function confiIsProperlyReturned() { - $config = $this->configProvider->__invoke(); + $config = ($this->configProvider)(); $this->assertArrayHasKey('cli', $config); $this->assertArrayHasKey('dependencies', $config); - $this->assertArrayHasKey('translator', $config); } } diff --git a/module/CLI/test/Factory/ApplicationFactoryTest.php b/module/CLI/test/Factory/ApplicationFactoryTest.php index fdbd56c6..5c28e65f 100644 --- a/module/CLI/test/Factory/ApplicationFactoryTest.php +++ b/module/CLI/test/Factory/ApplicationFactoryTest.php @@ -10,7 +10,6 @@ use Shlinkio\Shlink\CLI\Factory\ApplicationFactory; use Shlinkio\Shlink\Core\Options\AppOptions; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; -use Zend\I18n\Translator\Translator; use Zend\ServiceManager\ServiceManager; use function array_merge; @@ -66,7 +65,6 @@ class ApplicationFactoryTest extends TestCase 'cli' => array_merge($config, ['locale' => 'en']), ], AppOptions::class => new AppOptions(), - Translator::class => Translator::factory([]), ]]); }