Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding translations for some commands #3446

Merged
merged 8 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/Config/EditCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$configName) {
$configNames = $this->configFactory->listAll();
$configName = $io->choice(
'Choose a configuration',
$this->trans('commands.config.edit.messages.choose-configuration'),
$configNames
);

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Config/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer
$config_importer->import();
return true;
} catch (ConfigImporterException $e) {
$message = 'The import failed due to the following reasons:' . "\n";
$message = $this->trans('commands.config.import.messages.import-fail') . "\n";
$message .= implode("\n", $config_importer->getErrors());
$io->error(
sprintf(
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Config/ImportSingleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$directory = $input->getOption('directory');

if (!$file) {
$io->error('File option is missing.');
$io->error($this->trans('commands.config.import.single..message.missing-file'));

return 1;
}
Expand Down Expand Up @@ -172,7 +172,7 @@ private function configImport($io, StorageComparer $storageComparer)
return true;
}
} catch (ConfigImporterException $e) {
$message = 'The import failed due to the following reasons:' . "\n";
$message = $this->trans('commands.config.import.messages.import-fail') . "\n";
$message .= implode("\n", $configImporter->getErrors());
$io->error(
sprintf(
Expand Down
12 changes: 6 additions & 6 deletions src/Command/DevelDumperCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ protected function configure()
{
$this
->setName('devel:dumper')
->setDescription($this->trans('Change the devel dumper plugin'))
->setDescription($this->trans('commands.devel.dumper.messages.change-devel-dumper-plugin'))
->addArgument(
'dumper',
InputArgument::OPTIONAL,
$this->trans('Name of the devel dumper plugin')
$this->trans('commands.devel.dumper.messages.name-devel-dumper-plugin')
)->setAliases(['dd']);
}

Expand All @@ -65,7 +65,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
if (!\Drupal::moduleHandler()->moduleExists('devel')) {
$io->error($this->trans('Devel must be installed'));
$io->error($this->trans('commands.devel.dumper.messages.devel-must-be-installed'));

return 1;
}
Expand All @@ -76,7 +76,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$dumpKeys = $this->getDumperKeys();

$dumper = $io->choice(
$this->trans('Select a Debug Dumper'),
$this->trans('commands.devel.dumper.messages.select-debug-dumper'),
$dumpKeys,
'kint', //Make kint the default for quick 'switchback'
false
Expand All @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$dumper = $input->getArgument('dumper');
$dumpKeys = $this->getDumperKeys();
if (!in_array($dumper, $dumpKeys)) {
$io->error($this->trans('Dumper does not exist'));
$io->error($this->trans('commands.devel.dumper.messages.dumper-not-exist'));

return 1;
}
Expand All @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$develSettings->set('devel_dumper', $dumper)->save();
$io->info(
sprintf(
$this->trans('Devel Dumper set to: %s'),
$this->trans('commands.devel.dumper.messages.devel-dumper-set'),
$configFactory->get('devel.settings')->get('devel_dumper')
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.module.questions.description'),
'My Awesome Module'
$this->trans('commands.generate.module.suggestions.my-awesome-module')
);
}
$input->setOption('description', $description);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/ModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function ($modulePath) use ($drupalRoot, $machineName) {
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.module.questions.description'),
'My Awesome Module'
$this->trans('commands.generate.module.suggestions.my-awesome-module')
);
}
$input->setOption('description', $description);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.plugin.field.questions.type-description'),
'My Field Type'
$this->trans('commands.generate.plugin.field.suggestions.my-field-type')
);
$input->setOption('type-description', $description);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.plugin.fieldtype.questions.description'),
'My Field Type'
$this->trans('commands.generate.plugin.fieldtype.suggestions.my-field-type')
);
$input->setOption('description', $description);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginImageEffectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.plugin.imageeffect.questions.description'),
'My Image Effect'
$this->trans('commands.generate.plugin.imageeffect.suggestions.my-image-effect')
);
$input->setOption('description', $description);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Generate/ProfileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function ($machine_name) use ($validators) {
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.profile.questions.description'),
'My Useful Profile'
$this->trans('commands.generate.profile.suggestions.my-useful-profile')
);
$input->setOption('description', $description);
}
Expand Down Expand Up @@ -253,7 +253,7 @@ function ($machine_name) use ($validators) {
) {
$distribution = $io->ask(
$this->trans('commands.generate.profile.options.distribution'),
'My Kick-ass Distribution'
$this->trans('commands.generate.profile.suggestions.my-kick-ass-distribution')
);
$input->setOption('distribution', $distribution);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Generate/ThemeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function ($theme_path) use ($drupalRoot, $machine_name) {
if (!$description) {
$description = $io->ask(
$this->trans('commands.generate.theme.questions.description'),
'My Awesome theme'
$this->trans('commands.generate.theme.suggestions.my-awesome-theme')
);
$input->setOption('description', $description);
}
Expand All @@ -300,7 +300,7 @@ function ($theme_path) use ($drupalRoot, $machine_name) {
if (!$package) {
$package = $io->ask(
$this->trans('commands.generate.theme.questions.package'),
'Other'
$this->trans('commands.generate.theme.suggestions.other')
);
$input->setOption('package', $package);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Module/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($process->isSuccessful()) {
$io->info(
sprintf(
'Module %s was downloaded with Composer.',
$this->trans('commands.module.install.messages.download-with-composer'),
$moduleItem
)
);
} else {
$io->error(
sprintf(
'Module %s seems not to be installed with Composer. Halting.',
$this->trans('commands.module.install.messages.not-installed-with-composer'),
$moduleItem
)
);
Expand All @@ -202,7 +202,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
unset($module[array_search($invalidModule, $module)]);
$io->error(
sprintf(
'Invalid module name: %s',
$this->trans('commands.module.install.messages.invalid-name'),
$invalidModule
)
);
Expand Down
8 changes: 4 additions & 4 deletions src/Command/Shared/FormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ public function formQuestion(DrupalStyle $io)
$size = null;
if (in_array($input_type, ['textfield', 'password', 'password_confirm'])) {
$maxlength = $io->ask(
'Maximum amount of characters',
$this->trans('commands.generate.form.questions.max-amount-characters'),
'64'
);

$size = $io->ask(
'Width of the textfield (in characters)',
$this->trans('commands.generate.form.questions.textfield-width-in-chars'),
'64'
);
}

if ($input_type == 'select') {
$size = $io->ask(
'Size of multiselect box (in lines)',
$this->trans('commands.generate.form.questions.multiselect-size-in-lines'),
'5'
);
}

$input_options = '';
if (in_array($input_type, ['checkboxes', 'radios', 'select'])) {
$input_options = $io->ask(
'Input options separated by comma'
$this->trans('commands.generate.form.questions.input-options')
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Shared/MenuTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function menuQuestion(DrupalStyle $io, $className)

$menu_link_desc = $io->ask(
$menu_link_desc = $this->trans('commands.generate.form.options.menu-link-desc'),
'A description for the menu entry'
$menu_link_desc = $this->trans('commands.generate.form.suggestions.description-for-menu')
);
$menu_options['menu_link_title'] = $menu_link_title;
$menu_options['menu_parent'] = $menu_parent;
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Shared/PermissionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public function permissionQuestion(DrupalStyle $output)
while (true) {
$permission = $output->ask(
$this->trans('commands.generate.permission.questions.permission'),
'access content'
$this->trans('commands.generate.permission.suggestions.access-content')
);
$title = $output->ask(
$this->trans('commands.generate.permission.questions.title'),
'Access content'
$this->trans('commands.generate.permission.suggestions.access-content')
);
$description = $output->ask(
$this->trans('commands.generate.permission.questions.description'),
'Allow access to my content'
$this->trans('commands.generate.permission.suggestions.allow-access-content')
);
$restrictAccess = $output->choiceNoList(
$this->trans('commands.generate.permission.questions.restrict-access'),
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Site/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function ($profile) {
if (!$siteName) {
$siteName = $io->ask(
$this->trans('commands.site.install.questions.site-name'),
'Drupal 8'
$this->trans('commands.site.install.suggestions.site-name')
);
$input->setOption('site-name', $siteName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Theme/PathCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!in_array($theme, $this->getThemeList())) {
$io->error(
sprintf(
'Invalid theme name: %s',
$this->trans('commands.theme.path.messages.invalid-theme-name'),
$theme
)
);
Expand Down