Skip to content

Commit 7f4acb1

Browse files
committed
Apply code reviews
1 parent 74ad679 commit 7f4acb1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Cms/LanguageTranslations.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@
1919
*/
2020
class LanguageTranslations
2121
{
22-
protected App $kirby;
2322
protected array $data;
2423

2524
public function __construct(
2625
protected Language $language,
2726
self|array $translations = []
2827
) {
29-
$this->kirby = App::instance();
3028
$this->setTranslations($translations);
3129
}
3230

@@ -62,8 +60,9 @@ public function load(array $default = []): array
6260
*/
6361
public function save(array $translations = []): static
6462
{
63+
$this->setTranslations($translations);
64+
6565
if ($root = $this->root()) {
66-
$this->data = $translations;
6766
Data::write($root, $translations);
6867
}
6968

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

8281
if (
8382
$root !== null &&

0 commit comments

Comments
 (0)