Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
correct determination of selected locale during finalizing parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Mar 14, 2022
1 parent c176a84 commit 4db9d65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Helper/ParameterHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\HttpFoundation\RequestStack;
use function Symfony\Component\String\u;
use Zikula\Bundle\CoreBundle\CacheClearer;
use Zikula\Bundle\CoreBundle\Configurator;
use Zikula\Bundle\CoreBundle\Helper\LocalDotEnvHelper;
use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaKernel;
use Zikula\Bundle\CoreBundle\YamlDumper;
Expand Down Expand Up @@ -108,7 +109,7 @@ public function finalizeParameters(): bool

$this->variableApi->getAll(VariableApi::CONFIG); // forces initialization of API
if (!isset($params['upgrading']) || !$params['upgrading']) {
$this->variableApi->set(VariableApi::CONFIG, 'locale', $params['locale']);
$this->variableApi->set(VariableApi::CONFIG, 'locale', $this->getLocale());
// Set the System Identifier as a unique string.
if (!$this->variableApi->get(VariableApi::CONFIG, 'system_identifier')) {
$this->variableApi->set(VariableApi::CONFIG, 'system_identifier', str_replace('.', '', uniqid((string) (random_int(1000000000, 9999999999)), true)));
Expand Down Expand Up @@ -138,6 +139,14 @@ public function finalizeParameters(): bool
return true;
}

private function getLocale(): string
{
$configurator = new Configurator($this->projectDir);
$configurator->loadPackages('zikula_settings');

return $configurator->get('zikula_settings', 'locale');
}

/**
* Configure the Request Context
* see https://symfony.com/doc/current/routing.html#generating-urls-in-commands
Expand Down

0 comments on commit 4db9d65

Please sign in to comment.