Feature: Adding Translation Service and Translation Seeder

This commit is contained in:
2026-08-06 12:06:55 +03:00
parent 8646dca16a
commit 1857ced3a2
22 changed files with 650 additions and 27 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Modules\Core\Localization;
use Illuminate\Support\Facades\App;
use Spatie\TranslationLoader\LanguageLine;
class TranslationReader
{
private const DEFAULT_GROUP = 'storefront';
/**
* All labels in a group for the given (or current) locale, keyed by their
* dot-notation key — e.g. ['nav.cart' => 'Cart', 'nav.home' => 'Home'].
* Backed by LanguageLine's own forever-cache, so this is a cache hit after
* the first call for a given group+locale.
*/
public function group(string $group = self::DEFAULT_GROUP, ?string $locale = null): array
{
return LanguageLine::getTranslationsForGroup($locale ?? App::getLocale(), $group);
}
}