From 670cd83420201af64608e6ac77ee4f139504e68d Mon Sep 17 00:00:00 2001
From: Karl Hasselbring <Karl Hasselbring>
Date: Tue, 10 Oct 2017 09:35:18 +0200
Subject: [PATCH] versteckter lang parameter der startseite wird jetzt durch
 die locale bestimmt

---
 app/Http/Controllers/StartpageController.php | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php
index 51d8dc601..6a6cb1f04 100644
--- a/app/Http/Controllers/StartpageController.php
+++ b/app/Http/Controllers/StartpageController.php
@@ -6,6 +6,7 @@ use App;
 use Illuminate\Http\Request;
 use Jenssegers\Agent\Agent;
 use Response;
+use LaravelLocalization;
 
 class StartpageController extends Controller
 {
@@ -15,18 +16,12 @@ class StartpageController extends Controller
      * @param  int  $id
      * @return Response
      */
-    /* public function loadStartPage($locale = "de")
-    {
-    \App::setLocale($locale);
-    return view('index', [
-    'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen',
-    'homeIcon']);
-    } */
 
     public function loadStartPage(Request $request)
     {
         $focusPages = [];
         $theme      = "default";
+
         foreach ($request->all() as $key => $value) {
             if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete') {
                 $focusPages[] = str_replace('param_', '', $key);
@@ -36,6 +31,11 @@ class StartpageController extends Controller
             }
         }
 
+        $lang = LaravelLocalization::getCurrentLocale();
+        if ($lang === 'de') {
+            $lang = 'all';
+        }
+
         return view('index')
             ->with('title', trans('titles.index'))
             ->with('homeIcon')
@@ -46,7 +46,7 @@ class StartpageController extends Controller
             ->with('autocomplete', $request->input('param_autocomplete', 'on'))
             ->with('foki', $this->loadFoki())
             ->with('focus', $request->input('focus', 'web'))
-            ->with('lang', $request->input('param_lang', 'all'))
+            ->with('lang', $lang)
             ->with('resultCount', $request->input('param_resultCount', '20'))
             ->with('time', $request->input('param_time', '1500'))
             ->with('sprueche', $request->input('param_sprueche', 'on'))
-- 
GitLab