Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
Supporting `defaultTranslation` property in the `has` method if it's a `Localizer` object.
  • Loading branch information
nabeghe committed May 1, 2024
1 parent 5385114 commit 89b7046
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nabeghe/light-localization",
"description": "A light weight, key-value & path-based PHP localization library that translations are loaded up when needed.",
"type": "library",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/nabeghe/light-localization",
"license": "MIT",
"autoload": {
Expand Down
3 changes: 2 additions & 1 deletion src/Localizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public function has(string $key, $translator = self::DEFAULT_TRANSLATOR)
if (!isset($this->translators[$translator])) {
$this->load($translator);
}
return isset($this->translators[$translator][$key]);
return isset($this->translators[$translator][$key])
|| (!is_string($this->defaultTranslation) && $this->defaultTranslation->has($key, $translator));
}

/**
Expand Down

0 comments on commit 89b7046

Please sign in to comment.