From 71a38180e9ff066d98a404a0638701646bfa3ede Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sun, 29 Dec 2019 16:39:25 +0100 Subject: [PATCH] Check for same language --- src/Core/L10n/L10n.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Core/L10n/L10n.php b/src/Core/L10n/L10n.php index be9e1419f3..ad4f653716 100644 --- a/src/Core/L10n/L10n.php +++ b/src/Core/L10n/L10n.php @@ -413,6 +413,11 @@ class L10n */ public function withLang(string $lang) { + // Don't create a new instance for same language + if ($lang === $this->lang) { + return $this; + } + $newL10n = clone $this; $newL10n->loadTranslationTable($lang); return $newL10n;