Merge pull request #364 from 1day2die/language_in_new_settings
Language in new settings
This commit is contained in:
commit
63f788becc
10 changed files with 196 additions and 285 deletions
43
app/Classes/Settings/LanguageSettingsC.php
Normal file
43
app/Classes/Settings/LanguageSettingsC.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Classes\Settings;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LanguageSettingsC
|
||||
{
|
||||
public $tabTitle = 'Language Settings';
|
||||
public $languageSettings;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function updateLanguageSettings(Request $request)
|
||||
{
|
||||
|
||||
$values = [
|
||||
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
||||
"SETTINGS::LOCALE:DEFAULT" => "defaultLanguage",
|
||||
"SETTINGS::LOCALE:DYNAMIC" => "autotranslate",
|
||||
"SETTINGS::LOCALE:CLIENTS_CAN_CHANGE" => "canClientChangeLanguage",
|
||||
"SETTINGS::LOCALE:AVAILABLE" => "languages",
|
||||
"SETTINGS::LOCALE:DATATABLES" => "datatable-language"
|
||||
];
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
Settings::where('key', $key)->update(['value' => $request->get($value)]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
Session::remove("locale");
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('admin.settings.index')->with('success', 'Language settings updated!');
|
||||
}
|
||||
|
||||
}
|
|
@ -18,4 +18,6 @@ class TranslationController extends Controller
|
|||
Session::put('locale', $request->inputLocale);
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
@ -9,194 +10,6 @@ use Illuminate\Support\Facades\Session;
|
|||
|
||||
class SetLocale
|
||||
{
|
||||
function getLocaleCodeForDisplayLanguage($name){
|
||||
$languageCodes = array(
|
||||
"aa" => "Afar",
|
||||
"ab" => "Abkhazian",
|
||||
"ae" => "Avestan",
|
||||
"af" => "Afrikaans",
|
||||
"ak" => "Akan",
|
||||
"am" => "Amharic",
|
||||
"an" => "Aragonese",
|
||||
"ar" => "Arabic",
|
||||
"as" => "Assamese",
|
||||
"av" => "Avaric",
|
||||
"ay" => "Aymara",
|
||||
"az" => "Azerbaijani",
|
||||
"ba" => "Bashkir",
|
||||
"be" => "Belarusian",
|
||||
"bg" => "Bulgarian",
|
||||
"bh" => "Bihari",
|
||||
"bi" => "Bislama",
|
||||
"bm" => "Bambara",
|
||||
"bn" => "Bengali",
|
||||
"bo" => "Tibetan",
|
||||
"br" => "Breton",
|
||||
"bs" => "Bosnian",
|
||||
"ca" => "Catalan",
|
||||
"ce" => "Chechen",
|
||||
"ch" => "Chamorro",
|
||||
"co" => "Corsican",
|
||||
"cr" => "Cree",
|
||||
"cs" => "Czech",
|
||||
"cu" => "Church Slavic",
|
||||
"cv" => "Chuvash",
|
||||
"cy" => "Welsh",
|
||||
"da" => "Danish",
|
||||
"de" => "German",
|
||||
"dv" => "Divehi",
|
||||
"dz" => "Dzongkha",
|
||||
"ee" => "Ewe",
|
||||
"el" => "Greek",
|
||||
"en" => "English",
|
||||
"eo" => "Esperanto",
|
||||
"es" => "Spanish",
|
||||
"et" => "Estonian",
|
||||
"eu" => "Basque",
|
||||
"fa" => "Persian",
|
||||
"ff" => "Fulah",
|
||||
"fi" => "Finnish",
|
||||
"fj" => "Fijian",
|
||||
"fo" => "Faroese",
|
||||
"fr" => "French",
|
||||
"fy" => "Western Frisian",
|
||||
"ga" => "Irish",
|
||||
"gd" => "Scottish Gaelic",
|
||||
"gl" => "Galician",
|
||||
"gn" => "Guarani",
|
||||
"gu" => "Gujarati",
|
||||
"gv" => "Manx",
|
||||
"ha" => "Hausa",
|
||||
"he" => "Hebrew",
|
||||
"hi" => "Hindi",
|
||||
"ho" => "Hiri Motu",
|
||||
"hr" => "Croatian",
|
||||
"ht" => "Haitian",
|
||||
"hu" => "Hungarian",
|
||||
"hy" => "Armenian",
|
||||
"hz" => "Herero",
|
||||
"ia" => "Interlingua (International Auxiliary Language Association)",
|
||||
"id" => "Indonesian",
|
||||
"ie" => "Interlingue",
|
||||
"ig" => "Igbo",
|
||||
"ii" => "Sichuan Yi",
|
||||
"ik" => "Inupiaq",
|
||||
"io" => "Ido",
|
||||
"is" => "Icelandic",
|
||||
"it" => "Italian",
|
||||
"iu" => "Inuktitut",
|
||||
"ja" => "Japanese",
|
||||
"jv" => "Javanese",
|
||||
"ka" => "Georgian",
|
||||
"kg" => "Kongo",
|
||||
"ki" => "Kikuyu",
|
||||
"kj" => "Kwanyama",
|
||||
"kk" => "Kazakh",
|
||||
"kl" => "Kalaallisut",
|
||||
"km" => "Khmer",
|
||||
"kn" => "Kannada",
|
||||
"ko" => "Korean",
|
||||
"kr" => "Kanuri",
|
||||
"ks" => "Kashmiri",
|
||||
"ku" => "Kurdish",
|
||||
"kv" => "Komi",
|
||||
"kw" => "Cornish",
|
||||
"ky" => "Kirghiz",
|
||||
"la" => "Latin",
|
||||
"lb" => "Luxembourgish",
|
||||
"lg" => "Ganda",
|
||||
"li" => "Limburgish",
|
||||
"ln" => "Lingala",
|
||||
"lo" => "Lao",
|
||||
"lt" => "Lithuanian",
|
||||
"lu" => "Luba-Katanga",
|
||||
"lv" => "Latvian",
|
||||
"mg" => "Malagasy",
|
||||
"mh" => "Marshallese",
|
||||
"mi" => "Maori",
|
||||
"mk" => "Macedonian",
|
||||
"ml" => "Malayalam",
|
||||
"mn" => "Mongolian",
|
||||
"mr" => "Marathi",
|
||||
"ms" => "Malay",
|
||||
"mt" => "Maltese",
|
||||
"my" => "Burmese",
|
||||
"na" => "Nauru",
|
||||
"nb" => "Norwegian Bokmal",
|
||||
"nd" => "North Ndebele",
|
||||
"ne" => "Nepali",
|
||||
"ng" => "Ndonga",
|
||||
"nl" => "Dutch",
|
||||
"nn" => "Norwegian Nynorsk",
|
||||
"no" => "Norwegian",
|
||||
"nr" => "South Ndebele",
|
||||
"nv" => "Navajo",
|
||||
"ny" => "Chichewa",
|
||||
"oc" => "Occitan",
|
||||
"oj" => "Ojibwa",
|
||||
"om" => "Oromo",
|
||||
"or" => "Oriya",
|
||||
"os" => "Ossetian",
|
||||
"pa" => "Panjabi",
|
||||
"pi" => "Pali",
|
||||
"pl" => "Polish",
|
||||
"ps" => "Pashto",
|
||||
"pt" => "Portuguese",
|
||||
"qu" => "Quechua",
|
||||
"rm" => "Raeto-Romance",
|
||||
"rn" => "Kirundi",
|
||||
"ro" => "Romanian",
|
||||
"ru" => "Russian",
|
||||
"rw" => "Kinyarwanda",
|
||||
"sa" => "Sanskrit",
|
||||
"sc" => "Sardinian",
|
||||
"sd" => "Sindhi",
|
||||
"se" => "Northern Sami",
|
||||
"sg" => "Sango",
|
||||
"si" => "Sinhala",
|
||||
"sk" => "Slovak",
|
||||
"sl" => "Slovenian",
|
||||
"sm" => "Samoan",
|
||||
"so" => "Somali",
|
||||
"sq" => "Albanian",
|
||||
"sr" => "Serbian",
|
||||
"ss" => "Swati",
|
||||
"st" => "Southern Sotho",
|
||||
"su" => "Sundanese",
|
||||
"sv" => "Swedish",
|
||||
"sw" => "Swahili",
|
||||
"ta" => "Tamil",
|
||||
"te" => "Telugu",
|
||||
"tg" => "Tajik",
|
||||
"th" => "Thai",
|
||||
"ti" => "Tigrinya",
|
||||
"tk" => "Turkmen",
|
||||
"tl" => "Tagalog",
|
||||
"tn" => "Tswana",
|
||||
"to" => "Tonga",
|
||||
"tr" => "Turkish",
|
||||
"ts" => "Tsonga",
|
||||
"tt" => "Tatar",
|
||||
"tw" => "Twi",
|
||||
"ty" => "Tahitian",
|
||||
"ug" => "Uighur",
|
||||
"uk" => "Ukrainian",
|
||||
"ur" => "Urdu",
|
||||
"uz" => "Uzbek",
|
||||
"ve" => "Venda",
|
||||
"vi" => "Vietnamese",
|
||||
"vo" => "Volapuk",
|
||||
"wa" => "Walloon",
|
||||
"wo" => "Wolof",
|
||||
"xh" => "Xhosa",
|
||||
"yi" => "Yiddish",
|
||||
"yo" => "Yoruba",
|
||||
"za" => "Zhuang",
|
||||
"zh" => "Chinese",
|
||||
"zu" => "Zulu"
|
||||
);
|
||||
return array_search($name, array_flip($languageCodes));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -208,22 +21,20 @@ class SetLocale
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
if (Session::has('locale')) {
|
||||
$locale = Session::get('locale', config('app.locale'));
|
||||
if (Session::has('locale')) {
|
||||
$locale = Session::get('locale', Settings::getValueByKey("SETTINGS::LOCALE:DEFAULT"));
|
||||
} else {
|
||||
if (!Settings::getValueByKey("SETTINGS::LOCALE:DYNAMIC")=="true") {
|
||||
$locale = Settings::getValueByKey("SETTINGS::LOCALE:DEFAULT");
|
||||
} else {
|
||||
if (!config('app.dynamic_locale')) {
|
||||
$locale = config('app.locale');
|
||||
}else{
|
||||
$locale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2);
|
||||
|
||||
if (!in_array($locale, config('app.available_locales'))
|
||||
|| in_array(strtolower($this->getLocaleCodeForDisplayLanguage($locale)), UNSUPPORTED_LANGS)) {
|
||||
$locale = config('app.locale');
|
||||
}
|
||||
$locale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2);
|
||||
|
||||
if (!in_array($locale, json_decode(Settings::getValueByKey("SETTINGS::LOCALE:AVAILABLE")))) {
|
||||
$locale = Settings::getValueByKey("SETTINGS::LOCALE:DEFAULT");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
App::setLocale($locale);
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Settings;
|
||||
|
||||
return [
|
||||
|
||||
'version' => '0.6.2',
|
||||
|
@ -70,16 +72,6 @@ return [
|
|||
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Dyamic Locales
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Change the Locale depending on the Users Browserlanguage
|
||||
| Can either be true or false
|
||||
|
|
||||
*/
|
||||
'dynamic_locale' => env('DYNAMIC_LOCALE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -92,47 +84,20 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'locale' => env('LOCALE', 'en'),
|
||||
|
||||
'locale' =>"en",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Available Locales
|
||||
| Available Languages
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You should not change this
|
||||
| If the dashboard is 100% translated in a certain language, it will be added here
|
||||
|
|
||||
*/
|
||||
'available_locales' => array('English'=>'en','German'=>'de','Italian'=>'it','Chinese'=>'zh', 'Czech'=>'cs', 'Spanish'=>'es', 'Polish'=>'pl'),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Unsupported Locales
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Locales the Owner of the Dashboard does not want to support
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'unsupported_locales' => env("UNSUPPORTED_LOCALES", ""),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Datatable Language Setting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Language-Code used on the Datatables.
|
||||
| You can grab the Language-Codes from this Website
|
||||
| https://datatables.net/plug-ins/i18n/
|
||||
|
|
||||
*/
|
||||
|
||||
'datatable_locale' => env('DATATABLE_LOCALE', 'en-gb'),
|
||||
|
||||
'available_locales' =>["en","cs","de","es","fr","hi","it","pl","zh"],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -205,5 +205,46 @@ class SettingsSeeder extends Seeder
|
|||
'type' => 'string',
|
||||
'description' => 'The invoice prefix'
|
||||
]);
|
||||
|
||||
//Locale
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::LOCALE:DEFAULT',
|
||||
], [
|
||||
'value' => 'en',
|
||||
'type' => 'string',
|
||||
'description' => 'The default Language the dashboard will be shown in'
|
||||
]);
|
||||
//Dynamic locale
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::LOCALE:DYNAMIC',
|
||||
], [
|
||||
'value' => 'false',
|
||||
'type' => 'boolean',
|
||||
'description' => 'If this is true, the Language will change to the Clients browserlanguage or default.'
|
||||
]);
|
||||
//User can change Locale
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::LOCALE:CLIENTS_CAN_CHANGE',
|
||||
], [
|
||||
'value' => 'false',
|
||||
'type' => 'boolean',
|
||||
'description' => 'If this is true, the clients will be able to change their Locale.'
|
||||
]);
|
||||
//Locale
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::LOCALE:AVAILABLE',
|
||||
], [
|
||||
'value' => 'en,de,fr,es',
|
||||
'type' => 'string',
|
||||
'description' => 'The available languages'
|
||||
]);
|
||||
//Locale
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::LOCALE:DATATABLES',
|
||||
], [
|
||||
'value' => 'en-gb',
|
||||
'type' => 'string',
|
||||
'description' => 'The Language of the Datatables. Grab the Language-Codes from here https://datatables.net/plug-ins/i18n/'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,5 +350,7 @@
|
|||
"Notes": "Notizen",
|
||||
"Amount in words": "Betrag in Worten",
|
||||
"Please pay until": "Zahlbar bis",
|
||||
"Account already exists on Pterodactyl. Please contact the Support!": "Der Account existiert bereits bei Pterodactyl. Kontaktiere den Support!"
|
||||
}
|
||||
"Account already exists on Pterodactyl. Please contact the Support!": "Der Account existiert bereits bei Pterodactyl. Kontaktiere den Support!",
|
||||
"de": "Deutsch",
|
||||
"en": "Englisch"
|
||||
}
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
"api key has been removed!": "api key has been removed!",
|
||||
"Edit": "Edit",
|
||||
"Delete": "Delete",
|
||||
"configuration has been updated!": "configuration has been updated!",
|
||||
"Store item has been created!": "Store item has been created!",
|
||||
"Store item has been updated!": "Store item has been updated!",
|
||||
"Product has been updated!": "Product has been updated!",
|
||||
"Store item has been removed!": "Store item has been removed!",
|
||||
"Created at": "Created at",
|
||||
"Error!": "Error!",
|
||||
"unknown": "unknown",
|
||||
"Pterodactyl synced": "Pterodactyl synced",
|
||||
"Your credit balance has been increased!": "Your credit balance has been increased!",
|
||||
|
@ -16,6 +17,7 @@
|
|||
"Your payment has been canceled!": "Your payment has been canceled!",
|
||||
"Payment method": "Payment method",
|
||||
"Invoice": "Invoice",
|
||||
"Download": "Download",
|
||||
"Product has been created!": "Product has been created!",
|
||||
"Product has been removed!": "Product has been removed!",
|
||||
"Show": "Show",
|
||||
|
@ -26,6 +28,7 @@
|
|||
"Unsuspend": "Unsuspend",
|
||||
"Suspend": "Suspend",
|
||||
"Icons updated!": "Icons updated!",
|
||||
"configuration has been updated!": "configuration has been updated!",
|
||||
"link has been created!": "link has been created!",
|
||||
"link has been updated!": "link has been updated!",
|
||||
"product has been removed!": "product has been removed!",
|
||||
|
@ -80,7 +83,6 @@
|
|||
"Check the docs for it here": "Check the docs for it here",
|
||||
"Causer": "Causer",
|
||||
"Description": "Description",
|
||||
"Created at": "Created at",
|
||||
"Application API": "Application API",
|
||||
"Create": "Create",
|
||||
"Memo": "Memo",
|
||||
|
@ -111,6 +113,7 @@
|
|||
"Locations": "Locations",
|
||||
"Eggs": "Eggs",
|
||||
"Last updated :date": "Last updated :date",
|
||||
"Download all Invoices": "Download all Invoices",
|
||||
"Product Price": "Product Price",
|
||||
"Tax Value": "Tax Value",
|
||||
"Tax Percentage": "Tax Percentage",
|
||||
|
@ -153,7 +156,6 @@
|
|||
"Select panel icon": "Select panel icon",
|
||||
"Select panel favicon": "Select panel favicon",
|
||||
"Images and Icons may be cached, reload without cache to see your changes appear": "Images and Icons may be cached, reload without cache to see your changes appear",
|
||||
"Download all Invoices": "Download all Invoices",
|
||||
"Enter your companys name": "Enter your companys name",
|
||||
"Enter your companys address": "Enter your companys address",
|
||||
"Enter your companys phone number": "Enter your companys phone number",
|
||||
|
@ -163,6 +165,15 @@
|
|||
"Enter your custom invoice prefix": "Enter your custom invoice prefix",
|
||||
"Logo": "Logo",
|
||||
"Select Invoice Logo": "Select Invoice Logo",
|
||||
"Available languages": "Available languages",
|
||||
"Default language": "Default language",
|
||||
"The fallback Language, if something goes wrong": "The fallback Language, if something goes wrong",
|
||||
"Datable language": "Datable language",
|
||||
"The Language of the Datatables. Grab the Language-Codes from here": "The Language of the Datatables. Grab the Language-Codes from here",
|
||||
"Auto-translate": "Auto-translate",
|
||||
"If this is checked, the Dashboard will translate itself to the Clients language, if available": "If this is checked, the Dashboard will translate itself to the Clients language, if available",
|
||||
"Let the Client change the Language": "Let the Client change the Language",
|
||||
"If this is checked, Clients will have the ability to manually change their Dashboard language": "If this is checked, Clients will have the ability to manually change their Dashboard language",
|
||||
"Store": "Store",
|
||||
"Currency code": "Currency code",
|
||||
"Checkout the paypal docs to select the appropriate code": "Checkout the paypal docs to select the appropriate code",
|
||||
|
@ -240,7 +251,7 @@
|
|||
"per month": "per month",
|
||||
"Out of Credits in": "Out of Credits in",
|
||||
"Home": "Home",
|
||||
"Languages": "Languages",
|
||||
"Language": "Language",
|
||||
"See all Notifications": "See all Notifications",
|
||||
"Redeem code": "Redeem code",
|
||||
"Profile": "Profile",
|
||||
|
@ -278,7 +289,6 @@
|
|||
"Re-Sync Discord": "Re-Sync Discord",
|
||||
"Save Changes": "Save Changes",
|
||||
"Server configuration": "Server configuration",
|
||||
"Error!": "Error!",
|
||||
"Make sure to link your products to nodes and eggs.": "Make sure to link your products to nodes and eggs.",
|
||||
"There has to be at least 1 valid product for server creation": "There has to be at least 1 valid product for server creation",
|
||||
"No products available!": "No products available!",
|
||||
|
@ -344,5 +354,14 @@
|
|||
"Total amount": "Total amount",
|
||||
"Notes": "Notes",
|
||||
"Amount in words": "Amount in words",
|
||||
"Please pay until": "Please pay until"
|
||||
}
|
||||
"Please pay until": "Please pay until",
|
||||
"fr": "French",
|
||||
"cs": "Czech",
|
||||
"en": "English",
|
||||
"es": "Spanish",
|
||||
"de": "German",
|
||||
"hi": "Hindi",
|
||||
"it": "Italian",
|
||||
"pl": "Polish",
|
||||
"zh": "Chinese"
|
||||
}
|
||||
|
|
|
@ -7,17 +7,20 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<!-- AVAILABLE LANGUAGES -->
|
||||
<label for="languages">{{__("Available languages")}}:</label>
|
||||
|
||||
<select id="languages" style="width:100%"
|
||||
class="custom-select" name="languages[]"
|
||||
required
|
||||
multiple="multiple" autocomplete="off">
|
||||
<option value="de">German</option>
|
||||
<option value="en">English</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="cz">Czech</option>
|
||||
@foreach(config("app.available_locales") as $lang)
|
||||
<option value="{{$lang}}">{{__($lang)}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
|
||||
<!-- DEFAULT LANGUAGE -->
|
||||
<label for="defaultLanguage">{{__("Default language")}}: <i data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('The fallback Language, if something goes wrong')}}"
|
||||
|
@ -25,37 +28,60 @@
|
|||
|
||||
<select id="defaultLanguage" style="width:100%"
|
||||
class="custom-select" name="defaultLanguage"
|
||||
required
|
||||
autocomplete="off">
|
||||
<option value="de">German</option>
|
||||
<option value="en">English</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="cz">Czech</option>
|
||||
<option
|
||||
value="{{\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:DEFAULT")}}"
|
||||
selected>
|
||||
{{__(\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:DEFAULT"))}}</option>
|
||||
@foreach(config("app.available_locales") as $lang)
|
||||
<option value="{{$lang}}">{{__($lang)}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input value="autotranslate" id="autotranslate" name="autotranslate"
|
||||
type="checkbox">
|
||||
<label for="autotranslate">{{__('Auto-translate')}} <i data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('If this is checked, the Dashboard will translate itself to the Clients language, if available')}}"
|
||||
class="fas fa-info-circle"></i></label>
|
||||
|
||||
<br/>
|
||||
<input value="canClientChangeLanguage" id="canClientChangeLanguage" name="canClientChangeLanguage"
|
||||
type="checkbox">
|
||||
<label for="canClientChangeLanguage">{{__('Let the Client change the Language')}} <i
|
||||
data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('If this is checked, Clients will have the ability to manually change their Dashboard language')}}"
|
||||
class="fas fa-info-circle"></i></label>
|
||||
|
||||
</div>
|
||||
<!--DATATABLE LANGUAGE -->
|
||||
<label for="datatable-language">{{__('Datable language')}} <i data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('The Language of the Datatables. Grab the Language-Codes from here')}} https://datatables.net/plug-ins/i18n/"
|
||||
class="fas fa-info-circle"></i></label>
|
||||
<input x-model="datatable-language" id="datatable-language" name="datatable-language" type="text"
|
||||
required
|
||||
value="{{ App\Models\Settings::getValueByKey("SETTINGS::LOCALE:DATATABLES") }}"
|
||||
class="form-control @error('datatable-language') is-invalid @enderror">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AUTO TRANSLATE -->
|
||||
<div class="form-group">
|
||||
<input value="true" id="autotranslate" name="autotranslate"
|
||||
{{(\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:DYNAMIC")?"checked":"")}}
|
||||
type="checkbox">
|
||||
<label for="autotranslate">{{__('Auto-translate')}} <i data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('If this is checked, the Dashboard will translate itself to the Clients language, if available')}}"
|
||||
class="fas fa-info-circle"></i></label>
|
||||
|
||||
<br/>
|
||||
|
||||
<!-- CLIENTS CAN CHANGE -->
|
||||
<input value="true" id="canClientChangeLanguage" name="canClientChangeLanguage"
|
||||
{{(\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:CLIENTS_CAN_CHANGE")?"checked":"")}}
|
||||
type="checkbox">
|
||||
<label for="canClientChangeLanguage">{{__('Let the Client change the Language')}} <i
|
||||
data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
data-content="{{__('If this is checked, Clients will have the ability to manually change their Dashboard language')}}"
|
||||
class="fas fa-info-circle"></i></label>
|
||||
|
||||
</div>
|
||||
<button class="btn btn-primary">{{ __('Save') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
class="fab fa-discord mr-2"></i>{{ __('Discord') }}</a>
|
||||
</li>
|
||||
<!-- Language Selection -->
|
||||
@if (\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:CLIENTS_CAN_CHANGE")=='true')
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link" href="#" id="languageDropdown" role="button" data-toggle="dropdown"
|
||||
aria-haspopup="true" aria-expanded="false">
|
||||
|
@ -64,12 +65,10 @@
|
|||
aria-labelledby="changeLocale">
|
||||
<form method="post" action="{{ route('changeLocale') }}" class="nav-item text-center">
|
||||
@csrf
|
||||
@foreach (config('app.available_locales') as $key => $value)
|
||||
@if (!in_array(strtolower($key), UNSUPPORTED_LANGS))
|
||||
<button class="dropdown-item" name="inputLocale" value="{{ $value }}">
|
||||
{{ $key }}
|
||||
@foreach (json_decode(\App\Models\Settings::getValueByKey("SETTINGS::LOCALE:AVAILABLE")) as $key)
|
||||
<button class="dropdown-item" name="inputLocale" value="{{ $key }}">
|
||||
{{ __($key) }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
|
||||
|
@ -77,6 +76,7 @@
|
|||
</div>
|
||||
</li>
|
||||
<!-- End Language Selection -->
|
||||
@endif
|
||||
</ul>
|
||||
|
||||
<!-- Right navbar links -->
|
||||
|
|
|
@ -23,6 +23,8 @@ use App\Http\Controllers\TranslationController;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Classes\Settings\LanguageSettingsC;
|
||||
use App\Classes\Settings\InvoiceSettingsC;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -131,8 +133,8 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
|||
|
||||
#settings
|
||||
Route::patch('settings/update/icons', [SettingsController::class, 'updateIcons'])->name('settings.update.icons');
|
||||
Route::patch('settings/update/invoice-settings', [\App\Classes\Settings\InvoiceSettingsC::class, 'updateInvoiceSettings'])->name('settings.update.invoicesettings');
|
||||
Route::patch('settings/update/lagnguage', [SettingsController::class, 'updateLanguageSettings'])->name('settings.update.languagesettings');
|
||||
Route::patch('settings/update/invoice-settings', [InvoiceSettingsC::class, 'updateInvoiceSettings'])->name('settings.update.invoicesettings');
|
||||
Route::patch('settings/update/language', [LanguageSettingsC::class, 'updateLanguageSettings'])->name('settings.update.languagesettings');
|
||||
Route::resource('settings', SettingsController::class)->only('index');
|
||||
|
||||
#invoices
|
||||
|
|
Loading…
Reference in a new issue