From 720fb67740a5b97264993295ebd514a25e2e2250 Mon Sep 17 00:00:00 2001 From: "bvicco@anexusit.com" Date: Wed, 12 Jul 2017 16:56:13 -0500 Subject: [PATCH 1/2] Replacing in translation key from _ to - --- src/Command/Cache/RebuildCommand.php | 2 +- src/Command/Config/ExportContentTypeCommand.php | 2 +- src/Command/Config/ExportViewCommand.php | 2 +- src/Command/Debug/ContainerCommand.php | 6 +++--- src/Command/Debug/FeaturesCommand.php | 2 +- src/Command/Debug/RestCommand.php | 8 ++++---- src/Command/Migrate/ExecuteCommand.php | 4 ++-- src/Command/Migrate/RollBackCommand.php | 4 ++-- src/Command/Migrate/SetupCommand.php | 4 ++-- src/Command/Shared/FormTrait.php | 2 +- src/Command/Site/StatusCommand.php | 10 +++++----- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 36bd3c6e9..01fedcd59 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($cache && !$this->drupalApi->isValidCache($cache)) { $io->error( sprintf( - $this->trans('commands.cache.rebuild.messages.invalid_cache'), + $this->trans('commands.cache.rebuild.messages.invalid-cache'), $cache ) ); diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index e33e8b9d3..684814b8f 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -150,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getViewDisplays($contentType, $optionalConfig); - $this->exportConfigToModule($module, $io, $this->trans('commands.config.export.content.type.messages.content_type_exported')); + $this->exportConfigToModule($module, $io, $this->trans('commands.config.export.content.type.messages.content-type-exported')); } protected function getFields($contentType, $optional = false) diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index d474738f6..3d715472f 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -172,6 +172,6 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - $this->exportConfigToModule($module, $io, $this->trans('commands.views.export.messages.view_exported')); + $this->exportConfigToModule($module, $io, $this->trans('commands.views.export.messages.view-exported')); } } diff --git a/src/Command/Debug/ContainerCommand.php b/src/Command/Debug/ContainerCommand.php index 5f37ed32e..a8630cef2 100644 --- a/src/Command/Debug/ContainerCommand.php +++ b/src/Command/Debug/ContainerCommand.php @@ -90,8 +90,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } $tableHeader = [ - $this->trans('commands.debug.container.messages.service_id'), - $this->trans('commands.debug.container.messages.class_name') + $this->trans('commands.debug.container.messages.service-id'), + $this->trans('commands.debug.container.messages.class-name') ]; $tableRows = $this->getServiceList(); @@ -114,7 +114,7 @@ private function getCallbackReturnList($service, $method, $args) $serviceInstance = \Drupal::service($service); if (!method_exists($serviceInstance, $method)) { - throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.debug.container.errors.method_not_exists')); + throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.debug.container.errors.method-not-exists')); return $serviceDetail; } diff --git a/src/Command/Debug/FeaturesCommand.php b/src/Command/Debug/FeaturesCommand.php index 21c195cb8..a94806058 100644 --- a/src/Command/Debug/FeaturesCommand.php +++ b/src/Command/Debug/FeaturesCommand.php @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $tableHeader = [ $this->trans('commands.debug.features.messages.bundle'), $this->trans('commands.debug.features.messages.name'), - $this->trans('commands.debug.features.messages.machine_name'), + $this->trans('commands.debug.features.messages.machine-name'), $this->trans('commands.debug.features.messages.status'), $this->trans('commands.debug.features.messages.state'), ]; diff --git a/src/Command/Debug/RestCommand.php b/src/Command/Debug/RestCommand.php index 456cc1b83..ad1205800 100644 --- a/src/Command/Debug/RestCommand.php +++ b/src/Command/Debug/RestCommand.php @@ -109,7 +109,7 @@ private function restDetail(DrupalStyle $io, $resource_id) (string) $resource['label'] ]; $configuration[] = [ - $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical-url'), $resource['uri_paths']['canonical'] ]; $configuration[] = [ @@ -132,7 +132,7 @@ private function restDetail(DrupalStyle $io, $resource_id) $tableHeader = [ $this->trans('commands.debug.rest.messages.rest-state'), $this->trans('commands.debug.rest.messages.supported-formats'), - $this->trans('commands.debug.rest.messages.supported_auth'), + $this->trans('commands.debug.rest.messages.supported-auth'), ]; $tableRows = []; @@ -140,7 +140,7 @@ private function restDetail(DrupalStyle $io, $resource_id) $tableRows[] = [ $method, implode(', ', $settings['supported_formats']), - implode(', ', $settings['supported_auth']), + implode(', ', $settings['supported-auth']), ]; } @@ -154,7 +154,7 @@ protected function restList(DrupalStyle $io, $status) $tableHeader = [ $this->trans('commands.debug.rest.messages.id'), $this->trans('commands.debug.rest.messages.label'), - $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical-url'), $this->trans('commands.debug.rest.messages.status'), $this->trans('commands.debug.rest.messages.provider'), ]; diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index c0aa47144..ceb4083c3 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -120,7 +120,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.execute.options.source-base_path') + $this->trans('commands.migrate.execute.options.source-base-path') ) ->setAliases(['mie']); ; @@ -274,7 +274,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index e10d59e26..84468e6d2 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -60,7 +60,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.setup.options.source-base_path') + $this->trans('commands.migrate.setup.options.source-base-path') )->setAliases(['mir']); ; } @@ -175,7 +175,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index e54c002b3..ae249249e 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -109,7 +109,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.setup.options.source-base_path') + $this->trans('commands.migrate.setup.options.source-base-path') )->setAliases(['mis']); ; } @@ -174,7 +174,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index a6e9085d6..f55da0134 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -69,7 +69,7 @@ public function formQuestion(DrupalStyle $io) $input_machine_name = $this->stringConverter->createMachineName($input_label); $input_name = $io->ask( - $this->trans('commands.common.questions.inputs.machine_name'), + $this->trans('commands.common.questions.inputs.machine-name'), $input_machine_name ); diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 61f62cf65..e0ee9502b 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -170,7 +170,7 @@ protected function getSystemData() } catch (\Exception $e) { $hashSalt = ''; } - $systemData['system'][$this->trans('commands.site.status.messages.hash_salt')] = $hashSalt; + $systemData['system'][$this->trans('commands.site.status.messages.hash-salt')] = $hashSalt; $systemData['system'][$this->trans('commands.site.status.messages.console')] = $this->getApplication()->getVersion(); } @@ -239,10 +239,10 @@ protected function getDirectoryData() return [ 'directory' => [ - $this->trans('commands.site.status.messages.directory_root') => $this->appRoot, - $this->trans('commands.site.status.messages.directory_temporary') => $systemFile->get('path.temporary'), - $this->trans('commands.site.status.messages.directory_theme_default') => $themeDefaultDirectory, - $this->trans('commands.site.status.messages.directory_theme_admin') => $themeAdminDirectory, + $this->trans('commands.site.status.messages.directory-root') => $this->appRoot, + $this->trans('commands.site.status.messages.directory-temporary') => $systemFile->get('path.temporary'), + $this->trans('commands.site.status.messages.directory-theme-default') => $themeDefaultDirectory, + $this->trans('commands.site.status.messages.directory-theme-admin') => $themeAdminDirectory, ], ]; } From 2713e523bfda61a60a6d6417e0988dbdc6c05847 Mon Sep 17 00:00:00 2001 From: "bvicco@anexusit.com" Date: Fri, 14 Jul 2017 10:55:36 -0500 Subject: [PATCH 2/2] Adding translation messages for the commands: config module:install taxonomy:term:delete --- src/Command/Config/ImportCommand.php | 2 +- src/Command/Config/ImportSingleCommand.php | 4 ++-- src/Command/Module/InstallCommand.php | 6 +++--- src/Command/Taxonomy/DeleteTermCommand.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index b0f690cff..08a76de87 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -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( diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 5d26583b9..013314ec5 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -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; } @@ -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( diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 8373d8c1b..3d08bf13a 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -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 ) ); @@ -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 ) ); diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 62e2ff955..b81371447 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -87,7 +87,7 @@ private function deleteExistingTerms($vid = null, DrupalStyle $io) foreach ($vid as $item) { if (!isset($vocabularies[$item])) { - $io->error("Invalid vid: {$item}."); + $io->error(sprintf($this->trans('commands.taxonomy.term.delete.messages.invalid-vid'), $item)); } $vocabulary = $vocabularies[$item]; $terms = $termStorage->loadTree($vocabulary->id()); @@ -95,7 +95,7 @@ private function deleteExistingTerms($vid = null, DrupalStyle $io) foreach ($terms as $term) { $treal = $termStorage->load($term->tid); if ($treal !== null) { - $io->info("Deleting '{$term->name}' and all translations."); + $io->info(sprintf($this->trans('commands.taxonomy.term.delete.messages.deleting-all-translation'), $term->name)); $treal->delete(); } }