2026-08-06 12:06:55 +03:00
|
|
|
<?php
|
|
|
|
|
|
2026-08-27 01:08:34 +03:00
|
|
|
namespace Modules\Core\Localization\Services;
|
2026-08-06 12:06:55 +03:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|