Skip to content

Commit

Permalink
allow json values for each language
Browse files Browse the repository at this point in the history
Removing string type hints allows using Translatable with array values,
e.g.:

['en' => ['subkey' => 'foo']]
  • Loading branch information
guidocella committed Jun 10, 2024
1 parent df47c6c commit 0b855bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/TranslationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0b855bf

Please sign in to comment.