From cda340ccfa75fac62146bae9c4298f9e55a1198a Mon Sep 17 00:00:00 2001
From: Karl <Karl Hasselbring>
Date: Wed, 25 Jan 2017 10:23:20 +0100
Subject: [PATCH] =?UTF-8?q?Quicktips=20zeigen=20jetzt=20=C3=BCbersetztes?=
 =?UTF-8?q?=20Wetter=20und=20Wikipedia.=20Der=20Hinweis=20zu=20Ergebnisspr?=
 =?UTF-8?q?achen=20wird=20richtig=20angezeigt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/Http/Controllers/MetaGerSearch.php | 12 ++----------
 resources/lang/es/results.php          | 12 ++++++------
 resources/views/quicktip.blade.php     | 24 ++++++++++--------------
 3 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php
index bb5205935..cdff8a7d3 100644
--- a/app/Http/Controllers/MetaGerSearch.php
+++ b/app/Http/Controllers/MetaGerSearch.php
@@ -89,11 +89,7 @@ class MetaGerSearch extends Controller
 
         # Wetter
         try {
-            if (App::isLocale('en')) {
-                $url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=en&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
-            } else {
-                $url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=de&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
-            }
+            $url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=" . APP::getLocale() . "&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap");
 
             $result = json_decode($this->get($url), true);
 
@@ -133,11 +129,7 @@ class MetaGerSearch extends Controller
         }
 
         # Wikipedia Quicktip
-        if (App::isLocale('en')) {
-            $url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
-        } else {
-            $url = "https://de.wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
-        }
+        $url             = "https://" . APP::getLocale() . ".wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve";
         $decodedResponse = json_decode($this->get($url), true);
         if (isset($decodedResponse[1][0]) && isset($decodedResponse[2][0]) && isset($decodedResponse[3][0])) {
             $quicktip     = [];
diff --git a/resources/lang/es/results.php b/resources/lang/es/results.php
index 21a7a5b7d..19b9de885 100644
--- a/resources/lang/es/results.php
+++ b/resources/lang/es/results.php
@@ -1,9 +1,9 @@
 <?php
 
 return [
-    "redirect"	=>	"(con desviar)",
-    "weiter"	=>	"Continuar",
-    "zurueck"	=>	"Atrás",
-    "filter"	=>	"Resultados filtraban:  <strong>[:filter]</strong>. <a href=\":link\" target=\"_blank\">Desactivar filtro.</a>",
-    "filter.default"	=>	"Recibís el interfaz del usuario en <strong>:langName</strong>, pero resultados en <strong>TODOS</strong> idiomas. Usan  <a href=\"/settings\" target=\"_blank\">anpassen</a> para seleccionar una idioma para los resultados."
-];
\ No newline at end of file
+    "redirect"       => "(con desviar)",
+    "weiter"         => "Continuar",
+    "zurueck"        => "Atrás",
+    "filter"         => "Resultados filtraban:  <strong>[:filter]</strong>. <a href=\":link\" target=\"_blank\">Desactivar filtro.</a>",
+    "filter.default" => "Recibís el interfaz del usuario en <strong>:langName</strong>, pero resultados en <strong>TODOS</strong> idiomas. Usan  <a href=\"/settings\" target=\"_blank\">adjustar</a> para seleccionar una idioma para los resultados.",
+];
diff --git a/resources/views/quicktip.blade.php b/resources/views/quicktip.blade.php
index e15b2b5cf..94fd287da 100644
--- a/resources/views/quicktip.blade.php
+++ b/resources/views/quicktip.blade.php
@@ -61,21 +61,17 @@
 			</div>
 		@endforeach
 		<div class="quicktip">
-			<details>
-				<summary>
-					<div class="media">
-						<div class="media-body">
-							<div>
-								@if( Request::input('lang') === "all")
-									{!! trans('results.filter.default', ['langName' => LaravelLocalization::getSupportedLocales()[LaravelLocalization::getCurrentLocale()]['native']]) !!}
-								@else
-									{!! trans('results.filter', ['langName' => LaravelLocalization::getSupportedLocales()[LaravelLocalization::getCurrentLocale()]['native'], 'link' => base64_decode(Request::input('unfilteredLink','')), 'filter' => Request::input('lang')]) !!}
-								@endif
-							</div>
-						</div>
+			<div class="media">
+				<div class="media-body">
+					<div>
+						@if( Request::input('lang') === "all")
+							{!! trans('results.filter.default', ['langName' => LaravelLocalization::getSupportedLocales()[LaravelLocalization::getCurrentLocale()]['native']]) !!}
+						@else
+							{!! trans('results.filter', ['langName' => LaravelLocalization::getSupportedLocales()[LaravelLocalization::getCurrentLocale()]['native'], 'link' => base64_decode(Request::input('unfilteredLink','')), 'filter' => Request::input('lang')]) !!}
+						@endif
 					</div>
-				</summary>
-			</details>
+				</div>
+			</div>
 		</div>
 		<script src="{{ elixir('js/quicktips.js') }}"></script>
 	</body>
-- 
GitLab