From 8c4d71da2ef1366c8fcd3e7dfb7f4566d2f905f4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Jun 2020 20:16:04 +0200 Subject: Add missing translations (#3034) * Add missing translations * Add a simple way to check if an i18n key exists There is a rule in the makefile to access it directly --- cli/manipulate.translation.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'cli/manipulate.translation.php') diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php index c6aa328d9..c1f1132b4 100644 --- a/cli/manipulate.translation.php +++ b/cli/manipulate.translation.php @@ -39,6 +39,19 @@ switch ($options['a']) { exit; } break; + case 'exist': + if (array_key_exists('k', $options)) { + $key = $options['k']; + if ($i18nData->isKnown($key)) { + echo "The '{$key}' key is known.\n\n"; + } else { + echo "The '{$key}' key is unknown.\n\n"; + } + } else { + error('You need to specify the key to check.'); + exit; + } + break; case 'format' : break; case 'ignore' : @@ -85,7 +98,7 @@ DESCRIPTION -a=ACTION select the action to perform. Available actions are add, delete, - format, and ignore. This option is mandatory. + exist, 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. @@ -111,7 +124,10 @@ Exemple 6: ignore a key. It adds the key in the ignore file to mark it as transl php %1\$s -a ignore -k my_key -l my_lang 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\n\n + php %1\$s -a ignore -r -k my_key -l my_lang + +Exemple 8: 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