@@ -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 ' ) . ' →</a> '
199+ 'help ' => $ this -> saveTranslate ('license.code.help ' ) . ' ' . '<a href=" ' . $ license_obj ->link . '" target="_blank"> ' . $ this -> saveTranslate ('license.buy ' ) . ' →</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