mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
added auto lang switcher for browser
This commit is contained in:
parent
8884e1be03
commit
e625fc7fd6
@ -22,9 +22,9 @@ return [
|
||||
'fields' => [
|
||||
'latest-limit',
|
||||
'popular_ads_limit',
|
||||
'ads_image_limit',
|
||||
'default_view_type',
|
||||
'price_area_hidden',
|
||||
'ads_image_limit',
|
||||
'default_view_type',
|
||||
'price_area_hidden',
|
||||
'hide_listing_standard_price',
|
||||
'hide_zero_price',
|
||||
'auto_approve',
|
||||
@ -83,6 +83,7 @@ return [
|
||||
'translations' => [
|
||||
'title' => 'visiosoft.module.advs::section.translations',
|
||||
'fields' => [
|
||||
'lang_switcher_for_browser',
|
||||
'override_text',
|
||||
],
|
||||
],
|
||||
|
||||
@ -153,12 +153,12 @@ return [
|
||||
'mode' => 'checkbox'
|
||||
]
|
||||
],
|
||||
'price_area_hidden' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'config' => [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
'price_area_hidden' => [
|
||||
'type' => 'anomaly.field_type.boolean',
|
||||
'config' => [
|
||||
'default_value' => false,
|
||||
]
|
||||
],
|
||||
'enabled_currencies' => [
|
||||
'bind' => 'streams::currencies.enabled',
|
||||
'env' => 'ADV_ENABLED_CURRENCIES',
|
||||
@ -351,21 +351,26 @@ return [
|
||||
'env' => 'OVERRIDE_TEXT',
|
||||
],
|
||||
'steps_color' => [
|
||||
"type" => "anomaly.field_type.colorpicker",
|
||||
"type" => "anomaly.field_type.colorpicker",
|
||||
"config" => [
|
||||
"default_value" => '#209579',
|
||||
]
|
||||
],
|
||||
'create_ad_button_color' => [
|
||||
"type" => "anomaly.field_type.colorpicker",
|
||||
"type" => "anomaly.field_type.colorpicker",
|
||||
"config" => [
|
||||
"default_value" => '#00a651',
|
||||
]
|
||||
],
|
||||
'ads_image_limit' => [
|
||||
"type" => "anomaly.field_type.integer",
|
||||
"config" => [
|
||||
"default_value" => 25
|
||||
]
|
||||
]
|
||||
'ads_image_limit' => [
|
||||
"type" => "anomaly.field_type.integer",
|
||||
"config" => [
|
||||
"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',
|
||||
'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',
|
||||
'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()
|
||||
{
|
||||
//
|
||||
//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