From 6b39b121b6712f2f490202bf00d0ae537b7497d3 Mon Sep 17 00:00:00 2001 From: Yannis Rammos Date: Mon, 28 Oct 2019 02:43:54 +0200 Subject: [PATCH] Load the booking frontend in the primary language of the client's browser unless it is overridden by manual language selection. --- src/application/config/config.php | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/application/config/config.php b/src/application/config/config.php index aa55e602..ec6611be 100644 --- a/src/application/config/config.php +++ b/src/application/config/config.php @@ -82,7 +82,38 @@ $config['url_suffix'] = ''; | */ -$config['language'] = defined('Config::LANGUAGE') ? Config::LANGUAGE : 'english'; +$config['language'] = (null !== $_SERVER['HTTP_ACCEPT_LANGUAGE'] + ? + array( + 'ar' => 'arabic', + 'bu' => 'bulgarian', + 'zh' => 'chinese', + 'da' => 'danish', + 'nl' => 'dutch', + 'en' => 'english', + 'fi' => 'finnish', + 'fr' => 'french', + 'de' => 'german', + 'el' => 'greek', + 'hi' => 'hindi', + 'hu' => 'hungarian', + 'it' => 'italian', + 'ja' => 'japanese', + 'pl' => 'polish', + 'pt' => 'portuguese', + 'pt' => 'portuguese', + 'ro' => 'romanian', + 'ru' => 'russian', + 'sk' => 'slovak', + 'es' => 'spanish', + 'tr' => 'turkish' + )[substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)] + : + (defined('Config::LANGUAGE') + ? Config::LANGUAGE + : 'english' + ) + ); /* |--------------------------------------------------------------------------