diff --git a/.env.dist b/.env.dist index 9ecb9fe0..16ad75bc 100644 --- a/.env.dist +++ b/.env.dist @@ -5,10 +5,6 @@ SHORTENED_URL_SCHEMA= SHORTENED_URL_HOSTNAME= SHORTCODE_CHARS= -# Language -DEFAULT_LOCALE= -CLI_LOCALE= - # Database DB_USER= DB_PASSWORD= diff --git a/composer.json b/composer.json index 7ee380a9..edcdc965 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "ocramius/proxy-manager": "~2.2.2", "phly/phly-event-dispatcher": "^1.0", "predis/predis": "^1.1", - "shlinkio/shlink-common": "^1.0", + "shlinkio/shlink-common": "^2.0", "shlinkio/shlink-event-dispatcher": "^1.0", "shlinkio/shlink-installer": "^1.2.1", "shlinkio/shlink-ip-geolocation": "^1.0", @@ -50,7 +50,6 @@ "zendframework/zend-expressive-helpers": "^5.3", "zendframework/zend-expressive-platesrenderer": "^2.1", "zendframework/zend-expressive-swoole": "^2.4", - "zendframework/zend-i18n": "^2.9", "zendframework/zend-inputfilter": "^2.10", "zendframework/zend-paginator": "^2.8", "zendframework/zend-servicemanager": "^3.4", diff --git a/config/autoload/middleware-pipeline.global.php b/config/autoload/middleware-pipeline.global.php index 19573e10..385de0f2 100644 --- a/config/autoload/middleware-pipeline.global.php +++ b/config/autoload/middleware-pipeline.global.php @@ -47,9 +47,6 @@ return [ 'post-routing' => [ 'middleware' => [ Expressive\Router\Middleware\DispatchMiddleware::class, - - // Only if a not found error is triggered, set-up the locale to be used - Common\Middleware\LocaleMiddleware::class, Core\Response\NotFoundHandler::class, ], 'priority' => 1, diff --git a/config/autoload/translator.global.php b/config/autoload/translator.global.php deleted file mode 100644 index 2b03058c..00000000 --- a/config/autoload/translator.global.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -declare(strict_types=1); - -use Shlinkio\Shlink\Common; - -return [ - - 'translator' => [ - 'locale' => Common\env('DEFAULT_LOCALE', 'en'), - ], - -]; diff --git a/docker/README.md b/docker/README.md index 3f5601a1..2f2a4012 100644 --- a/docker/README.md +++ b/docker/README.md @@ -101,7 +101,6 @@ This is the complete list of supported env vars: * `DB_PORT`: The port in which the database service is running when using an external database driver. Defaults to **3306**. * `DISABLE_TRACK_PARAM`: The name of a query param that can be used to visit short URLs avoiding the visit to be tracked. This feature won't be available if not value is provided. * `DELETE_SHORT_URL_THRESHOLD`: The amount of visits on short URLs which will not allow them to be deleted. Defaults to `15`. -* `LOCALE`: Defines the default language for error pages when a user accesses a short URL which does not exist. Supported values are **es** and **en**. Defaults to **en**. * `VALIDATE_URLS`: Boolean which tells if shlink should validate a status 20x (after following redirects) is returned when trying to shorten a URL. Defaults to `true`. * `NOT_FOUND_REDIRECT_TO`: If a URL is provided here, when a user tries to access an invalid short URL, he/she will be redirected to this value. If this env var is not provided, the user will see a generic `404 - not found` page. * `REDIS_SERVERS`: A comma-separated list of redis servers where Shlink locks are stored (locks are used to prevent some operations to be run more than once in parallel). @@ -128,7 +127,6 @@ docker run \ -e DB_PORT=3306 \ -e DISABLE_TRACK_PARAM="no-track" \ -e DELETE_SHORT_URL_THRESHOLD=30 \ - -e LOCALE=es \ -e VALIDATE_URLS=false \ -e "NOT_FOUND_REDIRECT_TO=https://www.google.com" \ -e "REDIS_SERVERS=tcp://172.20.0.1:6379,tcp://172.20.0.2:6379" \ @@ -147,7 +145,6 @@ The whole configuration should have this format, but it can be split into multip { "disable_track_param": "my_param", "delete_short_url_threshold": 30, - "locale": "es", "short_domain_schema": "https", "short_domain_host": "doma.in", "validate_url": false, diff --git a/docker/config/shlink_in_docker.local.php b/docker/config/shlink_in_docker.local.php index 37870c9b..e84a4467 100644 --- a/docker/config/shlink_in_docker.local.php +++ b/docker/config/shlink_in_docker.local.php @@ -124,10 +124,6 @@ return [ 'visits_threshold' => (int) env('DELETE_SHORT_URL_THRESHOLD', 15), ], - 'translator' => [ - 'locale' => env('LOCALE', 'en'), - ], - 'entity_manager' => [ 'connection' => $helper->getDbConfig(), ], diff --git a/module/CLI/test/Factory/ApplicationFactoryTest.php b/module/CLI/test/Factory/ApplicationFactoryTest.php index 285d41c6..c7ff613d 100644 --- a/module/CLI/test/Factory/ApplicationFactoryTest.php +++ b/module/CLI/test/Factory/ApplicationFactoryTest.php @@ -12,8 +12,6 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Zend\ServiceManager\ServiceManager; -use function array_merge; - class ApplicationFactoryTest extends TestCase { /** @var ApplicationFactory */ @@ -49,7 +47,7 @@ class ApplicationFactoryTest extends TestCase { return new ServiceManager(['services' => [ 'config' => [ - 'cli' => array_merge($config, ['locale' => 'en']), + 'cli' => $config, ], AppOptions::class => new AppOptions(), ]]); diff --git a/module/Core/config/translator.config.php b/module/Core/config/translator.config.php deleted file mode 100644 index 659d4cae..00000000 --- a/module/Core/config/translator.config.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -declare(strict_types=1); - -return [ - - 'translator' => [ - 'translation_file_patterns' => [ - [ - 'type' => 'gettext', - 'base_dir' => __DIR__ . '/../lang', - 'pattern' => '%s.mo', - ], - ], - ], - -]; diff --git a/module/Core/lang/es.mo b/module/Core/lang/es.mo deleted file mode 100644 index 746fd5be..00000000 Binary files a/module/Core/lang/es.mo and /dev/null differ diff --git a/module/Core/lang/es.po b/module/Core/lang/es.po deleted file mode 100644 index 8f5a2263..00000000 --- a/module/Core/lang/es.po +++ /dev/null @@ -1,44 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Shlink 1.0\n" -"POT-Creation-Date: 2019-04-14 08:58+0200\n" -"PO-Revision-Date: 2019-04-14 08:58+0200\n" -"Last-Translator: Alejandro Celaya <alejandro@alejandrocelaya.com>\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.1.1\n" -"X-Poedit-Basepath: ..\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: translate;translaePlural;translate_plural\n" -"X-Poedit-SearchPath-0: templates\n" -"X-Poedit-SearchPath-1: config\n" -"X-Poedit-SearchPath-2: src\n" - -msgid "URL Not Found" -msgstr "URL no encontrada" - -msgid "Page not found." -msgstr "Página no encontrada." - -msgid "The page you requested could not be found." -msgstr "La página solicitada no ha podido ser encontrada." - -msgid "Oops!" -msgstr "¡Vaya!" - -#, php-format -msgid "We encountered a %s %s error." -msgstr "Hemos encontrado un error %s %s." - -msgid "This short URL doesn't seem to be valid." -msgstr "Esta URL acortada no parece ser válida." - -msgid "Make sure you included all the characters, with no extra punctuation." -msgstr "Asegúrate de haber incluído todos los caracteres, sin puntuación extra." - -msgid "Invalid URL" -msgstr "URL inválida" diff --git a/module/Core/src/SimplifiedConfigParser.php b/module/Core/src/SimplifiedConfigParser.php index 7cbb1b0a..42c5d205 100644 --- a/module/Core/src/SimplifiedConfigParser.php +++ b/module/Core/src/SimplifiedConfigParser.php @@ -21,7 +21,6 @@ class SimplifiedConfigParser 'not_found_redirect_to' => ['url_shortener', 'not_found_short_url', 'redirect_to'], 'db_config' => ['entity_manager', 'connection'], 'delete_short_url_threshold' => ['delete_short_urls', 'visits_threshold'], - 'locale' => ['translator', 'locale'], 'redis_servers' => ['redis', 'servers'], ]; private const SIMPLIFIED_CONFIG_SIDE_EFFECTS = [ diff --git a/module/Core/templates/error/404.phtml b/module/Core/templates/error/404.phtml index ca9d7dbf..bd1b0b6f 100644 --- a/module/Core/templates/error/404.phtml +++ b/module/Core/templates/error/404.phtml @@ -1,7 +1,7 @@ <?php $this->layout('ShlinkCore::layout/default') ?> <?php $this->start('title') ?> - <?= $this->translate('URL Not Found') ?> + URL Not Found <?php $this->end() ?> <?php $this->start('stylesheets') ?> @@ -14,6 +14,6 @@ <?php $this->start('main') ?> <h1>404</h1> <hr> - <h3><?= $this->translate('Page not found.') ?></h3> - <p><?= $this->translate('The page you requested could not be found.') ?></p> + <h3>Page not found.</h3> + <p>The page you requested could not be found.</p> <?php $this->end() ?> diff --git a/module/Core/templates/error/error.phtml b/module/Core/templates/error/error.phtml index 666f6ec3..07ecbb20 100644 --- a/module/Core/templates/error/error.phtml +++ b/module/Core/templates/error/error.phtml @@ -12,14 +12,14 @@ <?php $this->end() ?> <?php $this->start('main') ?> - <h1><?= $this->translate('Oops!') ?></h1> + <h1>Oops!</h1> <hr> <?php if ($status !== 404): ?> - <p><?= sprintf($this->translate('We encountered a %s %s error.'), $status, $reason) ?></p> + <p><?= sprintf('We encountered a %s %s error.', $status, $reason) ?></p> <?php else: ?> - <p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p> - <p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p> + <p>'This short URL doesn\'t seem to be valid.</p> + <p>'Make sure you included all the characters, with no extra punctuation.</p> <?php endif; ?> <?php $this->end() ?> diff --git a/module/Core/templates/invalid-short-code.phtml b/module/Core/templates/invalid-short-code.phtml index 2240ce6f..ffee23f8 100644 --- a/module/Core/templates/invalid-short-code.phtml +++ b/module/Core/templates/invalid-short-code.phtml @@ -1,7 +1,7 @@ <?php $this->layout('ShlinkCore::layout/default') ?> <?php $this->start('title') ?> - <?= $this->translate('Invalid URL') ?> + Invalid URL <?php $this->end() ?> <?php $this->start('stylesheets') ?> @@ -12,8 +12,8 @@ <?php $this->end() ?> <?php $this->start('main') ?> - <h1><?= $this->translate('Oops!') ?></h1> + <h1>Oops!</h1> <hr> - <p><?= $this->translate('This short URL doesn\'t seem to be valid.') ?></p> - <p><?= $this->translate('Make sure you included all the characters, with no extra punctuation.') ?></p> + <p>This short URL doesn\'t seem to be valid.</p> + <p>Make sure you included all the characters, with no extra punctuation.</p> <?php $this->end() ?> diff --git a/module/Core/templates/layout/default.phtml b/module/Core/templates/layout/default.phtml index c87472af..b231d48b 100644 --- a/module/Core/templates/layout/default.phtml +++ b/module/Core/templates/layout/default.phtml @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="<?= $this->locale() ?>"> +<html lang="en"> <head> <title><?= $this->section('title', '') ?> | URL shortener</title> <meta charset="utf-8"> diff --git a/module/Core/test/ConfigProviderTest.php b/module/Core/test/ConfigProviderTest.php index 44c4e308..41291aac 100644 --- a/module/Core/test/ConfigProviderTest.php +++ b/module/Core/test/ConfigProviderTest.php @@ -24,7 +24,6 @@ class ConfigProviderTest extends TestCase $this->assertArrayHasKey('routes', $config); $this->assertArrayHasKey('dependencies', $config); $this->assertArrayHasKey('templates', $config); - $this->assertArrayHasKey('translator', $config); $this->assertArrayHasKey('zend-expressive', $config); } } diff --git a/module/Core/test/SimplifiedConfigParserTest.php b/module/Core/test/SimplifiedConfigParserTest.php index fbef2567..957c7a24 100644 --- a/module/Core/test/SimplifiedConfigParserTest.php +++ b/module/Core/test/SimplifiedConfigParserTest.php @@ -39,7 +39,6 @@ class SimplifiedConfigParserTest extends TestCase 'short_domain_host' => 'doma.in', 'validate_url' => false, 'delete_short_url_threshold' => 50, - 'locale' => 'es', 'not_found_redirect_to' => 'foobar.com', 'redis_servers' => [ 'tcp://1.1.1.1:1111', @@ -80,10 +79,6 @@ class SimplifiedConfigParserTest extends TestCase ], ], - 'translator' => [ - 'locale' => 'es', - ], - 'delete_short_urls' => [ 'visits_threshold' => 50, 'check_visits_threshold' => true,