From 0b855bfb025629ec256f6045c3525f3b1ee5ce4d Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Mon, 10 Jun 2024 12:29:08 +0200 Subject: [PATCH] allow json values for each language Removing string type hints allows using Translatable with array values, e.g.: ['en' => ['subkey' => 'foo']] --- src/Translatable.php | 2 +- src/TranslationsManager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Translatable.php b/src/Translatable.php index 4190e3e..c08027a 100644 --- a/src/Translatable.php +++ b/src/Translatable.php @@ -20,7 +20,7 @@ public function getAttribute($key) return parent::getAttribute($key); } - public function getValueOfCurrentLocaleForKey(string $key): ?string + public function getValueOfCurrentLocaleForKey(string $key) { $translations = $this->getAttributeValue($key); diff --git a/src/TranslationsManager.php b/src/TranslationsManager.php index c829ebe..3771c38 100644 --- a/src/TranslationsManager.php +++ b/src/TranslationsManager.php @@ -11,7 +11,7 @@ public function __construct(?array $translations) $this->translations = $translations; } - public function __get(string $key): ?string + public function __get(string $key) { return $this->translations[$key] ?? null; }