Skip to content

Commit 60afe5e

Browse files
committed
Ignore invalid key format
1 parent 8d360fe commit 60afe5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Translator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public function get($data, array $replace = [], $locale = null, $fallback = true
7474

7575
$key = trim(str_replace([' '], ['_'], strtolower(trim($key))));
7676

77+
// Ignore items that are not in the correct format, example: "__('Not found')".
78+
// Correct format for that would be "__('errors.not_found')".
79+
if (strpos($key, '.') === false) {
80+
return $data;
81+
}
82+
7783
if (!isset($string)) {
7884
$string = $key;
7985
}
@@ -279,7 +285,7 @@ public function createString($key, $string, $platform = null, $comment = null)
279285
if (!$this->enabled()) {
280286
return;
281287
}
282-
288+
283289
if ($platform == null) {
284290
$platform = $this->getDefaultPlatform();
285291
}

0 commit comments

Comments
 (0)