This is an automated email from the ASF dual-hosted git repository.
tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new bc5ab4460b9 kie-issues# 3247: Add i18n for dmn-editor-standalone
package (#3248)
bc5ab4460b9 is described below
commit bc5ab4460b9279509bd49597a9f6550619f702f5
Author: Kusuma04-dev <[email protected]>
AuthorDate: Tue Sep 9 03:47:52 2025 +0530
kie-issues# 3247: Add i18n for dmn-editor-standalone package (#3248)
Co-authored-by: Kusuma <[email protected]>
---
examples/dmn-editor-standalone-on-webapp/src/readOnly/index.ts | 1 +
.../dmn-editor-standalone-on-webapp/src/stateControl/index.ts | 1 +
.../src/withIncludedModels/index.ts | 1 +
packages/dmn-editor-standalone/package.json | 1 -
.../src/DmnEditorStandaloneEnvelopeServer.ts | 9 +++++++--
packages/dmn-editor-standalone/src/index.ts | 5 +++--
pnpm-lock.yaml | 3 ---
7 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/examples/dmn-editor-standalone-on-webapp/src/readOnly/index.ts
b/examples/dmn-editor-standalone-on-webapp/src/readOnly/index.ts
index ff6cdf0e905..2794c31fdeb 100644
--- a/examples/dmn-editor-standalone-on-webapp/src/readOnly/index.ts
+++ b/examples/dmn-editor-standalone-on-webapp/src/readOnly/index.ts
@@ -37,6 +37,7 @@ function loadEditor() {
initialFileNormalizedPosixPathRelativeToTheWorkspaceRoot:
"loan-pre-qualification.dmn",
initialContent: loadFile("loan-pre-qualification.dmn"),
readOnly: true,
+ locale: "en",
});
console.log({ editor });
diff --git a/examples/dmn-editor-standalone-on-webapp/src/stateControl/index.ts
b/examples/dmn-editor-standalone-on-webapp/src/stateControl/index.ts
index ce8682e8252..8744721bc5c 100644
--- a/examples/dmn-editor-standalone-on-webapp/src/stateControl/index.ts
+++ b/examples/dmn-editor-standalone-on-webapp/src/stateControl/index.ts
@@ -33,6 +33,7 @@ function loadEditor() {
initialFileNormalizedPosixPathRelativeToTheWorkspaceRoot: "newModel.dmn",
initialContent: Promise.resolve(``),
readOnly: false,
+ locale: "en",
});
// Undo button: Calls the `undo` method from the Editor API.
diff --git
a/examples/dmn-editor-standalone-on-webapp/src/withIncludedModels/index.ts
b/examples/dmn-editor-standalone-on-webapp/src/withIncludedModels/index.ts
index 66b600cb380..5ff3a8a005e 100644
--- a/examples/dmn-editor-standalone-on-webapp/src/withIncludedModels/index.ts
+++ b/examples/dmn-editor-standalone-on-webapp/src/withIncludedModels/index.ts
@@ -53,6 +53,7 @@ function loadEditor() {
["path2/loan-pre-qualification.dmn", { contentType: "text", content:
loadFile("loan-pre-qualification.dmn") }], // Won't be available! Read comment
above.
]),
readOnly: false,
+ locale: "en",
});
console.log({ editor });
diff --git a/packages/dmn-editor-standalone/package.json
b/packages/dmn-editor-standalone/package.json
index 33897f84fbc..bf018944c1e 100644
--- a/packages/dmn-editor-standalone/package.json
+++ b/packages/dmn-editor-standalone/package.json
@@ -42,7 +42,6 @@
"@babel/preset-typescript": "^7.22.5",
"@kie-tools-core/editor": "workspace:*",
"@kie-tools-core/envelope-bus": "workspace:*",
- "@kie-tools-core/i18n": "workspace:*",
"@kie-tools-core/notifications": "workspace:*",
"@kie-tools-core/patternfly-base": "workspace:*",
"@kie-tools-core/webpack-base": "workspace:*",
diff --git
a/packages/dmn-editor-standalone/src/DmnEditorStandaloneEnvelopeServer.ts
b/packages/dmn-editor-standalone/src/DmnEditorStandaloneEnvelopeServer.ts
index eae8bc87fa1..3263dbd1599 100644
--- a/packages/dmn-editor-standalone/src/DmnEditorStandaloneEnvelopeServer.ts
+++ b/packages/dmn-editor-standalone/src/DmnEditorStandaloneEnvelopeServer.ts
@@ -25,7 +25,12 @@ import {
KogitoEditorEnvelopeApi,
} from "@kie-tools-core/editor/dist/api";
-export const createEnvelopeServer = (iframe: HTMLIFrameElement, readOnly?:
boolean, origin?: string) => {
+export const createEnvelopeServer = (
+ iframe: HTMLIFrameElement,
+ readOnly?: boolean,
+ origin?: string,
+ locale?: string
+) => {
const defaultOrigin = window.location.protocol === "file:" ? "*" :
window.location.origin;
return new EnvelopeServer<KogitoEditorChannelApi, KogitoEditorEnvelopeApi>(
@@ -40,7 +45,7 @@ export const createEnvelopeServer = (iframe:
HTMLIFrameElement, readOnly?: boole
{
resourcesPathPrefix: "",
fileExtension: "dmn",
- initialLocale: "en-US",
+ initialLocale: locale ?? "en-US",
isReadOnly: readOnly ?? false,
channel: ChannelType.STANDALONE,
workspaceRootAbsolutePosixPath:
DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH,
diff --git a/packages/dmn-editor-standalone/src/index.ts
b/packages/dmn-editor-standalone/src/index.ts
index 44486327b46..20f804b369d 100644
--- a/packages/dmn-editor-standalone/src/index.ts
+++ b/packages/dmn-editor-standalone/src/index.ts
@@ -38,6 +38,7 @@ export function open(args: {
origin?: string;
onError?: () => any;
resources?: Map<string, DmnEditorStandaloneResource>;
+ locale?: string;
}): DmnEditorStandaloneApi {
const iframe = document.createElement("iframe");
iframe.srcdoc = `
@@ -78,7 +79,7 @@ export function open(args: {
iframe.style.height = "100%";
iframe.style.border = "none";
- const envelopeServer = createEnvelopeServer(iframe, args.readOnly,
args.origin);
+ const envelopeServer = createEnvelopeServer(iframe, args.readOnly,
args.origin, args.locale);
const stateControl = new StateControl();
@@ -97,7 +98,7 @@ export function open(args: {
getFileContents: () => Promise.resolve(args.initialContent),
isReadOnly: args.readOnly ?? false,
},
- "en-US",
+ args.locale ?? "en-US",
{
kogitoEditor_setContentError() {
if (!receivedSetContentError) {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9def7f9fe64..b8495fea733 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4531,9 +4531,6 @@ importers:
'@kie-tools-core/envelope-bus':
specifier: workspace:*
version: link:../envelope-bus
- '@kie-tools-core/i18n':
- specifier: workspace:*
- version: link:../i18n
'@kie-tools-core/notifications':
specifier: workspace:*
version: link:../notifications
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]