@lowdefy/engine 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Actions.js CHANGED
@@ -179,9 +179,10 @@ let Actions = class Actions {
179
179
  };
180
180
  }
181
181
  const messages = parsedAction.messages || {};
182
+ const t = this.context._internal.lowdefy._internal.translate;
182
183
  let response;
183
184
  const closeLoading = this.displayMessage({
184
- defaultMessage: 'Loading',
185
+ defaultMessage: t('engine.action.loading'),
185
186
  duration: 0,
186
187
  message: messages.loading,
187
188
  status: 'loading'
@@ -246,7 +247,7 @@ let Actions = class Actions {
246
247
  }
247
248
  closeLoading();
248
249
  this.displayMessage({
249
- defaultMessage: 'Success',
250
+ defaultMessage: t('engine.action.success'),
250
251
  message: messages.success,
251
252
  status: 'success'
252
253
  });
package/dist/Block.js CHANGED
@@ -284,7 +284,7 @@ let Block = class Block {
284
284
  }
285
285
  },
286
286
  status: 'error',
287
- message: type.isString(this.requiredEval.output) ? this.requiredEval.output : 'This field is required'
287
+ message: type.isString(this.requiredEval.output) ? this.requiredEval.output : this.context._internal.lowdefy._internal.translate('engine.validation.fieldRequired')
288
288
  };
289
289
  const validation = this.requiredEval.output === false ? this.validate : [
290
290
  ...this.validate,
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ function createGetLocale({ context }) {
16
+ return function getLocale() {
17
+ const i18n = context._internal.lowdefy.i18n;
18
+ return i18n?.active ?? i18n?.defaultLocale;
19
+ };
20
+ }
21
+ export default createGetLocale;
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ function createTranslate({ context }) {
16
+ return function translate(key, values) {
17
+ return context._internal.lowdefy._internal.translate(key, values);
18
+ };
19
+ }
20
+ export default createTranslate;
@@ -18,7 +18,9 @@ function createValidate({ context }) {
18
18
  return function validate(params) {
19
19
  const validationErrors = context._internal.RootSlots.validate(getBlockMatcher(params));
20
20
  if (validationErrors.length > 0) {
21
- throw new UserError(`Your input has ${validationErrors.length} validation error${validationErrors.length !== 1 ? 's' : ''}.`);
21
+ throw new UserError(context._internal.lowdefy._internal.translate('engine.validation.summary', {
22
+ count: validationErrors.length
23
+ }));
22
24
  }
23
25
  };
24
26
  }
@@ -19,6 +19,7 @@ import createGetBlockId from './createGetBlockId.js';
19
19
  import createGetEvent from './createGetEvent.js';
20
20
  import createGetGlobal from './createGetGlobal.js';
21
21
  import createGetInput from './createGetInput.js';
22
+ import createGetLocale from './createGetLocale.js';
22
23
  import createGetPageId from './createGetPageId.js';
23
24
  import createGetRequestDetails from './createGetRequestDetails.js';
24
25
  import createGetState from './createGetState.js';
@@ -33,6 +34,7 @@ import createReset from './createReset.js';
33
34
  import createResetValidation from './createResetValidation.js';
34
35
  import createSetGlobal from './createSetGlobal.js';
35
36
  import createSetState from './createSetState.js';
37
+ import createTranslate from './createTranslate.js';
36
38
  import createUpdateSession from './createUpdateSession.js';
37
39
  import createValidate from './createValidate.js';
38
40
  function getActionMethods(props) {
@@ -45,6 +47,7 @@ function getActionMethods(props) {
45
47
  getEvent: createGetEvent(props),
46
48
  getGlobal: createGetGlobal(props),
47
49
  getInput: createGetInput(props),
50
+ getLocale: createGetLocale(props),
48
51
  getPageId: createGetPageId(props),
49
52
  getRequestDetails: createGetRequestDetails(props),
50
53
  getState: createGetState(props),
@@ -58,6 +61,7 @@ function getActionMethods(props) {
58
61
  resetValidation: createResetValidation(props),
59
62
  setGlobal: createSetGlobal(props),
60
63
  setState: createSetState(props),
64
+ translate: createTranslate(props),
61
65
  updateSession: createUpdateSession(props),
62
66
  validate: createValidate(props)
63
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/engine",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -30,16 +30,16 @@
30
30
  "dist/*"
31
31
  ],
32
32
  "dependencies": {
33
- "@lowdefy/errors": "5.2.0",
34
- "@lowdefy/helpers": "5.2.0",
35
- "@lowdefy/operators": "5.2.0"
33
+ "@lowdefy/errors": "5.4.0",
34
+ "@lowdefy/helpers": "5.4.0",
35
+ "@lowdefy/operators": "5.4.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "28.1.3",
39
- "@lowdefy/actions-core": "5.2.0",
40
- "@lowdefy/build": "5.2.0",
41
- "@lowdefy/operators-js": "5.2.0",
42
- "@lowdefy/operators-mql": "5.2.0",
39
+ "@lowdefy/actions-core": "5.4.0",
40
+ "@lowdefy/build": "5.4.0",
41
+ "@lowdefy/operators-js": "5.4.0",
42
+ "@lowdefy/operators-mql": "5.4.0",
43
43
  "@swc/cli": "0.8.0",
44
44
  "@swc/core": "1.15.18",
45
45
  "@swc/jest": "0.2.39",