Skip to content

Commit 89b7046

Browse files
committed
v1.0.1
Supporting `defaultTranslation` property in the `has` method if it's a `Localizer` object.
1 parent 5385114 commit 89b7046

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nabeghe/light-localization",
33
"description": "A light weight, key-value & path-based PHP localization library that translations are loaded up when needed.",
44
"type": "library",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"homepage": "https://github.com/nabeghe/light-localization",
77
"license": "MIT",
88
"autoload": {

src/Localizer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public function has(string $key, $translator = self::DEFAULT_TRANSLATOR)
163163
if (!isset($this->translators[$translator])) {
164164
$this->load($translator);
165165
}
166-
return isset($this->translators[$translator][$key]);
166+
return isset($this->translators[$translator][$key])
167+
|| (!is_string($this->defaultTranslation) && $this->defaultTranslation->has($key, $translator));
167168
}
168169

169170
/**

0 commit comments

Comments
 (0)