diff --git a/build/nginx/configuration/nginx.conf b/build/nginx/configuration/nginx.conf index 4a7b0e60654b21f55e175a67686853da75c816af..4f69430aa2602b7ff5f5fad93ed591739f3d4dd1 100644 --- a/build/nginx/configuration/nginx.conf +++ b/build/nginx/configuration/nginx.conf @@ -25,7 +25,7 @@ http { access_log /dev/null main; map $upstream_http_content_security_policy $csp { - '' "default-src 'self'; script-src 'self'; script-src-elem 'self'; script-src-attr 'self'; style-src 'self'; style-src-elem 'self'; style-src-attr 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src 'self'; frame-ancestors 'self' https://scripts.zdv.uni-mainz.de; form-action 'self' www.paypal.com"; + '' "default-src 'self'; script-src 'self'; script-src-elem 'self'; script-src-attr 'self'; style-src 'self'; style-src-elem 'self'; style-src-attr 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-src 'self'; frame-ancestors 'self' https://scripts.zdv.uni-mainz.de; form-action 'self' metager.org metager.de"; } add_header "X-Frame-Options" "sameorigin"; diff --git a/metager/app/Http/Controllers/LangSelector.php b/metager/app/Http/Controllers/LangSelector.php index 86d429eb0e5aead86f19dff8ea7a9298c7ba70d2..f8b5bb0d2da1af0d3fd5aa77ec33333d8127c6b8 100644 --- a/metager/app/Http/Controllers/LangSelector.php +++ b/metager/app/Http/Controllers/LangSelector.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Cookie; use Illuminate\Http\Request; use LaravelLocalization; use URL; @@ -36,9 +37,46 @@ class LangSelector extends Controller } } + if ($redirect = $this->checkUserSwitchingLanguage($request)) { + return $redirect; + } + + return view('lang-selector') ->with("previous_url", $previous_url) ->with("title", trans("titles.lang-selector")) ->with('css', [mix('css/lang-selector.css')]); } + + /** + * Checks if the user is switching language with this request + * Will update a language setting cookie to persist the setting in the browser + * + * @return null|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + **/ + private function checkUserSwitchingLanguage(Request $request) + { + // User is not switching the language + if (!filter_var($request->input("switch", false), FILTER_VALIDATE_BOOL)) { + return; + } + + // Parse the new locale from the request + $path_locale = $request->segment(1); + if (!preg_match("/^[a-z]{2}-[A-Z]{2}$/", $path_locale) || !in_array($path_locale, LaravelLocalization::getSupportedLanguagesKeys())) { + $path_locale = null; + } + if (empty($path_locale)) { + // Path locale might not be present if the user is switching to the default language + // of the browser + Cookie::queue(Cookie::forget("web_setting_m", "/", null)); + $new_locale = LaravelLocalization::getDefaultLocale(); + } else { + $secure = !app()->environment("local"); + Cookie::queue(Cookie::forever("web_setting_m", str_replace("-", "_", $path_locale), "/", null, $secure, true)); + $new_locale = $path_locale; + } + $url = LaravelLocalization::getLocalizedUrl($new_locale, route("lang-selector", $request->except("switch"))); + return redirect($url); + } } \ No newline at end of file diff --git a/metager/app/Http/Controllers/SettingsController.php b/metager/app/Http/Controllers/SettingsController.php index c1974f2267a3e87abfdef45443c9283bd5b226f7..7fad33f2ff1289506ce474534d9b84e74870bf24 100644 --- a/metager/app/Http/Controllers/SettingsController.php +++ b/metager/app/Http/Controllers/SettingsController.php @@ -141,11 +141,12 @@ class SettingsController extends Controller $settings = app(SearchSettings::class); $engines = app(Searchengines::class)->getSearchEnginesForFokus(); + $secure = app()->environment("local") ? false : true; if (!$engines[$sumaName]->configuration->disabled) { if ($engines[$sumaName]->configuration->disabledByDefault) { Cookie::queue(Cookie::forget($settings->fokus . "_engine_" . $sumaName, "/")); } else { - Cookie::queue(Cookie::forever($settings->fokus . "_engine_" . $sumaName, "off", "/", null, true, true)); + Cookie::queue(Cookie::forever($settings->fokus . "_engine_" . $sumaName, "off", "/", null, $secure, true)); } } @@ -163,9 +164,10 @@ class SettingsController extends Controller $settings = app(SearchSettings::class); $engines = app(Searchengines::class)->getSearchEnginesForFokus(); + $secure = app()->environment("local") ? false : true; if ($engines[$sumaName]->configuration->disabled) { if ($engines[$sumaName]->configuration->disabledByDefault) { - Cookie::queue(Cookie::forever($settings->fokus . "_engine_" . $sumaName, "on", "/", null, true, true)); + Cookie::queue(Cookie::forever($settings->fokus . "_engine_" . $sumaName, "on", "/", null, $secure, true)); } else { Cookie::queue(Cookie::forget($settings->fokus . "_engine_" . $sumaName, "/")); } @@ -209,7 +211,8 @@ class SettingsController extends Controller if ($key === $filter->{"get-parameter"} && !empty($filter->values->$value)) { $path = \Request::path(); $cookiePath = "/"; - Cookie::queue(Cookie::forever($fokus . "_setting_" . $key, $value, "/", null, true, true)); + $secure = app()->environment("local") ? false : true; + Cookie::queue(Cookie::forever($fokus . "_setting_" . $key, $value, "/", null, $secure, true)); break; } } @@ -223,23 +226,24 @@ class SettingsController extends Controller { $fokus = $request->input('focus', ''); $url = $request->input('url', ''); + $secure = app()->environment("local") ? false : true; // Currently only the setting for quotes is supported $quotes = $request->input('zitate', ''); if (!empty($quotes)) { if ($quotes === "off") { - Cookie::queue(Cookie::forever('zitate', 'off', '/', null, true, true)); + Cookie::queue(Cookie::forever('zitate', 'off', '/', null, $secure, true)); } elseif ($quotes === "on") { - Cookie::queue('zitate', '', 5256000, '/', null, true, true); + Cookie::queue('zitate', '', 5256000, '/', null, $secure, true); } } $darkmode = $request->input('dm'); if (!empty($darkmode)) { if ($darkmode === "off") { - Cookie::queue(Cookie::forever('dark_mode', '1', '/', null, true, true)); + Cookie::queue(Cookie::forever('dark_mode', '1', '/', null, $secure, true)); } elseif ($darkmode === "on") { - Cookie::queue(Cookie::forever('dark_mode', '2', '/', null, true, true)); + Cookie::queue(Cookie::forever('dark_mode', '2', '/', null, $secure, true)); } elseif ($darkmode === "system") { Cookie::queue(Cookie::forget('dark_mode', '/')); } @@ -250,7 +254,7 @@ class SettingsController extends Controller if ($newTab === "off") { Cookie::queue(Cookie::forget('new_tab', '/')); } elseif ($newTab === "on") { - Cookie::queue(Cookie::forever('new_tab', 'on', '/', null, true, true)); + Cookie::queue(Cookie::forever('new_tab', 'on', '/', null, $secure, true)); } } @@ -382,7 +386,8 @@ class SettingsController extends Controller sort($valid_blacklist_entries); $cookieName = $fokus . '_blpage'; - Cookie::queue(Cookie::forever($cookieName, implode(",", $valid_blacklist_entries), "/", null, true, true)); + $secure = app()->environment("local") ? false : true; + Cookie::queue(Cookie::forever($cookieName, implode(",", $valid_blacklist_entries), "/", null, $secure, true)); return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('settings', ["focus" => $fokus, "url" => $url])) . "#bl"); } @@ -421,25 +426,26 @@ class SettingsController extends Controller $regexUrl = '#^(\*\.)?[a-z0-9]+(\.[a-z0-9]+)?(\.[a-z0-9]{2,})$#'; - $settings = $request->all(); + $settings = $request->query(); + $secure = app()->environment("local") ? false : true; foreach ($settings as $key => $value) { if ($key === 'key') { - Cookie::queue(Cookie::forever("key", $value, '/', null, true, true)); + Cookie::queue(Cookie::forever("key", $value, '/', null, $secure, true)); } elseif ($key === 'dark_mode' && ($value === '1' || $value === '2')) { - Cookie::queue(Cookie::forever($key, $value, '/', null, true, true)); + Cookie::queue(Cookie::forever($key, $value, '/', null, $secure, true)); } elseif ($key === 'new_tab' && $value === 'on') { - Cookie::queue(Cookie::forever($key, 'on', '/', null, true, true)); + Cookie::queue(Cookie::forever($key, 'on', '/', null, $secure, true)); } elseif ($key === 'zitate' && $value === 'off') { - Cookie::queue(Cookie::forever($key, 'off', '/', null, true, true)); + Cookie::queue(Cookie::forever($key, 'off', '/', null, $secure, true)); } else { foreach ($langFile->foki as $fokus => $fokusInfo) { if (strpos($key, $fokus . '_blpage') === 0 && preg_match($regexUrl, $value) === 1) { - Cookie::queue(Cookie::forever($key, $value, "/", null, true, true)); + Cookie::queue(Cookie::forever($key, $value, "/", null, $secure, true)); } elseif (strpos($key, $fokus . '_setting_') === 0) { foreach ($langFile->filter->{'parameter-filter'} as $parameter) { foreach ($parameter->values as $p => $v) { if ($key === $fokus . '_setting_' . $parameter->{'get-parameter'} && $value === $p) { - Cookie::queue(Cookie::forever($key, $value, "/", null, true, true)); + Cookie::queue(Cookie::forever($key, $value, "/", null, $secure, true)); } } } @@ -457,7 +463,15 @@ class SettingsController extends Controller } } } - return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), url('/'))); + + // Check if a redirect url is defined + if ($request->filled("redirect_url")) { + $url = $request->input("redirect_url"); + } else { + $url = LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), url('/')); + } + + return redirect($url); } private function loadBlacklist(Request $request) diff --git a/metager/app/Http/Middleware/LocalizationRedirect.php b/metager/app/Http/Middleware/LocalizationRedirect.php index e14e6dd251df45db53d70a6289a97347a5d5ad46..87241cf8f39727848fd7efb32c7a9cc51835723f 100644 --- a/metager/app/Http/Middleware/LocalizationRedirect.php +++ b/metager/app/Http/Middleware/LocalizationRedirect.php @@ -7,6 +7,7 @@ use Closure; use Cookie; use LaravelLocalization; use Illuminate\Http\Request; +use URL; class LocalizationRedirect { @@ -23,6 +24,12 @@ class LocalizationRedirect if ($request->is(['metrics', 'health-check/*'])) { return $next($request); } + if ($request->routeIs('loadSettings')) { + return $next($request); + } + if ($request->routeIs("lang-selector") && filter_var($request->input("switch", false), FILTER_VALIDATE_BOOL)) { + return $next($request); + } // Check for Localization in form of the old two letter country code and redirect to correct URL in that case // This can be removed at some point @@ -30,34 +37,47 @@ class LocalizationRedirect return $redirect; } + // Check if the locale present in the path is optional + if (preg_match("/^[a-z]{2}-[A-Z]{2}$/", $request->segment(1))) { + if (($redirect = $this->verifyPathLocaleNeeded($request)) !== null) { + return $redirect; + } + } + // Check if the current domain matches the language // It's metager.de for everything german and metager.org for everything else $lang = Localization::getLanguage(); $host = $request->getHost(); if ($lang === "de" && $host === "metager.org") { - $new_uri = "https://metager.de" . request()->getRequestUri(); + $new_uri = preg_replace("/^(https?:\/\/)metager.org/", "$1metager.de", url()->full()); + $new_uri = $this->migrateSettingsLink($new_uri); return redirect($new_uri); } - if (Cookie::has("web_setting_m") && !$request->routeIs("lang-selector")) { + if (Cookie::has("web_setting_m")) { // No locale defined in the path // Check if the user defined a permanent language setting matching one of our supported locales $setting_locale = str_replace("_", "-", Cookie::get("web_setting_m")); $availableLocales = LaravelLocalization::getSupportedLanguagesKeys(); + $current_locale = LaravelLocalization::getCurrentLocale(); + $new_url = LaravelLocalization::getLocalizedUrl($setting_locale, url()->full()); + $redirect_necessary = false; + if ($current_locale !== $setting_locale && in_array($setting_locale, $availableLocales)) { + $redirect_necessary = true; + } - if (config("app.default_locale", $setting_locale) !== $setting_locale && in_array($setting_locale, $availableLocales)) { - $new_url = LaravelLocalization::getLocalizedUrl($setting_locale, url()->full()); - if ($host === "metager.de" && $lang === "en") { - $new_url = str_replace("https://metager.de", "https://metager.org", $new_url); - } - return redirect($new_url); + // Also redirect if the user is on the wrong URL for the defined setting locale + if ($host === "metager.de" && strpos($setting_locale, "de") !== 0) { + $redirect_necessary = true; + $new_url = preg_replace("/^(https?:\/\/)metager.de/", "$1metager.org", $new_url); + } else if ($host === "metager.org" && strpos($setting_locale, "de") === 0) { + $redirect_necessary = true; + $new_url = preg_replace("/^(https?:\/\/)metager.org/", "$1metager.de", $new_url); } - } - // Check if the locale present in the path is optional - if (preg_match("/^[a-z]{2}-[A-Z]{2}$/", $request->segment(1))) { - if (($redirect = $this->verifyPathLocaleNeeded($request)) !== null) { - return $redirect; + if ($redirect_necessary) { + $new_url = $this->migrateSettingsLink($new_url); + return redirect($new_url); } } @@ -80,7 +100,7 @@ class LocalizationRedirect { $path_locale = $request->segment(1); $legacy_country_codes = [ - "uk" => "en-UK", + "uk" => "en-GB", "ie" => "en-IE", "es" => "es-ES", "at" => "de-AT" @@ -106,13 +126,50 @@ class LocalizationRedirect { $path_locale = $request->segment(1); // We already verified that this is indeed a locale within the path - $preferred_locale = Localization::GET_PREFERRED_LOCALE(); + $default_locale = config("app.default_locale"); - if ($preferred_locale === $path_locale && in_array(str_replace("_", "-", Cookie::get("web_setting_m", "")), ["", $preferred_locale])) { - return redirect(LaravelLocalization::getNonLocalizedURL(url()->full())); + if ($default_locale === $path_locale) { + // The user landed on a URL with path locale although it's his default language + $path = $request->getRequestUri(); + $new_path = preg_replace("/^\/$path_locale/", "", $path); + if ($path !== $new_path) { + return redirect($new_path); + } } return null; } + /** + * Generates a URL which migrates all the current settings to the new URL + * using load-settings and redirecting to target url afterwards + * + * @return string + */ + private function migrateSettingsLink($url) + { + $old_host = request()->getHost(); + $new_host = parse_url($url, PHP_URL_HOST); + if ($old_host === $new_host) { + return $url; + } + + // We can include all current cookies in the URL since the load-settings script will filter out the valid ones + $settings = [ + "redirect_url" => $url + ]; + // Read out all current settings + foreach (Cookie::get() as $key => $value) { + $settings[$key] = $value; + } + if (!array_key_exists("web_setting_m", $settings)) { + $settings["web_setting_m"] = str_replace("-", "_", LaravelLocalization::getCurrentLocale()); + } + + $settings_restore_url = URL::temporarySignedRoute('loadSettings', now()->addMinutes(5), $settings); + $settings_restore_url = str_replace($old_host, $new_host, $settings_restore_url); + + return $settings_restore_url; + } + } \ No newline at end of file diff --git a/metager/app/Localization.php b/metager/app/Localization.php index 0bccebfa54ad0fde34c402c43c8a2c69978d92b0..312fa0152d08b1b84c02baac325c5913bc38aef2 100644 --- a/metager/app/Localization.php +++ b/metager/app/Localization.php @@ -32,30 +32,26 @@ class Localization $path_locale = request()->segment(1); $guessed_locale = self::GET_PREFERRED_LOCALE($locale); + $default_locale = $locale; $supported_languages = LaravelLocalization::getSupportedLanguagesKeys(); if (preg_match("/^[a-z]{2}-[A-Z]{2}$/", $path_locale) || in_array($path_locale, LaravelLocalization::getSupportedLanguagesKeys())) { $locale = $path_locale; - if (str_replace("_", "-", Cookie::get("web_setting_m")) !== $locale) { - Cookie::queue(Cookie::forever("web_setting_m", str_replace("-", "_", $locale), "/", null, false, true)); - } } else { $path_locale = ""; - $default_locale = $locale; - if (!preg_match("/^[a-z]{2}-[A-Z]{2}$/", $path_locale) || !in_array($path_locale, LaravelLocalization::getSupportedLanguagesKeys())) { - // We will guess a locale only for metager.org or if the guessed locale is a german language - // There is a lot of traffic on metager.de with a en_US agent and I don't know yet if that's - // a misconfigured useragent or indeed the correct language setting - if (request()->getHost() !== "metager.de" || strpos($guessed_locale, "de") === 0) { - $locale = $guessed_locale; - $default_locale = $locale; - } - } - if (in_array(str_replace("_", "-", Cookie::get("web_setting_m", "")), $supported_languages)) { - $locale = str_replace("_", "-", Cookie::get("web_setting_m")); + // We will guess a locale only for metager.org or if the guessed locale is a german language + // There is a lot of traffic on metager.de with a en_US agent and I don't know yet if that's + // a misconfigured useragent or indeed the correct language setting + if (empty($path_locale) && request()->getHost() !== "metager.de" || strpos($guessed_locale, "de") === 0) { + $locale = $guessed_locale; } - // Update default Locale so it can be stripped from the path - config(["app.locale" => $locale, "app.default_locale" => $default_locale, "laravellocalization.localesMapping" => [$default_locale => "default"]]); } + + if (request()->getHost() !== "metager.de" || strpos($guessed_locale, "de") === 0) { + $default_locale = $guessed_locale; + } + + // Update default Locale so it can be stripped from the path + config(["app.locale" => $locale, "app.default_locale" => $default_locale, "laravellocalization.localesMapping" => [$default_locale => "default"]]); App::setLocale($locale); // Our locale includes the requested region however our translated strings are not differentiating regions @@ -147,7 +143,7 @@ class Localization "de" => "de_DE", "en" => "en_US", "es" => "es_ES", - "en_GB" => "en_UK", + "en_UK" => "en_GB", ]; $regional_locales = array_merge($regional_locales, array_keys($two_letter_locales)); diff --git a/metager/config/laravellocalization.php b/metager/config/laravellocalization.php index edc26126519a521a042f1faacaf4129a2cb5495b..5caaf1f2522fa808c81980a55a642e40274734fd 100644 --- a/metager/config/laravellocalization.php +++ b/metager/config/laravellocalization.php @@ -48,7 +48,7 @@ return [ //'guz' => ['name' => 'Ekegusii', 'script' => 'Latn', 'native' => 'Ekegusii', 'regional' => ''], //'en' => ['name' => 'English', 'script' => 'Latn', 'native' => 'English', 'regional' => 'en_GB'], //'en-AU' => ['name' => 'English (AU)', 'script' => 'Latn', 'native' => 'English (Australia)', 'regional' => 'en_AU'], - 'en-UK' => ['name' => 'English (UK)', 'script' => 'Latn', 'native' => 'English (United Kingdom)', 'regional' => 'en_UK'], + 'en-GB' => ['name' => 'English (Great Britain)', 'script' => 'Latn', 'native' => 'English (Great Britain)', 'regional' => 'en_GB'], //'en-CA' => ['name' => 'Canadian English', 'script' => 'Latn', 'native' => 'Canadian English', 'regional' => 'en_CA'], 'en-US' => ['name' => 'English (US)', 'script' => 'Latn', 'native' => 'English (USA)', 'regional' => 'en_US'], 'en-IE' => ['name' => 'English (Ireland)', 'script' => 'Latn', 'native' => 'English (Ireland)', 'regional' => 'en_IE'], diff --git a/metager/lang/en/metaGer.php b/metager/lang/en/metaGer.php index 54ed0d0ec9ab9435e4ee0821b31591aa8ef0d9fb..4144af880ee218028341328ca530c3f4be78c911 100644 --- a/metager/lang/en/metaGer.php +++ b/metager/lang/en/metaGer.php @@ -1,172 +1,172 @@ <?php return [ - 'results' => [ - 'failed' => 'Unfortunately we have no results for your search.', + 'results' => [ + 'failed' => 'Unfortunately we have no results for your search.', 'failedSitesearch' => 'Unfortunately we have no results for your search. This might be the case because your current search is restricted to the website ":site". If you want to remove this restriction, click here: <a href=":altSearch">New Search</a>', - 'name' => 'Results', + 'name' => 'Results', ], - 'settings' => [ - 'noneSelected' => 'Attention: you did not choose any search engine.', - 'name' => 'Settings', + 'settings' => [ + 'noneSelected' => 'Attention: you did not choose any search engine.', + 'name' => 'Settings', 'metager-key-hint' => 'Some filters require a <a href=":link" target="_blank">MetaGer key</a>.', ], - 'engines' => [ - 'noParser' => 'There is an error: Requesting \\":engine\\" failed. Please report to our <a href=\\"/en/kontakt\\">contact form</a>', + 'engines' => [ + 'noParser' => 'There is an error: Requesting \\":engine\\" failed. Please report to our <a href=\\"/en/kontakt\\">contact form</a>', 'noSpecialSearch' => 'There was no search engine supporting one of your filter options. Filters currently active: ":filter".', ], - 'formdata' => [ - 'cantLoad' => 'Could not find suma-file', - 'noSearch' => 'Attention: you did not type in any search word/s. Please type search words and try again', - 'dartEurope' => 'Hint: you have activated Dart-Europe. Therefore the response time might be longer and is set to 10 sec', - 'hostBlacklist' => 'Results of the following domains will not be shown: \\":host\\"', - 'hostBlacklistCount' => 'Results of :count hosts will not be shown.', - 'domainBlacklist' => 'These domains get ignored: \\":domain\\"', + 'formdata' => [ + 'cantLoad' => 'Could not find suma-file', + 'noSearch' => 'Attention: you did not type in any search word/s. Please type search words and try again', + 'dartEurope' => 'Hint: you have activated Dart-Europe. Therefore the response time might be longer and is set to 10 sec', + 'hostBlacklist' => 'Results of the following domains will not be shown: \\":host\\"', + 'hostBlacklistCount' => 'Results of :count hosts will not be shown.', + 'domainBlacklist' => 'These domains get ignored: \\":domain\\"', 'domainBlacklistCount' => 'Results of :count domains will not be shown.', - 'urlBlacklist' => 'Results containing \\":url\\" are not shown.', - 'stopwords' => 'You have excluded results with the following words: \\":stopwords\\"', - 'phrase' => 'You are doing a string search: :phrase', + 'urlBlacklist' => 'Results containing \\":url\\" are not shown.', + 'stopwords' => 'You have excluded results with the following words: \\":stopwords\\"', + 'phrase' => 'You are doing a string search: :phrase', ], 'sitesearch' => [ - 'failed' => 'You intend to do a site search on :site. Unfortunately the chosen search engines do not support that. You can do a site search <a href=\\":searchLink\\">here</a> within the Web focus', + 'failed' => 'You intend to do a site search on :site. Unfortunately the chosen search engines do not support that. You can do a site search <a href=\\":searchLink\\">here</a> within the Web focus', 'success' => 'You are doing a site search. Only results of the website <a href=\\"http://:site\\" target=\\"_blank\\" rel=\\"noopener\\">\\":site\\"</a> will be shown.', ], - 'feedback' => 'Not what you were looking for? Give us feedback: ', - 'filter' => [ - 'noFilter' => 'Any', - 'reset' => 'Reset filter', - 'sitesearch' => 'Sitesearch', - 'safesearch' => [ - 'strict' => 'Strict', + 'feedback' => 'Not what you were looking for? Give us feedback: ', + 'filter' => [ + 'noFilter' => 'Any', + 'reset' => 'Reset filter', + 'sitesearch' => 'Sitesearch', + 'safesearch' => [ + 'strict' => 'Strict', 'moderate' => 'Moderate', - 'off' => 'Off', - 'name' => 'Safe Search', + 'off' => 'Off', + 'name' => 'Safe Search', ], - 'size' => [ - 'small' => 'Small', - 'medium' => 'Medium', - 'large' => 'Large', + 'size' => [ + 'small' => 'Small', + 'medium' => 'Medium', + 'large' => 'Large', 'xtralarge' => 'Extra large', - 'name' => 'Image size', + 'name' => 'Image size', ], - 'color' => [ - 'colorOnly' => 'Only coloured', - 'monochrome' => 'Black and white', - 'black' => 'Black', - 'blue' => 'Blue', - 'brown' => 'Brown', - 'gray' => 'Grey', - 'green' => 'Green', - 'orange' => 'Orange', - 'pink' => 'Pink', - 'purple' => 'Purple', - 'red' => 'Red', - 'teal' => 'Teal', - 'white' => 'White', - 'yellow' => 'Yellow', - 'name' => 'Colour', + 'color' => [ + 'colorOnly' => 'Only coloured', + 'monochrome' => 'Black and white', + 'black' => 'Black', + 'blue' => 'Blue', + 'brown' => 'Brown', + 'gray' => 'Grey', + 'green' => 'Green', + 'orange' => 'Orange', + 'pink' => 'Pink', + 'purple' => 'Purple', + 'red' => 'Red', + 'teal' => 'Teal', + 'white' => 'White', + 'yellow' => 'Yellow', + 'name' => 'Colour', 'transparent' => 'Transparent', - 'turquoise' => 'Turquoise', + 'turquoise' => 'Turquoise', ], - 'imagetype' => [ - 'photo' => 'Photo', - 'clipart' => 'Graphic', - 'strich' => 'Line drawing', - 'gif' => 'Animated GIF', + 'imagetype' => [ + 'photo' => 'Photo', + 'clipart' => 'Graphic', + 'strich' => 'Line drawing', + 'gif' => 'Animated GIF', 'transparent' => 'Transparent', - 'name' => 'Type', - 'vector' => 'Vector graphic', + 'name' => 'Type', + 'vector' => 'Vector graphic', ], - 'imageaspect' => [ + 'imageaspect' => [ 'square' => 'Rectangle', - 'wide' => 'Wide', - 'tall' => 'Portrait', - 'name' => 'Layout', + 'wide' => 'Wide', + 'tall' => 'Portrait', + 'name' => 'Layout', ], - 'imagecontent' => [ - 'face' => 'Close look', + 'imagecontent' => [ + 'face' => 'Close look', 'portrait' => 'Head & Shoulders', - 'name' => 'People', + 'name' => 'People', ], - 'imagelicense' => [ - 'any' => 'Unselected', - 'public' => 'Public Domain', - 'share' => 'Share', - 'sharecommercially' => 'Share (commercially)', - 'modify' => 'Modify', + 'imagelicense' => [ + 'any' => 'Unselected', + 'public' => 'Public Domain', + 'share' => 'Share', + 'sharecommercially' => 'Share (commercially)', + 'modify' => 'Modify', 'modifycommercially' => 'Modify (commercially)', - 'name' => 'License', + 'name' => 'License', ], - 'freshness' => [ - 'day' => 'Last 24h', - 'week' => 'Last week', - 'month' => 'Last month', - 'year' => 'Last year', + 'freshness' => [ + 'day' => 'Last 24h', + 'week' => 'Last week', + 'month' => 'Last month', + 'year' => 'Last year', 'custom' => 'Customized', - 'name' => 'Date', + 'name' => 'Date', ], 'customdatetitle' => 'Pick customized date', - 'market' => [ - 'ga' => 'German (Austria)', - 'gg' => 'German (Germany)', - 'gs' => 'German (Switzerland)', - 'ea' => 'English (Australia)', - 'ec' => 'English (Canada)', - 'ei' => 'English (India)', - 'eir' => 'English (Ireland)', - 'ein' => 'English (Indonesia)', - 'em' => 'English (Malaysia)', - 'enz' => 'English (New Zealand)', - 'ep' => 'English (Philippines)', - 'esa' => 'English (South-Africa)', - 'euk' => 'English (UK)', - 'eus' => 'English (US)', - 'sa' => 'Spanish (Argentina)', - 'sc' => 'Spanish (Chile)', - 'sm' => 'Spanish (Mexiko)', - 'ss' => 'Spanish (Spain)', - 'sus' => 'Spanish (US)', - 'fb' => 'French (Belgien)', - 'fc' => 'French (Kanada)', - 'ff' => 'French (Frankreich)', - 'fs' => 'French (Schweiz)', - 'ii' => 'Italian (Italien)', - 'db' => 'Dutch (Belgium)', - 'dn' => 'Dutch (Netherlands)', - 'pp' => 'Polish (Poland)', - 'pb' => 'Portuguese (Brasil)', - 'dd' => 'Danish (Denmark)', - 'fif' => 'Finnish (Finland)', - 'nn' => 'Norwegian (Norway)', - 'scs' => 'Swedish (Sweden)', - 'rr' => 'Russian (Russia)', - 'jj' => 'Japanese (Japan)', - 'kk' => 'Korean (Korea)', - 'tt' => 'Turkish (Turkey)', - 'chk' => 'Chinese (Hong Kong SAR)', - 'cc' => 'Chinese (China)', - 'ct' => 'Chinese (Taiwan)', + 'market' => [ + 'ga' => 'German (Austria)', + 'gg' => 'German (Germany)', + 'gs' => 'German (Switzerland)', + 'ea' => 'English (Australia)', + 'ec' => 'English (Canada)', + 'ei' => 'English (India)', + 'eir' => 'English (Ireland)', + 'ein' => 'English (Indonesia)', + 'em' => 'English (Malaysia)', + 'enz' => 'English (New Zealand)', + 'ep' => 'English (Philippines)', + 'esa' => 'English (South-Africa)', + 'euk' => 'English (Great Britain)', + 'eus' => 'English (US)', + 'sa' => 'Spanish (Argentina)', + 'sc' => 'Spanish (Chile)', + 'sm' => 'Spanish (Mexiko)', + 'ss' => 'Spanish (Spain)', + 'sus' => 'Spanish (US)', + 'fb' => 'French (Belgien)', + 'fc' => 'French (Kanada)', + 'ff' => 'French (Frankreich)', + 'fs' => 'French (Schweiz)', + 'ii' => 'Italian (Italien)', + 'db' => 'Dutch (Belgium)', + 'dn' => 'Dutch (Netherlands)', + 'pp' => 'Polish (Poland)', + 'pb' => 'Portuguese (Brasil)', + 'dd' => 'Danish (Denmark)', + 'fif' => 'Finnish (Finland)', + 'nn' => 'Norwegian (Norway)', + 'scs' => 'Swedish (Sweden)', + 'rr' => 'Russian (Russia)', + 'jj' => 'Japanese (Japan)', + 'kk' => 'Korean (Korea)', + 'tt' => 'Turkish (Turkey)', + 'chk' => 'Chinese (Hong Kong SAR)', + 'cc' => 'Chinese (China)', + 'ct' => 'Chinese (Taiwan)', 'name' => 'Language', ], - 'sort' => [ - 'priceascending' => 'Price (ascending)', - 'pricedescending' => 'Price (descending)', - 'totalpriceascending' => 'Total Price (ascending)', + 'sort' => [ + 'priceascending' => 'Price (ascending)', + 'pricedescending' => 'Price (descending)', + 'totalpriceascending' => 'Total Price (ascending)', 'totalpricedescending' => 'Total Price (descending)', - 'name' => 'Sort By', + 'name' => 'Sort By', ], - 'rabate' => 'Min. Rabate', - 'count' => 'Count', - 'skip' => 'Skip', - 'min' => 'Minimum sleep (in s)', - 'max' => 'Maximum sleep (in s)', + 'rabate' => 'Min. Rabate', + 'count' => 'Count', + 'skip' => 'Skip', + 'min' => 'Minimum sleep (in s)', + 'max' => 'Maximum sleep (in s)', ], - 'ads' => [ + 'ads' => [ 'own' => [ - 'title' => 'Support MetaGer', + 'title' => 'Support MetaGer', 'description' => 'With your donation you support the maintenance and further development of the independent search engine metager.de and the work of the non-profit association SUMA-EV.', ], ], 'prevention' => [ 'phrase' => '<h2>Do you need help?</h2> Do you have negative thoughts or want to talk to someone? On our <a href=":prevurl" target="_blank"> prevention page</a> you will find a list of help facilities you can turn to.', ], -]; +]; \ No newline at end of file diff --git a/metager/resources/views/lang-selector.blade.php b/metager/resources/views/lang-selector.blade.php index 179da21c404eea2d3f8def2e8cff8e6b6077c8f3..1fbf8c1777958dfe87cb1de36e70d5ed795b265b 100644 --- a/metager/resources/views/lang-selector.blade.php +++ b/metager/resources/views/lang-selector.blade.php @@ -15,7 +15,7 @@ @if(LaravelLocalization::getCurrentLocale() === $locale) <li class="active">{{ $locale_native }}</li> @else - <li><a rel="alternate" hreflang="{{ $locale }}" href="{{ LaravelLocalization::getLocalizedURL($locale, route("lang-selector", ["previous_url" => $previous_url]), true) }}">{{ $locale_native }}</a></li> + <li><a rel="alternate" hreflang="{{ $locale }}" href="{{ LaravelLocalization::getLocalizedURL($locale, route("lang-selector", ["previous_url" => $previous_url, 'switch' => true]), true) }}">{{ $locale_native }}</a></li> @endif @endforeach </ul>