Check for same language
This commit is contained in:
parent
7a2f4dc54e
commit
71a38180e9
1 changed files with 5 additions and 0 deletions
|
@ -413,6 +413,11 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public function withLang(string $lang)
|
public function withLang(string $lang)
|
||||||
{
|
{
|
||||||
|
// Don't create a new instance for same language
|
||||||
|
if ($lang === $this->lang) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$newL10n = clone $this;
|
$newL10n = clone $this;
|
||||||
$newL10n->loadTranslationTable($lang);
|
$newL10n->loadTranslationTable($lang);
|
||||||
return $newL10n;
|
return $newL10n;
|
||||||
|
|
Loading…
Reference in a new issue