aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nData.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2018-03-11 10:53:32 +0100
committerGravatar Alexis Degrugillier <github@ainw.org> 2018-03-11 10:53:32 +0100
commitf4da01294023146cd1f4bc13f1ba5f77702bb41b (patch)
treefa865d9277bea7cca4964fcf861a7cece08455ac /cli/i18n/I18nData.php
parent2f98978f6def423c46fe668b57107b3019b7a744 (diff)
Add option to ignore keys in cli tool
Diffstat (limited to 'cli/i18n/I18nData.php')
-rw-r--r--cli/i18n/I18nData.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php
index 77e0e2993..2178d330d 100644
--- a/cli/i18n/I18nData.php
+++ b/cli/i18n/I18nData.php
@@ -117,6 +117,30 @@ class I18nData {
}
/**
+ * WARNING! This is valid only for ignore files. It's not the best way to
+ * handle that but as it's meant to be used only for the cli tool, there
+ * is no point of spending time on making it better than that.
+ *
+ * Ignore a key from a language, or reverse it.
+ *
+ * @param string $key
+ * @param string $language
+ * @param boolean $reverse
+ */
+ public function ignore($key, $language, $reverse = false) {
+ $index = array_search($key, $this->data[$language]);
+
+ if ($index && $reverse) {
+ unset($this->data[$language][$index]);
+ return;
+ }
+ if ($index && !$reverse) {
+ return;
+ }
+ $this->data[$language][] = $key;
+ }
+
+ /**
* Check if the data has changed
*
* @return bool