Apply fix on TranslationServiceProvider d'Alexis
This commit is contained in:
parent
66d52ebe5b
commit
a6d39db5d8
1 changed files with 9 additions and 10 deletions
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use App\Lib\Helpers\ToolboxHelper;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
|
@ -19,33 +18,33 @@ class TranslationServiceProvider extends ServiceProvider
|
|||
public function boot(): void
|
||||
{
|
||||
foreach ($this->collectLocalesStrings() as $locale) {
|
||||
// * Suported locales
|
||||
// * Suported locales.
|
||||
Cache::rememberForever(sprintf('translations.%s', $locale), function () use ($locale) {
|
||||
$phpTransFallback = $this->phpTranslations(config('app.fallback_locale'));
|
||||
$phpTransLocale = $this->phpTranslations($locale);
|
||||
$jsonTransFallback = $this->jsonTranslations(config('app.fallback_locale'));
|
||||
$jsonTransLocale = $this->jsonTranslations($locale);
|
||||
$translations = [
|
||||
'php' => ToolboxHelper::arrayMergeRecursiveDistinct(
|
||||
$phpTransLocale,
|
||||
'php' => ToolboxHelper::arrayMergeRecursiveDistinct(
|
||||
$phpTransFallback,
|
||||
$phpTransLocale,
|
||||
),
|
||||
'json' => ToolboxHelper::arrayMergeRecursiveDistinct(
|
||||
$jsonTransLocale,
|
||||
$jsonTransFallback,
|
||||
$jsonTransLocale,
|
||||
),
|
||||
];
|
||||
return $translations;
|
||||
});
|
||||
}
|
||||
} //end foreach
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather provided langs checking from files
|
||||
* Gather provided langs checking from files.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection<string, string>
|
||||
*/
|
||||
private function collectLocalesStrings(): Collection
|
||||
private function collectLocalesStrings(): \Illuminate\Support\Collection
|
||||
{
|
||||
// * En dur dans ->keys array<int,string>.
|
||||
// @phpstan-ignore-next-line
|
||||
|
|
@ -57,7 +56,7 @@ class TranslationServiceProvider extends ServiceProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Gather all php translations
|
||||
* Gather all php translations.
|
||||
*
|
||||
* @param string $locale
|
||||
* @return array<string, string>
|
||||
|
|
@ -77,7 +76,7 @@ class TranslationServiceProvider extends ServiceProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Gather json translations
|
||||
* Gather json translations.
|
||||
*
|
||||
* @param string $locale
|
||||
* @return array<string, string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue