A free, self-hostable news aggregator…
Change how updating a key works (#3072)
Alexis Degrugillierd7d39f073683
diff --git a/Makefile b/Makefileindex d19d40fa6..f69507270 100644--- a/Makefile+++ b/Makefile@@ -125,8 +125,7 @@ endififndef value$(error To update a key, you need to provide its value in the "value" variable)endif- @$(PHP) ./cli/manipulate.translation.php -a delete -k $(key)- @$(PHP) ./cli/manipulate.translation.php -a add -k $(key) -v "$(value)"+ @$(PHP) ./cli/manipulate.translation.php -a add -k $(key) -v "$(value)" -l en@echo Key updated..PHONY: i18n-ignore-keydiff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.phpindex 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;+ }}/**