Skip to content

Commit e99809b

Browse files
committed
ACP2E-1999: translation for show and set config
1 parent 774aa5d commit e99809b

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

app/code/Magento/Config/Console/Command/ConfigSetCommand.php

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -181,34 +181,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
181181

182182
try {
183183
$message = $this->emulatedAreaProcessor->process(function () use ($input) {
184-
$lock = $input->getOption(static::OPTION_LOCK_ENV)
185-
|| $input->getOption(static::OPTION_LOCK_CONFIG)
186-
|| $input->getOption(static::OPTION_LOCK);
187-
188-
$lockTargetPath = ConfigFilePool::APP_ENV;
189-
if ($input->getOption(static::OPTION_LOCK_CONFIG)) {
190-
$lockTargetPath = ConfigFilePool::APP_CONFIG;
191-
}
192-
193-
return $this->processorFacadeFactory->create()->processWithLockTarget(
194-
$input->getArgument(static::ARG_PATH),
195-
$input->getArgument(static::ARG_VALUE),
196-
$input->getOption(static::OPTION_SCOPE),
197-
$input->getOption(static::OPTION_SCOPE_CODE),
198-
$lock,
199-
$lockTargetPath
200-
);
184+
$this->localeEmulator->emulate(function () use ($input) {
185+
$lock = $input->getOption(static::OPTION_LOCK_ENV)
186+
|| $input->getOption(static::OPTION_LOCK_CONFIG)
187+
|| $input->getOption(static::OPTION_LOCK);
188+
189+
$lockTargetPath = ConfigFilePool::APP_ENV;
190+
if ($input->getOption(static::OPTION_LOCK_CONFIG)) {
191+
$lockTargetPath = ConfigFilePool::APP_CONFIG;
192+
}
193+
194+
return $this->processorFacadeFactory->create()->processWithLockTarget(
195+
$input->getArgument(static::ARG_PATH),
196+
$input->getArgument(static::ARG_VALUE),
197+
$input->getOption(static::OPTION_SCOPE),
198+
$input->getOption(static::OPTION_SCOPE_CODE),
199+
$lock,
200+
$lockTargetPath
201+
);
202+
});
201203
});
202204

203205
$output->writeln('<info>' . $message . '</info>');
204206

205207
return Cli::RETURN_SUCCESS;
206208
} catch (\Exception $exception) {
207-
$this->emulatedAreaProcessor->process(function () use ($exception, $output) {
208-
$this->localeEmulator->emulate(
209-
fn () => $output->writeln(sprintf('<error>%s</error>', __($exception->getMessage())))
210-
);
211-
});
209+
$output->writeln(sprintf('<error>%s</error>', $exception->getMessage()));
212210
return Cli::RETURN_FAILURE;
213211
}
214212
}

app/code/Magento/Config/Console/Command/ConfigShowCommand.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -180,34 +180,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
180180
$this->inputPath = $inputPath !== null ? trim($inputPath, '/') : '';
181181

182182
$configValue = $this->emulatedAreaProcessor->process(function () {
183-
$this->scopeValidator->isValid($this->scope, $this->scopeCode);
184-
if ($this->inputPath) {
185-
$pathValidator = $this->pathValidatorFactory->create();
186-
$pathValidator->validate($this->inputPath);
187-
}
188-
189-
$configPath = $this->pathResolver
190-
->resolve($this->inputPath, $this->scope, $this->scopeCode);
191-
$value = $this->configSource->get($configPath);
192-
if (!$value) {
183+
$this->localeEmulator->emulate(function () {
184+
$this->scopeValidator->isValid($this->scope, $this->scopeCode);
185+
if ($this->inputPath) {
186+
$pathValidator = $this->pathValidatorFactory->create();
187+
$pathValidator->validate($this->inputPath);
188+
}
189+
193190
$configPath = $this->pathResolver
194-
->resolve($this->inputPath, $this->scope, strtolower($this->scopeCode));
191+
->resolve($this->inputPath, $this->scope, $this->scopeCode);
195192
$value = $this->configSource->get($configPath);
196193
if (!$value) {
197-
$value = $this->configSource->get(strtolower($configPath));
194+
$configPath = $this->pathResolver
195+
->resolve($this->inputPath, $this->scope, strtolower($this->scopeCode));
196+
$value = $this->configSource->get($configPath);
197+
if (!$value) {
198+
$value = $this->configSource->get(strtolower($configPath));
199+
}
198200
}
199-
}
200-
return $value;
201+
return $value;
202+
});
201203
});
202204

203205
$this->outputResult($output, $configValue, $this->inputPath);
204206
return Cli::RETURN_SUCCESS;
205207
} catch (\Exception $e) {
206-
$this->emulatedAreaProcessor->process(function () use ($e, $output) {
207-
$this->localeEmulator->emulate(
208-
fn () => $output->writeln(sprintf('<error>%s</error>', __($e->getMessage())))
209-
);
210-
});
208+
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
211209
return Cli::RETURN_FAILURE;
212210
}
213211
}

0 commit comments

Comments
 (0)