Skip to content

Commit 1fc7beb

Browse files
author
Roman Gsponer
committed
Fix translation in utils
1 parent 93c3c2f commit 1fc7beb

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

.github/workflows/auto-tag.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Auto Tag
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
tag:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up Git
12+
run: |
13+
git config user.name github-actions
14+
git config user.email [email protected]
15+
- name: Create tag
16+
run: |
17+
VERSION=$(jq -r .version composer.json)
18+
git tag "v$VERSION"
19+
git push origin "v$VERSION"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "plain/kirby-form-block-suite",
33
"description": "Contactform based on Kirby blocks.",
44
"type": "kirby-plugin",
5-
"version": "5.1.3",
5+
"version": "5.1.4",
66
"license": "GPL-3.0-only",
77
"homepage": "https://plain-solutions.net/801346",
88
"authors": [

utils/License.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,18 @@ public static function factory($name, ?array $info = null): self
7272
return new self($name, $info);
7373
}
7474

75+
private function saveTranslate($key) {
76+
return App::instance()->translation()->get($key);
77+
}
78+
7579
public function getLicenseObject(string $locale = null): ?array
7680
{
7781
if (static::isValid()) {
7882
return null;
7983
}
8084
return [
8185
'title' => $this->title,
82-
'cta' => I18n::translate('license.activate.label'),
86+
'cta' => $this->saveTranslate('license.activate.label'),
8387
'dialog' => $this->prefix . "/register"
8488
];
8589
}
@@ -93,7 +97,7 @@ public function licenseArray(): ?array
9397
return [
9498
'value' => 'missing',
9599
'theme' => 'negative',
96-
'label' => App::instance()->translation()->get('license.unregistered.label'),
100+
'label' => $this->saveTranslate('license.unregistered.label'),
97101
'icon' => 'alert',
98102
'dialog' => "{$this->prefix}/register"
99103
];
@@ -138,7 +142,7 @@ public function extends($extends) {
138142
[
139143
"pattern" => "plain/licenses/validate",
140144
"action" => function () {
141-
return License::factory(get('name'))->register(get("key"), get("email"));
145+
//return License::factory(get('name'))->register(get("key"), get("email"));
142146
},
143147
],
144148
]
@@ -181,25 +185,25 @@ public function dialog(): array
181185
'type' => 'headline'
182186
],
183187
'domain' => [
184-
'label' => I18n::translate('license.activate.label'),
188+
'label' => $this->saveTranslate('license.activate.label'),
185189
'type' => 'info',
186190
'theme' => $local ? 'warning' : 'info',
187191
'text' => Str::replace($text, 'Kirby', $license_obj->title)
188192
],
189193
'license' => [
190-
'label' => I18n::translate('license.code.label'),
194+
'label' => $this->saveTranslate('license.code.label'),
191195
'type' => 'text',
192196
'required' => true,
193197
'counter' => false,
194198
'placeholder' => '',
195-
'help' => I18n::translate('license.code.help') . ' ' . '<a href="' . $license_obj->link . '" target="_blank">' . I18n::translate('license.buy') . ' &rarr;</a>'
199+
'help' => $this->saveTranslate('license.code.help') . ' ' . '<a href="' . $license_obj->link . '" target="_blank">' . $this->saveTranslate('license.buy') . ' &rarr;</a>'
196200
],
197201
'email' => Field::email(['required' => true]),
198202
'license_id' => Field::hidden()
199203
],
200204
'submitButton' => [
201205
'icon' => 'key',
202-
'text' => I18n::translate('activate'),
206+
'text' => $this->saveTranslate('activate'),
203207
'theme' => 'love',
204208
],
205209
'value' => [
@@ -220,7 +224,7 @@ public function dialog(): array
220224
);
221225

222226
return [
223-
'message' => I18n::translate('license.success')
227+
'message' => $this->saveTranslate('license.success')
224228
];
225229

226230
}

0 commit comments

Comments
 (0)