diff --git a/system/Language/Language.php b/system/Language/Language.php index 9235610f1171..93fd671d4587 100644 --- a/system/Language/Language.php +++ b/system/Language/Language.php @@ -163,6 +163,13 @@ public function getLine(string $line, array $args = []) } } + if ($output === null) + { + $row = current(explode('.', $parsedLine)); + $key = substr($parsedLine, strlen($row) + 1); + $output = $this->language[$this->locale][$file][$row][$key] ?? null; + } + if ($output === null && strpos($this->locale, '-')) { [$locale] = explode('-', $this->locale, 2); diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index f32316b8b8be..da2070ebc3c6 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -321,4 +321,12 @@ public function testLanguageNestedArrayDefinition() $this->assertEquals('e', $lang->getLine('Nested.a.b.c.d')); } + public function testLanguageKeySeparatedByDot() + { + $lang = new SecondMockLanguage('en'); + $lang->loadem('Foo', 'en'); + + $this->assertEquals('The fieldname field is very short.', $lang->getLine('Foo.bar.min_length1', ['field' => 'fieldname'])); + } + }