Skip to content

Commit

Permalink
Apply code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora authored and distantnative committed Jul 22, 2024
1 parent 54deeb0 commit 178fa70
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Cms/LanguageTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
*/
class LanguageTranslations
{
protected App $kirby;
protected array $data;

public function __construct(
protected Language $language,
self|array $translations = []
) {
$this->kirby = App::instance();
$this->setTranslations($translations);
}

Expand Down Expand Up @@ -62,8 +60,9 @@ public function load(array $default = []): array
*/
public function save(array $translations = []): static
{
$this->setTranslations($translations);

if ($root = $this->root()) {
$this->data = $translations;
Data::write($root, $translations);
}

Expand All @@ -77,7 +76,7 @@ public function root(): string|null
{
$kirby = App::instance();
$root = $kirby->root('translations');
$file = $root . '/' . $this->language->code() . '.php';
$file = ($root ?? '') . '/' . $this->language->code() . '.php';

if (
$root !== null &&
Expand Down

0 comments on commit 178fa70

Please sign in to comment.