Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2019-01-21 18:44:35 +0300
committerGitHub <noreply@github.com>2019-01-21 18:44:35 +0300
commit7395c84d061505e5f05abf60cb6773d00cc650bf (patch)
tree29bba493753f017fca04a498f807b265f688a798 /plugins/LanguagesManager
parent892e6f175965b5d56df2f5546e1adf5a417f325a (diff)
Improve/Fix translation commands (#13982)
Diffstat (limited to 'plugins/LanguagesManager')
-rw-r--r--plugins/LanguagesManager/Commands/SetTranslations.php2
-rw-r--r--plugins/LanguagesManager/Commands/Update.php19
-rw-r--r--plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php4
3 files changed, 22 insertions, 3 deletions
diff --git a/plugins/LanguagesManager/Commands/SetTranslations.php b/plugins/LanguagesManager/Commands/SetTranslations.php
index 540471ce59..beec434a31 100644
--- a/plugins/LanguagesManager/Commands/SetTranslations.php
+++ b/plugins/LanguagesManager/Commands/SetTranslations.php
@@ -42,7 +42,7 @@ class SetTranslations extends TranslationBase
$languageCode = $input->getOption('code');
$filename = $input->getOption('file');
- $languageCodes = API::getInstance()->getAvailableLanguages();
+ $languageCodes = (new API())->getAvailableLanguages();
if (empty($languageCode) || !in_array($languageCode, $languageCodes)) {
$languageCode = $dialog->askAndValidate($output, 'Please provide a valid language code: ', function ($code) use ($languageCodes) {
diff --git a/plugins/LanguagesManager/Commands/Update.php b/plugins/LanguagesManager/Commands/Update.php
index a4a664b455..cfe0472b31 100644
--- a/plugins/LanguagesManager/Commands/Update.php
+++ b/plugins/LanguagesManager/Commands/Update.php
@@ -9,6 +9,7 @@
namespace Piwik\Plugins\LanguagesManager\Commands;
+use Piwik\Cache;
use Piwik\Plugin\Manager;
use Piwik\Plugins\LanguagesManager\API;
use Symfony\Component\Console\Helper\DialogHelper;
@@ -109,7 +110,21 @@ class Update extends TranslationBase
}
@touch(PIWIK_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $code . '.json');
- API::unsetInstance(); // unset language manager instance, so valid names are refetched
+ API::unsetAllInstances(); // unset language manager instance, so valid names are refetched
+
+ $command = $this->getApplication()->find('translations:generate-intl-data');
+ $arguments = array(
+ 'command' => 'translations:generate-intl-data',
+ '--language' => $code,
+ );
+ $inputObject = new ArrayInput($arguments);
+ $inputObject->setInteractive($input->isInteractive());
+ $command->run($inputObject, $output->isVeryVerbose() ? $output : new NullOutput());
+
+ API::unsetAllInstances(); // unset language manager instance, so valid names are refetched
+ Cache::flushAll();
+
+ $languageCodes[] = $code;
}
$command = $this->getApplication()->find('translations:set');
@@ -121,7 +136,7 @@ class Update extends TranslationBase
);
$inputObject = new ArrayInput($arguments);
$inputObject->setInteractive($input->isInteractive());
- $command->run($inputObject, new NullOutput());
+ $command->run($inputObject, $output->isVeryVerbose() ? $output : new NullOutput());
}
$progress->finish();
diff --git a/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php b/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php
index bcdfc66974..c089c30eb0 100644
--- a/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php
+++ b/plugins/LanguagesManager/TranslationWriter/Validate/CoreTranslations.php
@@ -68,6 +68,10 @@ class CoreTranslations extends ValidateAbstract
$allLanguages = $languageDataProvider->getLanguageList();
$allCountries = $regionDataProvider->getCountryList();
+ if ('eo.UTF-8' === $translations['General']['Locale']) {
+ return true;
+ }
+
if (!preg_match('/^([a-z]{2})_([A-Z]{2})\.UTF-8$/', $translations['General']['Locale'], $matches)) {
$this->message = self::ERRORSTATE_LOCALEINVALID;
return false;