Merge pull request #888 from openclassify/vedatakd

added auto lang switcher for browser
This commit is contained in:
Muammer Top 2020-12-30 16:54:15 +03:00 committed by GitHub
commit 8d4fffff73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 25 deletions

View File

@ -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',
],
],

View File

@ -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',
],
];

View File

@ -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'
],
];

View File

@ -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'
],
];

View File

@ -1,12 +1,13 @@
<?php
return [
'choose_file' => 'Which file would you like to use?',
'choose_folder' => 'Which folder would you like to upload to?',
'upload' => 'Click or drop files here to upload.',
'choose_file' => 'Which file would you like to use?',
'choose_folder' => 'Which folder would you like to upload to?',
'upload' => 'Click or drop files here to upload.',
'no_file_selected' => 'No file selected.',
'no_uploads' => 'No files uploaded.',
'overwrite' => 'has already been uploaded. Would you like to overwrite it?',
'uploading' => 'Uploading',
'loading' => 'Loading',
'no_uploads' => 'No files uploaded.',
'overwrite' => 'has already been uploaded. Would you like to overwrite it?',
'uploading' => 'Uploading',
'loading' => 'Loading',
'choose_file_option' => 'Choose File Option',
];

View File

@ -9,4 +9,5 @@ return [
'overwrite' => 'daha önce yüklenmiş. Üzerine kaydetmek ister misiniz?',
'uploading' => 'Karşıya Yükleniyor',
'loading' => 'Yükleniyor',
'choose_file_option' => 'Bir Dosya Seçin',
];

View File

@ -10,6 +10,7 @@
<a data-toggle="modal"
data-target="#{{ field_type.input_name }}-modal" {% if field_type.config.folders|length == 1 %} href="{{ url('streams/singlefile-field_type/upload/' ~ field_type.config.folders|first) }}" {% else %} href="{{ url('streams/singlefile-field_type/choose/' ~ field_type.config_key) }}" {% endif %}
class="btn btn-success btn-xs">{{ trans('visiosoft.field_type.singlefile::button.upload') }}</a>
{{ trans('visiosoft.field_type.singlefile::message.choose_file_option') }}
{% endif %}
{% endif %}

View File

@ -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);
}
});
}
/**