private function loadSnippets(MessageCatalogueInterface
$catalog, string
$snippetSetId, ?string
$fallbackLocale): array
{ $this->
resolveSalesChannelId();
$key =
sprintf('translation.catalog.%s.%s',
$this->salesChannelId ?: 'DEFAULT',
$snippetSetId);
return $this->cache->
get($key,
function DItemInterface
$item) use ($catalog,
$snippetSetId,
$fallbackLocale) { $item->
tag('translation.catalog.' .
$snippetSetId);
$item->
tag(sprintf('translation.catalog.%s',
$this->salesChannelId ?: 'DEFAULT'
));
return $this->snippetService->
getStorefrontSnippets($catalog,
$snippetSetId,
$fallbackLocale,
$this->salesChannelId
);
});
} private function getFallbackLocale(): string
{ try { return $this->languageLocaleProvider->
getLocaleForLanguageId(Defaults::LANGUAGE_SYSTEM
);
} catch (ConnectionException
) { // this allows us to use the translator even if there's no db connection yet
return 'en-GB';
} }