generated from IBEC-BOX/admin-kit-package-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change widget parent and
emit
to dispatch
- Loading branch information
Showing
9 changed files
with
92 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
<x-filament::widget> | ||
<x-filament::card> | ||
{{-- Widget content --}} | ||
@foreach(AdminKit::locales() as $locale) | ||
{{Str::upper($locale)}} - {{__('admin-kit-localizations::localizations.translation_file')}} | ||
@if ($exists[$locale]) | ||
<span class="hover:underline cursor-pointer font-bold" | ||
wire:click="downloadTranslationFile('{{$locale}}')">{{$locale}}.json</span> | ||
({{$sizes[$locale]}}), {{$counts[$locale]}}. | ||
@else | ||
<b>{{$locale}}.json</b> {{__('admin-kit-localizations::localizations.not_created')}} | ||
@endif | ||
<br/> | ||
@endforeach | ||
</x-filament::card> | ||
<x-filament::section> | ||
<div class="flex gap-4"> | ||
@foreach(AdminKit::locales() as $locale) | ||
<div | ||
class="flex flex-col gap-2 items-center w-full cursor-pointer dark:hover:bg-white/5 py-4 rounded-xl transition-colors" | ||
wire:click="downloadTranslationFile('{{$locale}}')"> | ||
<x-filament::icon-button | ||
icon="heroicon-o-arrow-down-tray" | ||
size="xl" | ||
> | ||
<x-slot name="badge"> | ||
@if ($exists[$locale]) | ||
{{$counts[$locale]}} | ||
@else | ||
{{__('admin-kit-localizations::localizations.not_created')}} | ||
@endif | ||
</x-slot> | ||
</x-filament::icon-button> | ||
<span class="text-custom-400 text-xs" style="--c-400: var(--primary-400);"> | ||
{{$exists[$locale] ? $sizes[$locale] : '0.00 Kb'}} | ||
</span> | ||
<span class="font-bold text-sm">{{$locale}}.json</span> | ||
</div> | ||
@endforeach | ||
</div> | ||
</x-filament::section> | ||
</x-filament::widget> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace AdminKit\Localizations\Traits; | ||
|
||
use AdminKit\Core\Facades\AdminKit; | ||
use Illuminate\Support\Facades\File; | ||
|
||
trait LocalizationFiles | ||
{ | ||
protected function addLocalization(string $key, array $values): void | ||
{ | ||
foreach (AdminKit::locales() as $locale) { | ||
$path = lang_path("$locale.json"); | ||
|
||
$jsonContent = file_exists($path) | ||
? File::json($path) | ||
: []; | ||
|
||
$jsonContent[$key] = $values[$locale]; | ||
|
||
File::put($path, json_encode($jsonContent, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters