Skip to content

Commit 2d68b58

Browse files
committed
do not check already checked locales again
1 parent d120be1 commit 2d68b58

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Translatable/Translatable.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ public function getTranslation(?string $locale = null, bool $withFallback = null
196196
$configuredLocales = $this->getLocalesHelper()->all();
197197

198198
foreach ($configuredLocales as $configuredLocale) {
199-
if ($translation = $this->getTranslationByLocaleKey($configuredLocale)) {
199+
if (
200+
$locale !== $configuredLocale
201+
&& $fallbackLocale !== $configuredLocale
202+
&& $translation = $this->getTranslationByLocaleKey($configuredLocale)
203+
) {
200204
return $translation;
201205
}
202206
}

0 commit comments

Comments
 (0)