From f4da01294023146cd1f4bc13f1ba5f77702bb41b Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 11 Mar 2018 10:53:32 +0100 Subject: Add option to ignore keys in cli tool --- cli/manipulate.translation.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'cli/manipulate.translation.php') diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php index 19b229878..35405bb89 100644 --- a/cli/manipulate.translation.php +++ b/cli/manipulate.translation.php @@ -1,6 +1,6 @@ load(); switch ($options['a']) { @@ -44,6 +48,13 @@ switch ($options['a']) { case 'format' : $i18nFile->dump($i18nData); break; + case 'ignore' : + if (array_key_exists('l', $options) && array_key_exists('k', $options)) { + $i18nData->ignore($options['k'], $options['l'], array_key_exists('r', $options)); + } else { + error('You need to specify a valid set of options.'); + } + break; default : help(); } @@ -80,7 +91,7 @@ DESCRIPTION -a=ACTION select the action to perform. Available actions are add, delete, - duplicate, and format. This option is mandatory. + duplicate, format, and ignore. This option is mandatory. -k=KEY select the key to work on. -v=VAL select the value to set. -l=LANG select the language to work on. @@ -105,6 +116,11 @@ Exemple 5: duplicate a key. It duplicates the key from the referential in every Exemple 6: format i18n files. php %1\$s -a format +Exemple 7: ignore a key. It adds the key in the ignore file to mark it as translated. + php %1\$s -a ignore -k my_key -l my_lang + +Exemple 8: revert ignore a key. It removes the key from the ignore file. + php %1\$s -a ignore -r -k my_key -l my_lang\n\n HELP; $file = str_replace(__DIR__ . '/', '', __FILE__); echo sprintf($help, $file); -- cgit v1.2.3