diff options
| author | 2020-06-05 20:16:04 +0200 | |
|---|---|---|
| committer | 2020-06-05 20:16:04 +0200 | |
| commit | 8c4d71da2ef1366c8fcd3e7dfb7f4566d2f905f4 (patch) | |
| tree | 91c820081a54f8f4fd8f5832a02c4f5e83fc6cde /cli/manipulate.translation.php | |
| parent | 36bda2e715ed822cc495ff419ad565084e241f43 (diff) | |
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
Diffstat (limited to 'cli/manipulate.translation.php')
| -rw-r--r-- | cli/manipulate.translation.php | 20 |
1 files changed, 18 insertions, 2 deletions
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); |
