diff options
| author | 2018-03-04 14:41:40 +0100 | |
|---|---|---|
| committer | 2018-03-04 14:41:40 +0100 | |
| commit | 67c173f79b011224c28ee7296484db065b2cd87a (patch) | |
| tree | f38496ca3c7f920d1534dc5ea1ebce27945f796b /cli/manipulate.translation.php | |
| parent | 29dc711b7b53e73eb9325da217cef8affbd3c11b (diff) | |
Add new tools to manipulate translations (#1818)
I've added a tool to add a new translation for a specific key and language.
I've added a tool to format the i18n files.
This is one of the steps to improve the translation process.
Diffstat (limited to 'cli/manipulate.translation.php')
| -rw-r--r-- | cli/manipulate.translation.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php index aace5723a..0e06993ef 100644 --- a/cli/manipulate.translation.php +++ b/cli/manipulate.translation.php @@ -6,7 +6,7 @@ if (array_key_exists('h', $options)) { help(); } -if (1 === $argc || 4 < $argc) { +if (1 === $argc || 5 < $argc) { help(); } @@ -25,12 +25,21 @@ switch ($argv[1]) { } $i18nData->addKey($argv[2], $argv[3]); break; + case 'add_value': + if (4 === $argc) { + help(); + } + $i18nData->addValue($argv[2], $argv[3], $argv[4]); + break; case 'duplicate_key' : $i18nData->duplicateKey($argv[2]); break; case 'delete_key' : $i18nData->removeKey($argv[2]); break; + case 'format' : + $i18nFile->dump($i18nData); + break; default : help(); } @@ -48,7 +57,7 @@ NAME %s SYNOPSIS - php %s [OPTION] [OPERATION] [KEY] [VALUE] + php %s [OPTION] [OPERATION] [KEY] [VALUE] [LANGUAGE] DESCRIPTION Manipulate translation files. Available operations are @@ -64,6 +73,10 @@ OPERATION add_key add a new key in the referential. This operation needs a KEY and a VALUE. + add_value + add a value in the referential. This operation needs a KEY, a + VALUE, and a LANGUAGE. + duplicate_key duplicate a referential key in other languages. This operation needs only a KEY. @@ -72,6 +85,8 @@ OPERATION delete a referential key from all languages. This operation needs only a KEY. + format format i18n files. + HELP; $file = str_replace(__DIR__ . '/', '', __FILE__); echo sprintf($help, $file, $file); |
