diff --git a/src/Concerns/Translatable.php b/src/Concerns/Translatable.php index 0c65b5f7a..237c8905a 100644 --- a/src/Concerns/Translatable.php +++ b/src/Concerns/Translatable.php @@ -13,8 +13,13 @@ protected function translate(string $country, string $name, ?string $locale = nu } $countryName = strtolower($country); + $filePath = __DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"; - $content = file_get_contents(__DIR__."/../../lang/{$countryName}/{$locale}/holidays.json"); + if (file_exists($filePath)) { + $content = file_get_contents($filePath); + } else { + throw InvalidLocale::notFound($country, $locale); + } if ($content === false) { throw InvalidLocale::notFound($country, $locale);