fix: Fix items and customization locale merging

This commit is contained in:
Mangiang 2021-10-12 00:21:14 -04:00
parent fe5daaded8
commit e5ea4a83e5
2 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,6 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use App\Config\GiteaConfig; use App\Config\GiteaConfig;
use Illuminate\Support\Facades\Log;
class ItemsCollection class ItemsCollection
{ {
@ -45,8 +44,11 @@ class ItemsCollection
$trimmed_current_locale_name = trim($current_locale_name[1][0]); $trimmed_current_locale_name = trim($current_locale_name[1][0]);
$current_locale_json = json_decode(file_get_contents("${raw_locales_global_base_url}/${trimmed_current_locale_name}.json"), true); $current_locale_json = json_decode(file_get_contents("${raw_locales_global_base_url}/${trimmed_current_locale_name}.json"), true);
$this->locales = $this->locales->merge([$trimmed_current_locale_name => [collect($current_locale_json['templates'])->merge(collect($current_locale_json['customization']))]]); $template_locale = collect($current_locale_json['templates']);
$customization_locale= collect($current_locale_json['customization']);
$this->locales = $this->locales->merge([$trimmed_current_locale_name => $template_locale->concat($customization_locale)]);
} }
file_put_contents("G:\spt-items-api\storage\data.json", $this->locales['en']);
Cache::put($this->locales_cache_key, $this->locales); Cache::put($this->locales_cache_key, $this->locales);
} }

1
storage/data.json Normal file

File diff suppressed because one or more lines are too long