From 7c695ce9c6c2bb8b5a7acdda369164292c079390 Mon Sep 17 00:00:00 2001 From: Bob den Otter Date: Thu, 27 Feb 2020 07:04:44 +0100 Subject: [PATCH] Allow for adding locales to `config/services.yaml` --- config/packages/translation.yaml | 1 - config/services.yaml | 2 +- src/Configuration/Parser/ContentTypesParser.php | 2 +- src/Kernel.php | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/config/packages/translation.yaml b/config/packages/translation.yaml index b5105206c..f0c1334e5 100644 --- a/config/packages/translation.yaml +++ b/config/packages/translation.yaml @@ -8,7 +8,6 @@ framework: translation: webui: enabled: true - locales: ['en', 'nl', 'es', 'fr', 'de', 'pl', 'it', 'hu', 'pt_BR', 'is', 'jp', 'nb', 'dk', 'pl'] edit_in_place: enabled: false configs: diff --git a/config/services.yaml b/config/services.yaml index 05a6ac735..13744b487 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -3,7 +3,7 @@ parameters: locale: 'en' # This parameter defines the codes of the locales (languages) enabled in the application - app_locales: en|nl|es|fr|de|pl|it|hu|pt_BR|ja|nb|nn|nl_NL|nl_BE + app_locales: en|nl|es|fr|de|pl|it|hu|pt_BR|ja|nb|nn|nl_NL|nl_BE|is|ru app.notifications.email_sender: anonymous@example.com bolt.table_prefix: bolt_ bolt.backend_url: /bolt diff --git a/src/Configuration/Parser/ContentTypesParser.php b/src/Configuration/Parser/ContentTypesParser.php index 4e11b753c..5c9a1307f 100644 --- a/src/Configuration/Parser/ContentTypesParser.php +++ b/src/Configuration/Parser/ContentTypesParser.php @@ -21,7 +21,7 @@ class ContentTypesParser extends BaseParser /** @var array */ private $localeCodes = []; - public function __construct(string $locales, string $projectDir, Collection $generalConfig, string $filename = 'contenttypes.yaml') + public function __construct(?string $locales = null, string $projectDir, Collection $generalConfig, string $filename = 'contenttypes.yaml') { $this->localeCodes = empty($locales) ? [] : explode('|', $locales); $this->generalConfig = $generalConfig; diff --git a/src/Kernel.php b/src/Kernel.php index de7085bc9..25ab0f57d 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -123,7 +123,7 @@ private function flattenKeys(array $array, string $prefix = ''): array */ private function setContentTypeRequirements(ContainerBuilder $container): void { - $ContentTypesParser = new ContentTypesParser('en|nl|es|fr|de|pl|it|hu|pt_BR|ja|nb|nn|nl_NL|nl_BE', $this->getProjectDir(), new Collection()); + $ContentTypesParser = new ContentTypesParser(null, $this->getProjectDir(), new Collection()); $contentTypes = $ContentTypesParser->parse(); $pluralslugs = $contentTypes->pluck('slug')->implode('|');