From 89b7046dd9b31b2fca7b0d86d6ca6a37975e6843 Mon Sep 17 00:00:00 2001 From: Hadi Akbarzadeh Date: Thu, 2 May 2024 01:35:03 +0330 Subject: [PATCH] v1.0.1 Supporting `defaultTranslation` property in the `has` method if it's a `Localizer` object. --- composer.json | 2 +- src/Localizer.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9eee120..2d58409 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Localizer.php b/src/Localizer.php index c651d16..e40cebe 100644 --- a/src/Localizer.php +++ b/src/Localizer.php @@ -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)); } /**