From baaef3d9f4bdc81224620ab2f6b92575dcf81a59 Mon Sep 17 00:00:00 2001 From: Ed Sandor <1273949+ewsandor@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:59:27 -0600 Subject: 3041 en us localization (#3060) * Initial locaization from international english to United States English examples: favourite -> favorite optimise -> optimize occured -> occurred labelled -> labelled ok -> okay * More spelling corrections default English occured->occurred cancelled -> canceled labelled -> labeled * Undo key spelling change * i18n format and admin.php translating * Translating admin.php * more admin.php translating * Translating conf.php * Translating feedback.php and format command * Translating gen.php * Translating index.php * Translating sub.php * Translating user.php * Translating install.php * Fix 'there is no idle feed' * FIx 'there is no feed to refresh" * Add i18n manipulation option to ignore all unmodified translation keys * Lint fixes * Update keys newly add since original branch * Revert unintenntional ru 'translation' * Code review revisions * Fix leading whitespace in ignore_unmodified api * Update app/i18n/en-us/gen.php Co-authored-by: Frans de Jonge * Update app/i18n/en-us/admin.php Co-authored-by: Frans de Jonge * Update app/i18n/en-us/admin.php Co-authored-by: Frans de Jonge * Update error message for Make ignore-unmodified keys to use Make syntax. (inline with 3062) Also rename ignore-unmodifed-key -> ignore-unmodified-keys * Replace makefile leading spaces with tabs * Code review revisions * Retab added php functions * Missed tab replace * Remove stray '-> todo' Co-authored-by: root Co-authored-by: Frans de Jonge --- cli/i18n/I18nData.php | 19 ++ cli/i18n/ignore/cz.php | 1 + cli/i18n/ignore/de.php | 1 + cli/i18n/ignore/en-us.php | 686 +++++++++++++++++++++++++++++++++++++++++ cli/i18n/ignore/es.php | 1 + cli/i18n/ignore/fr.php | 1 + cli/i18n/ignore/he.php | 5 + cli/i18n/ignore/it.php | 1 + cli/i18n/ignore/kr.php | 1 + cli/i18n/ignore/nl.php | 1 + cli/i18n/ignore/oc.php | 1 + cli/i18n/ignore/pt-br.php | 1 + cli/i18n/ignore/ru.php | 1 + cli/i18n/ignore/sk.php | 1 + cli/i18n/ignore/tr.php | 1 + cli/i18n/ignore/zh-cn.php | 1 + cli/manipulate.translation.php | 17 +- 17 files changed, 739 insertions(+), 1 deletion(-) create mode 100644 cli/i18n/ignore/en-us.php create mode 100644 cli/i18n/ignore/he.php (limited to 'cli') diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index 5071c9be9..73a731245 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -229,6 +229,25 @@ class I18nData { $this->ignore[$language][] = $key; } + /** + *Ignore all unmodified keys from a language, or reverse it. + * + * @param string $language + * @param boolean $reverse + */ + public function ignore_unmodified($language, $reverse = false) { + $my_language = $this->getLanguage($language); + foreach ($this->getReferenceLanguage() as $file => $ref_language) { + foreach ($ref_language as $key => $ref_value) { + if (array_key_exists($key, $my_language[$file])) { + if($ref_value == $my_language[$file][$key]) { + $this->ignore($key, $language, $reverse); + } + } + } + } + } + public function getLanguage($language) { return $this->data[$language]; } diff --git a/cli/i18n/ignore/cz.php b/cli/i18n/ignore/cz.php index 1c987d8b3..4ce908b82 100644 --- a/cli/i18n/ignore/cz.php +++ b/cli/i18n/ignore/cz.php @@ -2,4 +2,5 @@ return array( 'gen.dir', + 'gen.lang.en-us', ); diff --git a/cli/i18n/ignore/de.php b/cli/i18n/ignore/de.php index 1c987d8b3..4ce908b82 100644 --- a/cli/i18n/ignore/de.php +++ b/cli/i18n/ignore/de.php @@ -2,4 +2,5 @@ return array( 'gen.dir', + 'gen.lang.en-us', ); diff --git a/cli/i18n/ignore/en-us.php b/cli/i18n/ignore/en-us.php new file mode 100644 index 000000000..bba4be829 --- /dev/null +++ b/cli/i18n/ignore/en-us.php @@ -0,0 +1,686 @@ +ignore_unmodified($options['l'], array_key_exists('r', $options)); + } else { + error('You need to specify a valid set of options.'); + exit; + } + break; default : help(); exit; @@ -133,8 +141,15 @@ Exemple 6: ignore a key. It adds the key in the ignore file to mark it as transl Exemple 7: revert ignore a key. It removes the key from the ignore file. php %1\$s -a ignore -r -k my_key -l my_lang -Exemple 8: check if a key exist. +Exemple 8: ignore all unmodified keys. It adds all modified keys in the ignore file to mark it as translated. + php %1\$s -a ignore_unmodified -l my_lang + +Exemple 9: revert ignore of all unmodified keys. It removes the unmodified keys from the ignore file. Warning, this will also revert keys added individually. + php %1\$s -a ignore_unmodified -r -l my_lang + +Exemple 10: check if a key exist. php %1\$s -a exist -k my_key\n\n + HELP; $file = str_replace(__DIR__ . '/', '', __FILE__); echo sprintf($help, $file); -- cgit v1.2.3