mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 23:36:08 -06:00
added auto lang switcher for browser
This commit is contained in:
parent
8884e1be03
commit
e625fc7fd6
@ -83,6 +83,7 @@ return [
|
|||||||
'translations' => [
|
'translations' => [
|
||||||
'title' => 'visiosoft.module.advs::section.translations',
|
'title' => 'visiosoft.module.advs::section.translations',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
|
'lang_switcher_for_browser',
|
||||||
'override_text',
|
'override_text',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -367,5 +367,10 @@ return [
|
|||||||
"config" => [
|
"config" => [
|
||||||
"default_value" => 25
|
"default_value" => 25
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'lang_switcher_for_browser' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'bind' => 'advs.lang_switcher_for_browser',
|
||||||
|
'env' => 'LANG_SWITCHER_FOR_BROWSER',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -219,4 +219,8 @@ return [
|
|||||||
'name' => 'Create Ad Button Color',
|
'name' => 'Create Ad Button Color',
|
||||||
'instructions' => 'Changes the button that shows up when the new ad category selection is finished.'
|
'instructions' => 'Changes the button that shows up when the new ad category selection is finished.'
|
||||||
],
|
],
|
||||||
|
'lang_switcher_for_browser' => [
|
||||||
|
'name' => 'Lang Switcher For Browser',
|
||||||
|
'instructions' => 'Allows you to choose browser language as active language'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -219,4 +219,8 @@ return [
|
|||||||
'name' => 'Reklam Düğmesi Rengi Oluştur',
|
'name' => 'Reklam Düğmesi Rengi Oluştur',
|
||||||
'instructions' => 'Yeni reklam kategorisi seçimi bittiğinde görünen düğmeyi değiştirir.'
|
'instructions' => 'Yeni reklam kategorisi seçimi bittiğinde görünen düğmeyi değiştirir.'
|
||||||
],
|
],
|
||||||
|
'lang_switcher_for_browser' => [
|
||||||
|
'name' => 'Tarayıcı Diline Geç',
|
||||||
|
'instructions' => 'Seçili aktif bir dil olmadığında tarayıcı dilini aktif dil olarak seçmenize izin verir'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -14,7 +14,16 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
//Auto Language Switcher
|
||||||
|
view()->composer('*', function ($view) {
|
||||||
|
if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale'))) {
|
||||||
|
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);//Get Browser Language
|
||||||
|
$acceptLang = config('streams::locales.enabled'); //Supported Language
|
||||||
|
$lang = in_array($lang, $acceptLang) ? $lang : config('streams::locales.default', 'en');
|
||||||
|
App()->setLocale($lang);
|
||||||
|
Request()->session()->put('_locale', $lang);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user