From 493c4f3d5bea4af5747a2ab3cec5d1835f5bb9ed Mon Sep 17 00:00:00 2001 From: Richard van Laak Date: Thu, 27 Nov 2014 16:34:17 +0100 Subject: [PATCH 1/3] Enable TranslationFormBundle specific default_locale ... so it also can be used in case the Symfony framework `default_locale` cannot be used. --- DependencyInjection/Configuration.php | 1 + 1 file changed, 1 insertion(+) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6b852b2..951ac85 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -22,6 +22,7 @@ public function getConfigTreeBuilder() $rootNode ->children() ->scalarNode('locale_provider')->defaultValue('default')->end() + ->scalarNode('default_locale')->isRequired(false)->end() ->arrayNode('locales') ->beforeNormalization() ->ifString() From 5ee07e5fd18be9f04ef9e5be270d0bdf3e7ab9f8 Mon Sep 17 00:00:00 2001 From: Richard van Laak Date: Thu, 27 Nov 2014 16:35:50 +0100 Subject: [PATCH 2/3] Update A2lixTranslationFormExtension.php ... to not only be dependent of the kernel default_locale, but allow Bundle override. --- DependencyInjection/A2lixTranslationFormExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/A2lixTranslationFormExtension.php b/DependencyInjection/A2lixTranslationFormExtension.php index 0170da9..5716cd8 100644 --- a/DependencyInjection/A2lixTranslationFormExtension.php +++ b/DependencyInjection/A2lixTranslationFormExtension.php @@ -30,8 +30,9 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('a2lix_translation_form.locale_provider', $config['locale_provider']); $container->setParameter('a2lix_translation_form.locales', $config['locales']); - $container->setParameter('a2lix_translation_form.default_locale', $container->getParameter('kernel.default_locale', 'en')); $container->setParameter('a2lix_translation_form.required_locales', $config['required_locales']); + $container->setParameter('a2lix_translation_form.default_locale', $config['default_locale'] ?: + $container->getParameter('kernel.default_locale', 'en')); $container->setParameter('a2lix_translation_form.templating', $config['templating']); From e6e8f76baa8a8959fb1acaacf96600eee35b73dc Mon Sep 17 00:00:00 2001 From: Richard van Laak Date: Tue, 2 Dec 2014 10:06:55 +0100 Subject: [PATCH 3/3] Make `default_locale` null by default --- DependencyInjection/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 951ac85..3954ef7 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -22,7 +22,7 @@ public function getConfigTreeBuilder() $rootNode ->children() ->scalarNode('locale_provider')->defaultValue('default')->end() - ->scalarNode('default_locale')->isRequired(false)->end() + ->scalarNode('default_locale')->defaultNull()->end() ->arrayNode('locales') ->beforeNormalization() ->ifString()