PHRAS-3425_fix-translation-dump_MASTER

fix : bump patched jms/translation-bundle (forked)
fix : all errors ; most warnings
This commit is contained in:
jygaulier
2021-04-21 15:02:39 +02:00
parent 9beca04cc7
commit fff3f284bb
14 changed files with 84 additions and 65 deletions

View File

@@ -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",

37
composer.lock generated
View File

@@ -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": []

View File

@@ -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')) {

View File

@@ -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'];
}
}

View File

@@ -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() ];

View File

@@ -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);
}
}

View File

@@ -46,12 +46,12 @@ class ExecutablesFormType extends AbstractType
]);
$imagineDoc = '<a href="http://imagine.readthedocs.org/en/latest/usage/introduction.html">http://imagine.readthedocs.org/en/latest/usage/introduction.html</a>';
$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', [

View File

@@ -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',

View File

@@ -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;

View File

@@ -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
];
};

View File

@@ -12,7 +12,10 @@
<div class="well well-small" style="background: steelblue; border: 1px solid #333;">
{% set end_activity = "End Activity"|trans %}
{% set button = '&nbsp;<a href="#" class="btn btn-inverse btn-small" style="box-shadow:none">'~end_activity~'</a>&nbsp;'|raw %}
<i class="icon icon-warning-sign"></i>&nbsp;<b style="font-size: 12px;">{% trans with {'%button%': button}%}If you notice any unfamiliar devices or locations, click on button %button% to end the session.{% endtrans %}</b>
<i class="icon icon-warning-sign"></i>&nbsp;
<b style="font-size: 12px;">
{{ "If you notice any unfamiliar devices or locations, click on button %button% to end the session." | trans({'%button%': button}) }}
</b>
</div>
<table class="table table-striped table-bordered" style="border-color: #333333">
<thead>
@@ -38,7 +41,7 @@
<tr id="row-{{ row.Id() }}" >
<td style="border-color: #333333;text-align: center">
{% if app['session'].get('session_id') != row.Id() %}
<a href="{{ path('delete_session', {"id": row.Id()}) }}" title="{% trans %}End Activity{% endtrans %}" class="btn btn-inverse btn-small input-block-level delete-session">{% trans %}End Activity{% endtrans %}</a>
<a href="{{ path('delete_session', {"id": row.Id()}) }}" title="{{ "End Activity" | trans() }}" class="btn btn-inverse btn-small input-block-level delete-session">{{ "End Activity" | trans() }}</a>
{% else %}
<span style="color:darkseagreen;font-weight: bold">{{ 'Current session' | trans }}</span>
{% endif %}
@@ -66,14 +69,14 @@
<div id="modal-delete-confirm" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>{% trans %}End session activity{% endtrans %}</h3>
<h3>{{ "End session activity" | trans }}</h3>
</div>
<div class="modal-body">
<p>{% trans %}Do you really want to end the activity of this session?{% endtrans %}</p>
<p>{{ "Do you really want to end the activity of this session?" | trans }}</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">{% trans %}no{% endtrans %}</button>
<a href="#" class="btn btn-info confirm-delete">{% trans %}yes{% endtrans %}</a>
<button class="btn" data-dismiss="modal">{{ "no" | trans }}</button>
<a href="#" class="btn btn-info confirm-delete">{{ "yes" | trans }}</a>
</div>
</div>

View File

@@ -152,7 +152,7 @@
<input type="checkbox" name="TOU_accept" id="TOU_acceptDL" value="1" />
{% set beginning_link = '<a href="' ~ path('get_tou') ~ '" class="TOUview">' %}
{% set end_link = '</a>' %}
{% 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}) }}
</label>
</div>
{% endif %}
@@ -182,7 +182,7 @@
{% if my_email != '' %}
<label class="checkbox">
<input type="checkbox" name="reading_confirm" value="1" />
{% trans with {'%my_email%' : my_email} %}Recevoir un accuse de reception a %my_email%{% endtrans %}
{{ "Recevoir un accuse de reception a %my_email%" | trans({'%my_email%' : my_email}) }}
</label>
{% else %}
<label class="checkbox">
@@ -240,7 +240,7 @@
<input type="checkbox" name="TOU_accept" id="TOU_acceptMail" value="1" />
{% set beginning_link = '<a href="' ~ path('get_tou') ~ '" class="TOUview">' %}
{% set end_link = '</a>' %}
{% 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}) }}
</label>
</div>
{% endif %}
@@ -260,16 +260,16 @@
<div class='well-small'>
{% 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 @@
<input type="checkbox" name="TOU_accept" id="TOU_acceptOrder" value="1" />
{% set beginning_link = '<a href="' ~ path('get_tou') ~ '" class="TOUview">' %}
{% set end_link = '</a>' %}
{% 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}) }}
</label>
</div>
{% endif %}
@@ -474,7 +474,7 @@
<input type="checkbox" name="TOU_accept" id="TOU_acceptFTP" value="1" />
{% set beginning_link = '<a href="' ~ path('get_tou') ~ '" class="TOUview">' %}
{% set end_link = '</a>' %}
{% 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}) }}
</label>
</div>
{% endif %}

View File

@@ -1,6 +1,6 @@
<table class="password_strength_widget">
<tr>
<td class="password_strength_label">{% trans %}Security{% endtrans %}</td>
<td class="password_strength_label">{{ "Security" | trans }}</td>
<td>
<div class="password_strength_container">
<div class="password_strength_bg"></div>

View File

@@ -9,7 +9,7 @@
{% elseif Total == 1 %}
{{ '1 result' | trans }}
{% else %}
{% trans with {'%Total%' : Total} %}%Total% results{% endtrans %}
{{ "%Total% results" | trans({'%Total%' : Total}) }}
{% endif %}
</td>
</tr>