How to create a custom translation provider
mainIf you want to load translations from a source other than the database (e.g., YAML or CSV files), you can implement the Spatie\TranslationLoader\TranslationLoaders\TranslationLoader interface.
Your implementation must include the loadTranslations method, which returns an array of translations for a specific locale and group. Once implemented, register your class in the translation_loaders array within the package configuration file.
namespace Spatie\TranslationLoader\TranslationLoaders;
interface TranslationLoader
{
/**
* Returns all translations for the given locale and group.
*/
public function loadTranslations(string $locale, string $group): array;
}