Skip to content

Commit cad797d

Browse files
committed
fixed multi-lang problem
1 parent c8b4ec1 commit cad797d

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

app/Helpers/Helper.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,10 @@ function getSetting($key)
680680
// $a = new \stdClass();
681681
return '';
682682
}
683-
if (config('app.xlang') && ($x->type == 'group' || $x->type == 'category')) {
684-
$defLang = config('app.xlang_main');
685-
return $x->getTranslations('value')[$defLang];
683+
684+
$txtType = ['TEXT','LONGTEXT','EDITOR'];
685+
if (config('app.xlang') && !in_array($x->type, $txtType)) {
686+
return $x->raw;
686687
}
687688
return $x->value;
688689
}

app/Http/Controllers/Admin/SettingController.php

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function update(Request $request)
8080
if ($set != null && !$request->hasFile($key)) {
8181

8282
$set->value = validateSettingRequest($set,$val);
83+
$set->raw = validateSettingRequest($set,$val);
8384
// need to test
8485
if (config('app.xlang.active') && config('app.xlang.main') != 'en' && (
8586
$set->type != 'TEXT' && $set->type != 'EDITOR' && $set->type != 'LONGTEXT')){

database/migrations/2024_05_07_133136_create_settings_table.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function up(): void
1919
$table->boolean('active')->default(true);
2020
$table->string('key')->unique();
2121
$table->text('value')->nullable();
22+
$table->text('raw')->nullable();
2223
$table->boolean('ltr')->default(false);
2324
$table->boolean('is_basic')->default(false);
2425
$table->boolean('size')->default('12');

0 commit comments

Comments
 (0)