Merge pull request #2772 from dhruvgoel92/ticket/12656

[ticket/12656] Translate existing CLI commands

* dhruvgoel92/ticket/12656:
  [ticket/12656] Fix typo for "purged extension"
  [ticket/12656] Fix syntax in language file
  [ticket/12656] Fix typo
  [ticket/12656] Use utf8 ’ instead of escaping '
  [ticket/12656] Use lang keys for all CLI strings
  [ticket/12656] Use lang keys for CLI command descriptions
This commit is contained in:
Andreas Fischer 2014-07-28 14:45:33 +02:00
commit 52e8a7231e
14 changed files with 83 additions and 49 deletions

View file

@ -35,10 +35,44 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array( $lang = array_merge($lang, array(
'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.', 'CLI_CONFIG_CANNOT_CACHED' => 'Set this option if the configuration option changes too frequently to be efficiently cached.',
'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', 'CLI_CONFIG_CURRENT' => 'Current configuration value, use 0 and 1 to specify boolean values',
'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', 'CLI_CONFIG_DELETE_SUCCESS' => 'Successfully deleted config %s.',
'CLI_CONFIG_NEW' => 'New configuration value, use 0 and 1 to specify boolean values',
'CLI_CONFIG_NOT_EXISTS' => 'Config %s does not exist',
'CLI_CONFIG_OPTION_NAME' => 'The configuration options name',
'CLI_CONFIG_PRINT_WITHOUT_NEWLINE' => 'Set this option if the value should be printed without a new line at the end.',
'CLI_CONFIG_INCREMENT_BY' => 'Amount to increment by',
'CLI_CONFIG_INCREMENT_SUCCESS' => 'Successfully incremented config %s',
'CLI_CONFIG_SET_FAILURE' => 'Could not set config %s',
'CLI_CONFIG_SET_SUCCESS' => 'Successfully set config %s',
'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.', 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.',
'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).', 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.',
'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run',
'CLI_DESCRIPTION_DB_MIGRATE' => 'Updates the database by applying migrations.',
'CLI_DESCRIPTION_DELETE_CONFIG' => 'Deletes a configuration option',
'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.',
'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.',
'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended on.',
'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration options value',
'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration options value',
'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.',
'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).',
'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.',
'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.',
'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalculates the user_email_hash column of the users table.',
'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration options value only if the old matches the current value',
'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration options value',
'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s',
'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s',
'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s',
'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s',
'CLI_EXTENSION_NAME' => 'Name of the extension',
'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',
'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.',
'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.',
)); ));

View file

@ -59,7 +59,7 @@ class purge extends \phpbb\console\command\command
{ {
$this $this
->setName('cache:purge') ->setName('cache:purge')
->setDescription('Purge the cache.') ->setDescription($this->user->lang('PURGE_CACHE'))
; ;
} }

View file

@ -25,11 +25,11 @@ class delete extends command
{ {
$this $this
->setName('config:delete') ->setName('config:delete')
->setDescription('Deletes a configuration option') ->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG'))
->addArgument( ->addArgument(
'key', 'key',
InputArgument::REQUIRED, InputArgument::REQUIRED,
"The configuration option's name" $this->user->lang('CLI_CONFIG_OPTION_NAME')
) )
; ;
} }
@ -53,11 +53,11 @@ class delete extends command
{ {
$this->config->delete($key); $this->config->delete($key);
$output->writeln("<info>Successfully deleted config $key</info>"); $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>');
} }
else else
{ {
$output->writeln("<error>Config $key does not exist</error>"); $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
} }
} }
} }

View file

@ -26,17 +26,17 @@ class get extends command
{ {
$this $this
->setName('config:get') ->setName('config:get')
->setDescription("Gets a configuration option's value") ->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG'))
->addArgument( ->addArgument(
'key', 'key',
InputArgument::REQUIRED, InputArgument::REQUIRED,
"The configuration option's name" $this->user->lang('CLI_CONFIG_OPTION_NAME')
) )
->addOption( ->addOption(
'no-newline', 'no-newline',
null, null,
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'Set this option if the value should be printed without a new line at the end.' $this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE')
) )
; ;
} }
@ -66,7 +66,7 @@ class get extends command
} }
else else
{ {
$output->writeln("<error>Could not get config $key</error>"); $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');
} }
} }
} }

View file

@ -26,22 +26,22 @@ class increment extends command
{ {
$this $this
->setName('config:increment') ->setName('config:increment')
->setDescription("Increments a configuration option's value") ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG'))
->addArgument( ->addArgument(
'key', 'key',
InputArgument::REQUIRED, InputArgument::REQUIRED,
"The configuration option's name" $this->user->lang('CLI_CONFIG_OPTION_NAME')
) )
->addArgument( ->addArgument(
'increment', 'increment',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'Amount to increment by' $this->user->lang('CLI_CONFIG_INCREMENT_BY')
) )
->addOption( ->addOption(
'dynamic', 'dynamic',
'd', 'd',
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'Set this option if the configuration option changes too frequently to be efficiently cached.' $this->user-lang('CLI_CONFIG_CANNOT_CACHED')
) )
; ;
} }
@ -65,6 +65,6 @@ class increment extends command
$this->config->increment($key, $increment, $use_cache); $this->config->increment($key, $increment, $use_cache);
$output->writeln("<info>Successfully incremented config $key</info>"); $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>');
} }
} }

View file

@ -26,22 +26,22 @@ class set extends command
{ {
$this $this
->setName('config:set') ->setName('config:set')
->setDescription("Sets a configuration option's value") ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG'))
->addArgument( ->addArgument(
'key', 'key',
InputArgument::REQUIRED, InputArgument::REQUIRED,
"The configuration option's name" $this->user->lang('CLI_CONFIG_OPTION_NAME')
) )
->addArgument( ->addArgument(
'value', 'value',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'New configuration value, use 0 and 1 to specify boolean values' $this->user->lang('CLI_CONFIG_NEW')
) )
->addOption( ->addOption(
'dynamic', 'dynamic',
'd', 'd',
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'Set this option if the configuration option changes too frequently to be efficiently cached.' $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
) )
; ;
} }
@ -65,6 +65,6 @@ class set extends command
$this->config->set($key, $value, $use_cache); $this->config->set($key, $value, $use_cache);
$output->writeln("<info>Successfully set config $key</info>"); $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
} }
} }

View file

@ -26,27 +26,27 @@ class set_atomic extends command
{ {
$this $this
->setName('config:set-atomic') ->setName('config:set-atomic')
->setDescription("Sets a configuration option's value only if the old matches the current value.") ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG'))
->addArgument( ->addArgument(
'key', 'key',
InputArgument::REQUIRED, InputArgument::REQUIRED,
"The configuration option's name" $this->user->lang('CLI_CONFIG_OPTION_NAME')
) )
->addArgument( ->addArgument(
'old', 'old',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'Current configuration value, use 0 and 1 to specify boolean values' $this->user->lang('CLI_CONFIG_CURRENT')
) )
->addArgument( ->addArgument(
'new', 'new',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'New configuration value, use 0 and 1 to specify boolean values' $this->user->lang('CLI_CONFIG_NEW')
) )
->addOption( ->addOption(
'dynamic', 'dynamic',
'd', 'd',
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'Set this option if the configuration option changes too frequently to be efficiently cached.' $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
) )
; ;
} }
@ -72,12 +72,12 @@ class set_atomic extends command
if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache))
{ {
$output->writeln("<info>Successfully set config $key</info>"); $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');
return 0; return 0;
} }
else else
{ {
$output->writeln("<error>Could not set config $key</error>"); $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>');
return 1; return 1;
} }
} }

View file

@ -47,7 +47,7 @@ class migrate extends \phpbb\console\command\command
{ {
$this $this
->setName('db:migrate') ->setName('db:migrate')
->setDescription('Updates the database by applying migrations.') ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE'))
; ;
} }

View file

@ -30,7 +30,7 @@ class migration_tips extends \phpbb\console\command\command
{ {
$this $this
->setName('dev:migration-tips') ->setName('dev:migration-tips')
->setDescription('Finds migrations that are not depended on.') ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS'))
; ;
} }

View file

@ -22,11 +22,11 @@ class disable extends command
{ {
$this $this
->setName('extension:disable') ->setName('extension:disable')
->setDescription('Disables the specified extension.') ->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION'))
->addArgument( ->addArgument(
'extension-name', 'extension-name',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'Name of the extension' $this->user->lang('CLI_EXTENSION_NAME')
) )
; ;
} }
@ -39,13 +39,13 @@ class disable extends command
if ($this->manager->is_enabled($name)) if ($this->manager->is_enabled($name))
{ {
$output->writeln("<error>Could not disable extension $name</error>"); $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>');
return 1; return 1;
} }
else else
{ {
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name));
$output->writeln("<info>Successfully disabled extension $name</info>"); $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>');
return 0; return 0;
} }
} }

View file

@ -22,11 +22,11 @@ class enable extends command
{ {
$this $this
->setName('extension:enable') ->setName('extension:enable')
->setDescription('Enables the specified extension.') ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION'))
->addArgument( ->addArgument(
'extension-name', 'extension-name',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'Name of the extension' $this->user->lang('CLI_EXTENSION_NAME')
) )
; ;
} }
@ -40,12 +40,12 @@ class enable extends command
if ($this->manager->is_enabled($name)) if ($this->manager->is_enabled($name))
{ {
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
$output->writeln("<info>Successfully enabled extension $name</info>"); $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');
return 0; return 0;
} }
else else
{ {
$output->writeln("<error>Could not enable extension $name</error>"); $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');
return 1; return 1;
} }
} }

View file

@ -22,11 +22,11 @@ class purge extends command
{ {
$this $this
->setName('extension:purge') ->setName('extension:purge')
->setDescription('Purges the specified extension.') ->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION'))
->addArgument( ->addArgument(
'extension-name', 'extension-name',
InputArgument::REQUIRED, InputArgument::REQUIRED,
'Name of the extension' $this->user->lang('CLI_EXTENSION_NAME')
) )
; ;
} }
@ -39,13 +39,13 @@ class purge extends command
if ($this->manager->is_enabled($name)) if ($this->manager->is_enabled($name))
{ {
$output->writeln("<error>Could not purge extension $name</error>"); $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>');
return 1; return 1;
} }
else else
{ {
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
$output->writeln("<info>Successfully purge extension $name</info>"); $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>');
return 0; return 0;
} }
} }

View file

@ -21,7 +21,7 @@ class show extends command
{ {
$this $this
->setName('extension:show') ->setName('extension:show')
->setDescription('Lists all extensions in the database and on the filesystem.') ->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS'))
; ;
} }
@ -32,7 +32,7 @@ class show extends command
if (empty($all)) if (empty($all))
{ {
$output->writeln('<comment>No extensions were found.</comment>'); $output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>');
return 3; return 3;
} }

View file

@ -31,7 +31,7 @@ class recalculate_email_hash extends \phpbb\console\command\command
{ {
$this $this
->setName('fixup:recalculate-email-hash') ->setName('fixup:recalculate-email-hash')
->setDescription('Recalculates the user_email_hash column of the users table.') ->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'))
; ;
} }
@ -70,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command
} }
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
$output->writeln('<info>Successfully recalculated all email hashes.</info>'); $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');
} }
} }