1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-16 12:29:43 +02:00

[ticket/11150] Language keys

PHPBB3-11150
This commit is contained in:
Tristan Darricau 2015-09-15 13:52:29 +02:00 committed by Tristan Darricau
parent 46972aa4c7
commit 9b69cd74ae
No known key found for this signature in database
GPG Key ID: 817043C2E29DB881
6 changed files with 48 additions and 22 deletions

View File

@ -158,6 +158,15 @@ services:
tags: tags:
- { name: console.command } - { name: console.command }
console.command.extension.manage:
class: phpbb\console\command\extension\manage
arguments:
- @user
- @ext.composer.manager
- @language
tags:
- { name: console.command }
console.command.extension.purge: console.command.extension.purge:
class: phpbb\console\command\extension\purge class: phpbb\console\command\extension\purge
arguments: arguments:
@ -185,15 +194,6 @@ services:
tags: tags:
- { name: console.command } - { name: console.command }
console.command.extension.start_managing:
class: phpbb\console\command\extension\start_managing
arguments:
- @user
- @ext.composer.manager
- @language
tags:
- { name: console.command }
console.command.extension.update: console.command.extension.update:
class: phpbb\console\command\extension\update class: phpbb\console\command\extension\update
arguments: arguments:

View File

@ -149,4 +149,9 @@ $lang = array_merge($lang, array(
'PURGE_ON_REMOVE' => 'Purge extensions when removing', 'PURGE_ON_REMOVE' => 'Purge extensions when removing',
'ENABLE_PACKAGIST' => 'Enable Packagist usage', 'ENABLE_PACKAGIST' => 'Enable Packagist usage',
'ENABLE_PACKAGIST_EXPLAIN' => 'TODO text explaining why packagist shouldn\'t be enabled, dev usage, etc...', 'ENABLE_PACKAGIST_EXPLAIN' => 'TODO text explaining why packagist shouldn\'t be enabled, dev usage, etc...',
'EXTENSION_MANAGED_SUCCESS' => 'The extension %s is now managed automatically.',
'EXTENSIONS_INSTALLED' => 'Extensions successfully installed.',
'EXTENSIONS_REMOVED' => 'Extensions successfully removed.',
'EXTENSIONS_UPDATED' => 'Extensions successfully updated..',
)); ));

View File

@ -157,6 +157,18 @@ $lang = array_merge($lang, array(
1 => 'Re-cleaning complete. %d username was cleaned.', 1 => 'Re-cleaning complete. %d username was cleaned.',
2 => 'Re-cleaning complete. %d usernames were cleaned.', 2 => 'Re-cleaning complete. %d usernames were cleaned.',
], ],
'CLI_DESCRIPTION_EXTENSION_MANAGE' => 'Manages an extension',
'CLI_DESCRIPTION_EXTENSION_MANAGE_ARGUMENT' => 'Extension to manage',
'CLI_DESCRIPTION_EXTENSION_INSTALL' => 'Install extensions',
'CLI_DESCRIPTION_EXTENSION_INSTALL_OPTION_ENABLE' => 'Enable the extensions after installing them',
'CLI_DESCRIPTION_EXTENSION_INSTALL_ARGUMENT' => 'Extensions to install',
'CLI_DESCRIPTION_EXTENSION_LIST_AVAILABLE' => 'Show extensions available for installation',
'CLI_DESCRIPTION_EXTENSION_REMOVE' => 'Removes extensions',
'CLI_DESCRIPTION_EXTENSION_REMOVE_OPTION_PURGE' => 'Purge the extensions before removing them',
'CLI_DESCRIPTION_EXTENSION_REMOVE_ARGUMENT' => 'Extensions to remove',
'CLI_DESCRIPTION_EXTENSION_UPDATE' => 'Updates extensions',
'CLI_DESCRIPTION_EXTENSION_UPDATE_ARGUMENT' => 'Extensions to update',
)); ));
// Additional help for commands. // Additional help for commands.

View File

@ -14,25 +14,33 @@
namespace phpbb\console\command\extension; namespace phpbb\console\command\extension;
use phpbb\composer\exception\managed_with_error_exception; use phpbb\composer\exception\managed_with_error_exception;
use phpbb\composer\io\console_io;
use phpbb\composer\manager; use phpbb\composer\manager;
use phpbb\composer\manager_interface; use phpbb\composer\manager_interface;
use phpbb\language\language;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
class start_managing extends \phpbb\console\command\command class manage extends \phpbb\console\command\command
{ {
/** /**
* @var manager_interface Composer extensions manager * @var manager_interface Composer extensions manager
*/ */
protected $manager; protected $manager;
public function __construct(\phpbb\user $user, manager_interface $manager) /**
* @var \phpbb\language\language
*/
protected $language;
public function __construct(\phpbb\user $user, manager_interface $manager, language $language)
{ {
$this->manager = $manager; $this->manager = $manager;
$this->language = $language;
$user->add_lang('acp/extensions'); $language->add_lang('acp/extensions');
parent::__construct($user); parent::__construct($user);
} }
@ -45,12 +53,12 @@ class start_managing extends \phpbb\console\command\command
protected function configure() protected function configure()
{ {
$this $this
->setName('extension:start-managing') ->setName('extension:manage')
->setDescription($this->user->lang('CLI_DESCRIPTION_EXTENSION_START_MANAGING')) ->setDescription($this->language->lang('CLI_DESCRIPTION_EXTENSION_MANAGE'))
->addArgument( ->addArgument(
'extension', 'extension',
InputArgument::REQUIRED, InputArgument::REQUIRED,
$this->user->lang('CLI_DESCRIPTION_EXTENSION_START_MANAGING')) $this->language->lang('CLI_DESCRIPTION_EXTENSION_MANAGE_ARGUMENT'))
; ;
} }
@ -64,20 +72,21 @@ class start_managing extends \phpbb\console\command\command
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
$composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language);
$extension = $input->getArgument('extension'); $extension = $input->getArgument('extension');
try try
{ {
$this->manager->start_managing($extension); $this->manager->start_managing($extension, $composer_io);
} }
catch (managed_with_error_exception $e) catch (managed_with_error_exception $e)
{ {
$io->warning(call_user_func_array([$this->user, 'lang'], [$e->getMessage(), $e->get_parameters()])); $io->warning($this->language->lang_array($e->getMessage(), $e->get_parameters()));
return 1; return 1;
} }
$io->success('The extension ' . $extension . ' is now managed automatically.'); $io->success($this->language->lang('EXTENSION_MANAGED_SUCCESS', $extension));
return 0; return 0;
} }

View File

@ -59,11 +59,11 @@ class remove extends \phpbb\console\command\command
'purge', 'purge',
'p', 'p',
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
$this->language->lang('CLI_DESCRIPTION_EXTENSION_REMOVE_OPTION_URGE')) $this->language->lang('CLI_DESCRIPTION_EXTENSION_REMOVE_OPTION_PURGE'))
->addArgument( ->addArgument(
'extensions', 'extensions',
InputArgument::IS_ARRAY | InputArgument::REQUIRED, InputArgument::IS_ARRAY | InputArgument::REQUIRED,
$this->language->lang('CLI_DESCRIPTION_EXTENSION_REMOVE')) $this->language->lang('CLI_DESCRIPTION_EXTENSION_REMOVE_ARGUMENT'))
; ;
} }

View File

@ -55,7 +55,7 @@ class update extends \phpbb\console\command\command
->addArgument( ->addArgument(
'extensions', 'extensions',
InputArgument::IS_ARRAY | InputArgument::REQUIRED, InputArgument::IS_ARRAY | InputArgument::REQUIRED,
$this->user->lang('CLI_DESCRIPTION_EXTENSION_UPDATE')) $this->user->lang('CLI_DESCRIPTION_EXTENSION_UPDATE_ARGUMENT'))
; ;
} }
@ -76,7 +76,7 @@ class update extends \phpbb\console\command\command
$this->manager->update($extensions, $composer_io); $this->manager->update($extensions, $composer_io);
$io->success('All extensions updated'); $io->success($this->language->lang('EXTENSIONS_UPDATED'));
return 0; return 0;
} }