diff --git a/composer.json b/composer.json index 63f3d692a2..66eefb5da0 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "igorw/get-in": "~1.0", "imagine/imagine": "0.6.x-dev", "jms/serializer": "~0.10", - "jms/translation-bundle": "dev-rebase-2015-10-20", + "jms/translation-bundle": "dev-fix-2021-04-19", "justinrainbow/json-schema": "2.0.3 as 1.6.1", "league/flysystem": "^1.0", "league/flysystem-aws-s3-v2": "^1.0", diff --git a/composer.lock b/composer.lock index 9f559ecf9e..57dad1e5bc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d986d21a2ad9125f83251d4c3943ffd7", + "content-hash": "ec0deea7f3be7c6b5807761bb3a9e489", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -3998,17 +3998,17 @@ }, { "name": "jms/translation-bundle", - "version": "dev-rebase-2015-10-20", + "version": "dev-fix-2021-04-19", "target-dir": "JMS/TranslationBundle", "source": { "type": "git", "url": "https://github.com/alchemy-fr/JMSTranslationBundle.git", - "reference": "aff66e65736d9fddbd17cac5a5f0c6fd044c6a92" + "reference": "1b857455c9b034fdd6599042dc295cee26925779" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/JMSTranslationBundle/zipball/aff66e65736d9fddbd17cac5a5f0c6fd044c6a92", - "reference": "aff66e65736d9fddbd17cac5a5f0c6fd044c6a92", + "url": "https://api.github.com/repos/alchemy-fr/JMSTranslationBundle/zipball/1b857455c9b034fdd6599042dc295cee26925779", + "reference": "1b857455c9b034fdd6599042dc295cee26925779", "shasum": "" }, "require": { @@ -4068,9 +4068,9 @@ "webinterface" ], "support": { - "source": "https://github.com/alchemy-fr/JMSTranslationBundle/tree/rebase-2015-10-20" + "source": "https://github.com/alchemy-fr/JMSTranslationBundle/tree/fix-2021-04-19" }, - "time": "2015-11-04T15:09:44+00:00" + "time": "2021-04-20T13:09:35+00:00" }, { "name": "justinrainbow/json-schema", @@ -4266,6 +4266,7 @@ } ], "description": "Flysystem adapter for AWS S3 SDK v2", + "abandoned": "league/flysystem-aws-s3-v3", "time": "2015-10-15T15:55:48+00:00" }, { @@ -4891,12 +4892,12 @@ "version": "v1.0.4", "source": { "type": "git", - "url": "https://github.com/whiteoctober/Pagerfanta.git", + "url": "https://github.com/BabDev/Pagerfanta.git", "reference": "f846c5e06bb66df659a688ea4734aab49de589d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/f846c5e06bb66df659a688ea4734aab49de589d6", + "url": "https://api.github.com/repos/BabDev/Pagerfanta/zipball/f846c5e06bb66df659a688ea4734aab49de589d6", "reference": "f846c5e06bb66df659a688ea4734aab49de589d6", "shasum": "" }, @@ -5897,6 +5898,11 @@ "MIT" ], "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + }, { "name": "Marijn Huizendveld", "email": "marijn.huizendveld@gmail.com" @@ -5904,11 +5910,6 @@ { "name": "Thibaud Fabre", "email": "thibaud@aztech.io" - }, - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" } ], "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", @@ -7404,6 +7405,7 @@ "i18n", "text" ], + "abandoned": true, "time": "2016-10-25T17:34:14+00:00" }, { @@ -7520,12 +7522,12 @@ "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, @@ -8359,6 +8361,7 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2016-11-15T14:06:22+00:00" }, { @@ -8891,7 +8894,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.5.9", + "php": ">=7.0 <7.1", "ext-intl": "*" }, "platform-dev": [] diff --git a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php index bc26925259..133c7459a7 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php +++ b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php @@ -48,8 +48,18 @@ class TranslationDumper extends Command ->setScanDirs([ $this->container['root.path'].'/lib', $this->container['root.path'].'/templates', - $this->container['root.path'].'/bin', +// $this->container['root.path'].'/bin', $this->container['root.path'].'/www', +// $this->container['root.path'].'/Phraseanet-production-client/src', + $this->container['root.path'].'/Phraseanet-production-client/templates', + ]) + ->setExcludedDirs([ + $this->container['root.path'].'/lib/conf.d', + $this->container['root.path'].'/www/assets', + $this->container['root.path'].'/www/custom', + $this->container['root.path'].'/www/include', + $this->container['root.path'].'/www/plugins', + $this->container['root.path'].'/www/thumbnails', ]) ; if ($input->hasParameterOption('--keep') || $input->hasParameterOption('--keep=true')) { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php b/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php index b94176945c..27fa1599ec 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/SearchEngineController.php @@ -11,13 +11,14 @@ namespace Alchemy\Phrasea\Controller\Admin; use Alchemy\Phrasea\Controller\Controller; -use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchSettingsFormType; use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions; +use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchSettingsFormType; use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; +use databox_descriptionStructure; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use databox_descriptionStructure; +use Symfony\Component\Translation\TranslatorInterface; class SearchEngineController extends Controller { @@ -112,7 +113,7 @@ class SearchEngineController extends Controller /** @var GlobalStructure $g */ $g = $this->app['search_engine.global_structure']; - return $this->app->form(new ElasticsearchSettingsFormType($g, $options), $options, [ + return $this->app->form(new ElasticsearchSettingsFormType($g, $options, $this->getTranslator()), $options, [ 'action' => $this->app->url('admin_searchengine_form'), ]); } @@ -140,4 +141,12 @@ class SearchEngineController extends Controller 'response' => $indexer->getSettings(['index' => $index]) ]); } + + /** + * @return TranslatorInterface + */ + private function getTranslator() + { + return $this->app['translator']; + } } diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 621ec8feb6..441de2834d 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -3020,16 +3020,12 @@ class V1Controller extends Controller $ret = [ 'success' => true ]; } catch (AccountException $exception) { - /** @Ignore */ - $ret = [ 'success' => false, 'message' => $this->app->trans($exception->getMessage()) ]; + $ret = [ 'success' => false, 'message' => $exception->getMessage() ]; } return Result::create($request, $ret)->createResponse(); } - /** - * @Ignore - */ public function updateCurrentUserPasswordAction(Request $request) { $service = $this->getAccountService(); @@ -3047,8 +3043,8 @@ class V1Controller extends Controller $service->updatePassword($command, null); $ret = ['success' => true]; } catch (AccountException $exception) { - /** @Ignore */ - $ret = [ 'success' => false, 'message' => $this->app->trans($exception->getMessage()) ]; + + $ret = [ 'success' => false, 'message' => $exception->getMessage() ]; } } else { $ret = [ 'success' => false, 'message' => (string) $form->getErrorsAsString() ]; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php index 792fee26a0..4ca7c3bf0f 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php @@ -9,20 +9,15 @@ */ namespace Alchemy\Phrasea\Controller\Prod; -use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application\Helper\SearchEngineAware; -use Alchemy\Phrasea\Cache\Exception; use Alchemy\Phrasea\Collection\Reference\CollectionReference; use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Core\Configuration\DisplaySettingService; use Alchemy\Phrasea\Model\Entities\ElasticsearchRecord; +use Alchemy\Phrasea\SearchEngine\Elastic\ElasticSearchEngine; use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions; use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContextFactory; -use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Structure; -use Alchemy\Phrasea\SearchEngine\Elastic\ElasticSearchEngine; -use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; -use Alchemy\Phrasea\SearchEngine\SearchEngineResult; use Alchemy\Phrasea\Utilities\StringHelper; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -358,10 +353,10 @@ class QueryController extends Controller $fieldsInfosByName = []; foreach(ElasticsearchOptions::getAggregableTechnicalFields() as $k => $f) { $fieldsInfosByName[$k] = $f; - $fieldsInfosByName[$k]['trans_label'] = $this->app->trans($f['label']); + $fieldsInfosByName[$k]['trans_label'] = $this->app->trans( /** @ignore */ $f['label']); $fieldsInfosByName[$k]['labels'] = []; foreach($this->app->getAvailableLanguages() as $locale => $lng) { - $fieldsInfosByName[$k]['labels'][$locale] = $this->app->trans($f['label'], [], "messages", $locale); + $fieldsInfosByName[$k]['labels'][$locale] = $this->app->trans( /** @ignore */ $f['label'], [], "messages", $locale); } } diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php index e378a7c9e1..21a606d51e 100644 --- a/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php +++ b/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php @@ -46,12 +46,12 @@ class ExecutablesFormType extends AbstractType ]); $imagineDoc = 'http://imagine.readthedocs.org/en/latest/usage/introduction.html'; - $help = $this->translator->trans('See documentation at %url%', ['%url%' => $imagineDoc]); $builder->add('imagine-driver', 'choice', [ - 'label' => 'Imagine driver', - 'help_message' => $help, - 'choices' => ['' => 'Auto', 'gmagick' => 'GraphicsMagick', 'imagick' => 'ImageMagick', 'gd' => 'GD'] + 'label' => $this->translator->trans('Imagine driver'), + 'help_message' => /** @Ignore */ $this->translator->trans('See documentation at %url%', ['%url%' => $imagineDoc]), + 'choices' => ['' => 'Auto', 'gmagick' => 'GraphicsMagick', 'imagick' => 'ImageMagick', 'gd' => 'GD'], + 'translation_domain' => false ]); $builder->add('ffmpeg-threads', 'integer', [ diff --git a/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php index e42a71866b..f9267d4656 100644 --- a/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php +++ b/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php @@ -35,11 +35,10 @@ class WebservicesFormType extends AbstractType 'label' => 'Geonames server address', ]); - $help = $this->translator->trans('See documentation at %url%', ['%url%' => $recaptchaDoc]); - $builder->add('captchas-enabled', 'checkbox', [ 'label' => 'Use recaptcha API', - 'help_message' => $help + 'help_message' => /** @Ignore */ $this->translator->trans('See documentation at %url%', ['%url%' => $recaptchaDoc]), + 'translation_domain' => false ]); $builder->add('recaptcha-public-key', 'text', [ 'label' => 'Recaptcha public key', diff --git a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php index 097282a2cb..5cf018c450 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php @@ -45,7 +45,7 @@ class BasketRepository extends EntityRepository private function trans($id, $parameters = [], $domain = null, $locale = null) { if ($this->translator) { - return $this->translator->trans($id, $parameters, $domain, $locale); + return $this->translator->trans( /** @Ignore */ $id, $parameters, $domain, $locale); } return $id; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php index 1f2fa3d1e2..8c2a0592d1 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchSettingsFormType.php @@ -13,6 +13,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; @@ -24,7 +25,9 @@ class ElasticsearchSettingsFormType extends AbstractType /** @var ElasticsearchOptions */ private $esSettings; - public function __construct(GlobalStructure $g, ElasticsearchOptions $settings) + private $translator; + + public function __construct(GlobalStructure $g, ElasticsearchOptions $settings, TranslatorInterface $translator) { $this->globalStructure = $g; $this->esSettings = $settings; @@ -107,14 +110,15 @@ class ElasticsearchSettingsFormType extends AbstractType } $choices = array_merge(["not aggregated" => 0], $choices); // add this option always as first choice $aggs[$k] = [ // default value will be replaced by hardcoded tech fields & all databoxes fields - 'label' => $label, + 'label' => /** @Ignore */ $label, 'choices_as_values' => true, 'choices' => $choices, 'attr' => [ 'class' => 'aggregate' ], 'disabled' => $disabled, - 'help_message' => $help // todo : not displayed ? + 'help_message' => /** @Ignore */ $this->translator->trans($help), // todo : not displayed ? + 'translation_domain' => false ]; }; diff --git a/templates/web/account/sessions.html.twig b/templates/web/account/sessions.html.twig index c9ca9f1bfc..3cdd19d906 100644 --- a/templates/web/account/sessions.html.twig +++ b/templates/web/account/sessions.html.twig @@ -12,7 +12,10 @@
{% set end_activity = "End Activity"|trans %} {% set button = ' '~end_activity~' '|raw %} -  {% trans with {'%button%': button}%}If you notice any unfamiliar devices or locations, click on button %button% to end the session.{% endtrans %} +   + + {{ "If you notice any unfamiliar devices or locations, click on button %button% to end the session." | trans({'%button%': button}) }} +
@@ -38,7 +41,7 @@
{% if app['session'].get('session_id') != row.Id() %} - {% trans %}End Activity{% endtrans %} + {{ "End Activity" | trans() }} {% else %} {{ 'Current session' | trans }} {% endif %} @@ -66,14 +69,14 @@ diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index b438339345..3fd75a85b1 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -152,7 +152,7 @@ {% set beginning_link = '' %} {% set end_link = '' %} - {% trans with {'%beginning_link%' : beginning_link, '%end_link%' : end_link} %}By checking this box, you accept %beginning_link% Terms of Use %end_link%{% endtrans %} + {{ "By checking this box, you accept %beginning_link% Terms of Use %end_link%" | trans({'%beginning_link%' : beginning_link, '%end_link%' : end_link}) }} {% endif %} @@ -182,7 +182,7 @@ {% if my_email != '' %} {% else %} {% endif %} @@ -260,16 +260,16 @@
{% set docs_orderable = values.available %} {% if docs_orderable <= 1 %} - {% trans %}Un document commande{% endtrans %} + {{ "Un document commande" | trans() }} {% else %} - {% trans with {'%docs_orderable%' : docs_orderable} %}%docs_orderable% documents commandes{% endtrans %} + {{ "%docs_orderable% documents commandes" | trans({'%docs_orderable%' : docs_orderable}) }} {% endif %} {% set docs_not_orderable = values.total - values.available %} {% if docs_not_orderable > 0%} {% if docs_not_orderable == 1 %} - {% trans %}Un document ne peut etre commande{% endtrans %} + {{ "Un document ne peut etre commande" | trans() }} {% else %} - {% trans with {'%docs_not_orderable%' : docs_not_orderable} %}%docs_not_orderable% documents ne peuvent pas etre commandes{% endtrans %} + {{ "%docs_not_orderable% documents ne peuvent pas etre commandes" | trans({'%docs_not_orderable%' : docs_not_orderable}) }} {% endif %} {% endif %} {% if values.refused|length > 0 %} @@ -393,7 +393,7 @@ {% set beginning_link = '' %} {% set end_link = '' %} - {% trans with {'%beginning_link%' : beginning_link, '%end_link%' : end_link} %}By checking this box, you accept %beginning_link% Terms of Use %end_link%{% endtrans %} + {{ "By checking this box, you accept %beginning_link% Terms of Use %end_link%" | trans({'%beginning_link%' : beginning_link, '%end_link%' : end_link}) }}
{% endif %} @@ -474,7 +474,7 @@ {% set beginning_link = '' %} {% set end_link = '' %} - {% trans with {'%beginning_link%' : beginning_link, '%end_link%' : end_link} %}By checking this box, you accept %beginning_link% Terms of Use %end_link%{% endtrans %} + {{ "By checking this box, you accept %beginning_link% Terms of Use %end_link%" | trans({'%beginning_link%' : beginning_link, '%end_link%' : end_link}) }} {% endif %} diff --git a/templates/web/common/password_strength_widget.html.twig b/templates/web/common/password_strength_widget.html.twig index bc32bc4631..22286c4c1e 100644 --- a/templates/web/common/password_strength_widget.html.twig +++ b/templates/web/common/password_strength_widget.html.twig @@ -1,6 +1,6 @@ - +
{% trans %}Security{% endtrans %}{{ "Security" | trans }}
diff --git a/templates/web/prod/WorkZone/Browser/Results.html.twig b/templates/web/prod/WorkZone/Browser/Results.html.twig index ee9f1f5d18..cf70c416fd 100644 --- a/templates/web/prod/WorkZone/Browser/Results.html.twig +++ b/templates/web/prod/WorkZone/Browser/Results.html.twig @@ -9,7 +9,7 @@ {% elseif Total == 1 %} {{ '1 result' | trans }} {% else %} - {% trans with {'%Total%' : Total} %}%Total% results{% endtrans %} + {{ "%Total% results" | trans({'%Total%' : Total}) }} {% endif %}