mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix the command which load language
The command load the languages in the configured languages in chill's configuration.
This commit is contained in:
parent
96105b101f
commit
d7f4895248
6
.changes/unreleased/Fixed-20240314-154343.yaml
Normal file
6
.changes/unreleased/Fixed-20240314-154343.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'Fix languages: load the languages in all availables languages configured for
|
||||||
|
Chill'
|
||||||
|
time: 2024-03-14T15:43:43.396044369+01:00
|
||||||
|
custom:
|
||||||
|
Issue: "264"
|
@ -12,11 +12,12 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Command;
|
namespace Chill\MainBundle\Command;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Language;
|
use Chill\MainBundle\Entity\Language;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Intl\Languages;
|
use Symfony\Component\Intl\Languages;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -39,7 +40,7 @@ class LoadAndUpdateLanguagesCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* LoadCountriesCommand constructor.
|
* LoadCountriesCommand constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(private readonly EntityManager $entityManager, private $availableLanguages)
|
public function __construct(private readonly EntityManagerInterface $entityManager, private ParameterBagInterface $parameterBag)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -79,7 +80,7 @@ class LoadAndUpdateLanguagesCommand extends Command
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$em = $this->entityManager;
|
$em = $this->entityManager;
|
||||||
$chillAvailableLanguages = $this->availableLanguages;
|
$chillAvailableLanguages = $this->parameterBag->get('chill_main.available_languages');
|
||||||
$languages = [];
|
$languages = [];
|
||||||
|
|
||||||
foreach ($chillAvailableLanguages as $avLang) {
|
foreach ($chillAvailableLanguages as $avLang) {
|
||||||
@ -113,7 +114,7 @@ class LoadAndUpdateLanguagesCommand extends Command
|
|||||||
$avLangNames = [];
|
$avLangNames = [];
|
||||||
|
|
||||||
foreach ($chillAvailableLanguages as $avLang) {
|
foreach ($chillAvailableLanguages as $avLang) {
|
||||||
$avLangNames[$avLang] = Languages::getName($code, $avLang);
|
$avLangNames[$avLang] = ucfirst(Languages::getName($code, $avLang));
|
||||||
}
|
}
|
||||||
|
|
||||||
$languageDB->setName($avLangNames);
|
$languageDB->setName($avLangNames);
|
||||||
|
@ -17,9 +17,6 @@ services:
|
|||||||
- { name: console.command }
|
- { name: console.command }
|
||||||
|
|
||||||
Chill\MainBundle\Command\LoadAndUpdateLanguagesCommand:
|
Chill\MainBundle\Command\LoadAndUpdateLanguagesCommand:
|
||||||
arguments:
|
|
||||||
$entityManager: '@doctrine.orm.entity_manager'
|
|
||||||
$availableLanguages: '%chill_main.available_languages%'
|
|
||||||
tags:
|
tags:
|
||||||
- { name: console.command }
|
- { name: console.command }
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Add new phone: Ajouter un numéro de téléphone
|
|||||||
Remove phone: Supprimer
|
Remove phone: Supprimer
|
||||||
'Notes on contact information': 'Remarques sur les informations de contact'
|
'Notes on contact information': 'Remarques sur les informations de contact'
|
||||||
'Remarks': 'Remarques'
|
'Remarks': 'Remarques'
|
||||||
Spoken languages': 'Langues parlées'
|
Spoken languages: 'Langues parlées'
|
||||||
'Unknown spoken languages': 'Langues parlées inconnues'
|
'Unknown spoken languages': 'Langues parlées inconnues'
|
||||||
Male: Homme
|
Male: Homme
|
||||||
Female: Femme
|
Female: Femme
|
||||||
|
Loading…
x
Reference in New Issue
Block a user