diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php
index 9a2553ceb3..dfd2372705 100644
--- a/lib/Alchemy/Phrasea/Application.php
+++ b/lib/Alchemy/Phrasea/Application.php
@@ -711,7 +711,7 @@ class Application extends SilexApplication
/**
* Return available language for phraseanet
*
- * @return Array
+ * @return array
*/
public static function getAvailableLanguages()
{
diff --git a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php
index 7c7c1d59c3..bc26925259 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php
@@ -12,8 +12,14 @@
namespace Alchemy\Phrasea\Command\Developer;
use Alchemy\Phrasea\Command\Command;
+use JMS\TranslationBundle\Logger\OutputLogger;
+use JMS\TranslationBundle\Model\Message;
+use JMS\TranslationBundle\Translation\Comparison\ChangeSet;
use JMS\TranslationBundle\Translation\ConfigBuilder;
+use JMS\TranslationBundle\Translation\Updater;
+use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class TranslationDumper extends Command
@@ -21,31 +27,99 @@ class TranslationDumper extends Command
public function __construct()
{
parent::__construct('translation:dump');
-
- $this->setDescription('Dump translation files');
}
- /**
- * {@inheritdoc}
- */
+ protected function configure()
+ {
+ $this->setDescription('Dump translation files');
+ $this
+ ->addArgument('locales', InputArgument::IS_ARRAY, 'The locales for which to extract messages.')
+ ->addOption('dry-run', null, InputOption::VALUE_NONE, 'When specified, changes are _NOT_ persisted to disk.')
+ ->addOption('keep', null, InputOption::VALUE_NONE, 'Define if the updater service should keep the old translation (defaults to false).')
+ ;
+ }
+
protected function doExecute(InputInterface $input, OutputInterface $output)
{
- foreach (array_keys($this->container->getAvailableLanguages()) as $code) {
- $builder = new ConfigBuilder();
- $config = $builder->setLocale($code)
- ->setOutputFormat('xlf')
- ->setTranslationsDir(__DIR__ . '/../../../../../resources/locales')
- ->setScanDirs([
- $this->container['root.path'].'/lib',
- $this->container['root.path'].'/templates',
- $this->container['root.path'].'/bin',
- $this->container['root.path'].'/www',
- ])
- ->getConfig();
-
- $this->container['translation-extractor.updater']->process($config);
+ $builder = new ConfigBuilder();
+ $builder
+ ->setOutputFormat('xlf')
+ ->setTranslationsDir(__DIR__ . '/../../../../../resources/locales')
+ ->setScanDirs([
+ $this->container['root.path'].'/lib',
+ $this->container['root.path'].'/templates',
+ $this->container['root.path'].'/bin',
+ $this->container['root.path'].'/www',
+ ])
+ ;
+ if ($input->hasParameterOption('--keep') || $input->hasParameterOption('--keep=true')) {
+ $builder->setKeepOldTranslations(true);
+ } else if ($input->hasParameterOption('--keep=false')) {
+ $builder->setKeepOldTranslations(false);
}
+ $locales = $input->getArgument('locales');
+ if (empty($locales)) {
+ $locales = array_keys($this->container->getAvailableLanguages());
+ }
+
+ if (empty($locales)) {
+ throw new \LogicException('No locales were given, and no locales are configured.');
+ }
+
+ foreach ($locales as $locale) {
+ $config = $builder->setLocale($locale)->getConfig();
+
+ $output->writeln(sprintf('Extracting Translations for locale %s', $locale));
+ $output->writeln(sprintf('Keep old translations: %s', $config->isKeepOldMessages() ? 'Yes' : 'No'));
+ $output->writeln(sprintf('Output-Path: %s', $config->getTranslationsDir()));
+ $output->writeln(sprintf('Directories: %s', implode(', ', $config->getScanDirs())));
+ $output->writeln(sprintf('Excluded Directories: %s', $config->getExcludedDirs() ? implode(', ', $config->getExcludedDirs()) : '# none #'));
+ $output->writeln(sprintf('Excluded Names: %s', $config->getExcludedNames() ? implode(', ', $config->getExcludedNames()) : '# none #'));
+ $output->writeln(sprintf('Output-Format: %s', $config->getOutputFormat() ? $config->getOutputFormat() : '# whatever is present, if nothing then '.$config->getDefaultOutputFormat().' #'));
+ $output->writeln(sprintf('Custom Extractors: %s', $config->getEnabledExtractors() ? implode(', ', array_keys($config->getEnabledExtractors())) : '# none #'));
+ $output->writeln('============================================================');
+
+ /** @var Updater $updater */
+ $updater = $this->container['translation-extractor.updater'];
+ $updater->setLogger($logger = new OutputLogger($output));
+
+ if (!$input->getOption('verbose')) {
+ $logger->setLevel(OutputLogger::ALL ^ OutputLogger::DEBUG);
+ }
+
+ if ($input->getOption('dry-run')) {
+ /** @var ChangeSet $changeSet */
+ $changeSet = $updater->getChangeSet($config);
+
+ $output->writeln('Added Messages: '.count($changeSet->getAddedMessages()));
+ if ($input->getOption('verbose')){
+ /** @var Message $message */
+ foreach($changeSet->getAddedMessages() as $message){
+ $output->writeln($message->getId(). '-> '.$message->getDesc());
+ }
+ }
+
+ if ($config->isKeepOldMessages()) {
+ $output->writeln('Deleted Messages: # none as "Keep Old Translations" is true #');
+ } else {
+ $output->writeln('Deleted Messages: '.count($changeSet->getDeletedMessages()));
+ if ($input->getOption('verbose')){
+ foreach($changeSet->getDeletedMessages() as $message){
+ $output->writeln($message->getId(). '-> '.$message->getDesc());
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ $updater->process($config);
+ }
+
+ $output->writeln('done!');
+
+
return 0;
}
}
diff --git a/resources/locales/messages.en.xlf b/resources/locales/messages.en.xlf
index e6ff154831..2a4349f0a7 100644
--- a/resources/locales/messages.en.xlf
+++ b/resources/locales/messages.en.xlf
@@ -1,6 +1,6 @@
-
+
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
@@ -1138,7 +1138,7 @@
Aucune description.
No caption
- actions/Bridge/element_list.html.twig
+ actions/Bridge/element_list.html.twig
Aucune entree pour le moment
@@ -1781,12 +1781,12 @@
Confidentialite : privee
Private
- actions/Bridge/element_list.html.twig
+ actions/Bridge/element_list.html.twig
Confidentialite : publique
Public
- actions/Bridge/element_list.html.twig
+ actions/Bridge/element_list.html.twig
Configuration
@@ -9557,7 +9557,7 @@
dans %category%
in %category%
- actions/Bridge/element_list.html.twig
+ actions/Bridge/element_list.html.twig
dans %feed_name%
@@ -12896,6 +12896,11 @@
unknown
task-manager/task-editor/subdefs.html.twig
+
+ untitled
+ untitled
+ actions/Bridge/element_list.html.twig
+
update::Votre application necessite une mise a jour vers :
Your application needs an update to :
diff --git a/resources/locales/validators.en.xlf b/resources/locales/validators.en.xlf
index 7c2ab47258..38259502e9 100644
--- a/resources/locales/validators.en.xlf
+++ b/resources/locales/validators.en.xlf
@@ -1,6 +1,6 @@
-
+
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
diff --git a/templates/web/admin/editusers.html.twig b/templates/web/admin/editusers.html.twig
index 10088fcdb6..d83b73aef4 100644
--- a/templates/web/admin/editusers.html.twig
+++ b/templates/web/admin/editusers.html.twig
@@ -1101,7 +1101,7 @@
});
});
- define([
+ require([
"jquery",
"common/geonames"
], function ($, geonames) {
diff --git a/templates/web/prod/actions/Bridge/element_list.html.twig b/templates/web/prod/actions/Bridge/element_list.html.twig
index 5fb535f521..b4ea78fa00 100644
--- a/templates/web/prod/actions/Bridge/element_list.html.twig
+++ b/templates/web/prod/actions/Bridge/element_list.html.twig
@@ -55,8 +55,7 @@
{% endif %}
- {% set no_title = "untitled" %}
- {{element.get_title|default(no_title|trans)}}
+ {{element.get_title|default('untitled'|trans)}}
{% if element.get_url != '' %}
diff --git a/www/scripts/apps/admin/require.config.js b/www/scripts/apps/admin/require.config.js
index 19c3c5e5cb..95e19c32f3 100644
--- a/www/scripts/apps/admin/require.config.js
+++ b/www/scripts/apps/admin/require.config.js
@@ -17,6 +17,7 @@ require.config({
backbone: "../assets/backbone-amd/backbone",
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
+ "jquery.geonames": "../assets/geonames-server-jquery-plugin/jquery.geonames",
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
"jquery.tooltip": "../include/jquery.tooltip",
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
@@ -37,6 +38,10 @@ require.config({
deps: ["jquery"],
exports: '$.fn.cookie'
},
+ "jquery.geonames": {
+ deps: ["jquery"],
+ exports: '$.fn.geocompleter'
+ },
"jquery.tooltip": {
deps: ["jquery"],
exports: '$.fn.tooltip'
diff --git a/www/scripts/apps/login/home/config.js b/www/scripts/apps/login/home/config.js
index c7019eecd7..dd62d757a9 100644
--- a/www/scripts/apps/login/home/config.js
+++ b/www/scripts/apps/login/home/config.js
@@ -17,7 +17,7 @@ require.config({
backbone: "../assets/backbone-amd/backbone",
i18n: "../assets/i18next/i18next.amd-1.6.3",
bootstrap: "../assets/bootstrap/js/bootstrap.min",
- multiselect: "../assets/bootstrap-multiselect/dist/js/bootstrap-multiselect",
+ multiselect: "../assets/bootstrap-multiselect/js/bootstrap-multiselect",
"jquery.geonames": "../assets/geonames-server-jquery-plugin/jquery.geonames"
},
shim: {
diff --git a/www/scripts/common/geonames.js b/www/scripts/common/geonames.js
index 7c1ae63e47..690d098244 100644
--- a/www/scripts/common/geonames.js
+++ b/www/scripts/common/geonames.js
@@ -1,7 +1,7 @@
;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
- define([''], factory);
+ define(['jquery.geonames'], factory);
} else {
root.geonames = factory();
}