diff options
| author | 2020-06-22 13:24:55 +0200 | |
|---|---|---|
| committer | 2020-06-22 13:24:55 +0200 | |
| commit | d7d39f07368379e7ef1619e52cc50c0920ce8351 (patch) | |
| tree | edd4235ab248d284afdcd826d391647c8d62e3f8 /cli | |
| parent | 051f1649f705dd77febd39c8f4a53c97f4c1115f (diff) | |
Change how updating a key works (#3072)
Before, to update a key from the reference language (en), the key was deleted
then created. This way was unproductive for all keys already translated.
Now, the key is updated in all untranslated languages.
See https://github.com/FreshRSS/FreshRSS/pull/3068#issuecomment-646868894
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/i18n/I18nData.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index 73a731245..62dd85b29 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -182,7 +182,16 @@ class I18nData { !array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { throw new Exception('The selected key does not exist for the selected language.'); } - $this->data[$language][$this->getFilenamePrefix($key)][$key] = $value; + if (static::REFERENCE_LANGUAGE === $language) { + $previousValue = $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)][$key]; + foreach ($this->getAvailableLanguages() as $lang) { + if ($this->data[$lang][$this->getFilenamePrefix($key)][$key] === $previousValue) { + $this->data[$lang][$this->getFilenamePrefix($key)][$key] = $value; + } + } + } else { + $this->data[$language][$this->getFilenamePrefix($key)][$key] = $value; + } } /** |
