This is an automated email from the ASF dual-hosted git repository.
ljmotta 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 d80a37a8743 kie-issues#3232: Add i18n for scesim-editor-envelope
package (#3233)
d80a37a8743 is described below
commit d80a37a8743bc71d2b155fb1583912f4bc23eee0
Author: Kusuma04-dev <[email protected]>
AuthorDate: Tue Sep 9 17:51:10 2025 +0530
kie-issues#3232: Add i18n for scesim-editor-envelope package (#3233)
Co-authored-by: Kusuma <[email protected]>
---
packages/scesim-editor-envelope/package.json | 2 ++
.../src/TestScenarioEditorFactory.tsx | 34 ++++++++++++++-----
.../src/TestScenarioEditorRoot.tsx | 6 ++--
.../src/i18n/ScesimEditorEnvelopeI18n.ts | 30 +++++++++++++++++
packages/scesim-editor-envelope/src/i18n/index.ts | 21 ++++++++++++
.../scesim-editor-envelope/src/i18n/locales/en.ts | 29 +++++++++++++++++
.../src/i18n/locales/index.ts | 20 ++++++++++++
packages/scesim-editor-envelope/src/i18n/setup.ts | 38 ++++++++++++++++++++++
pnpm-lock.yaml | 6 ++++
9 files changed, 175 insertions(+), 11 deletions(-)
diff --git a/packages/scesim-editor-envelope/package.json
b/packages/scesim-editor-envelope/package.json
index 9bd0e946467..c64c7851400 100644
--- a/packages/scesim-editor-envelope/package.json
+++ b/packages/scesim-editor-envelope/package.json
@@ -25,12 +25,14 @@
"@kie-tools-core/editor": "workspace:*",
"@kie-tools-core/envelope": "workspace:*",
"@kie-tools-core/envelope-bus": "workspace:*",
+ "@kie-tools-core/i18n": "workspace:*",
"@kie-tools-core/keyboard-shortcuts": "workspace:*",
"@kie-tools-core/notifications": "workspace:*",
"@kie-tools-core/react-hooks": "workspace:*",
"@kie-tools-core/workspace": "workspace:*",
"@kie-tools/boxed-expression-component": "workspace:*",
"@kie-tools/dmn-marshaller": "workspace:*",
+ "@kie-tools/i18n-common-dictionary": "workspace:*",
"@kie-tools/scesim-editor": "workspace:*",
"@kie-tools/scesim-marshaller": "workspace:*",
"@kie-tools/xml-parser-ts": "workspace:*",
diff --git a/packages/scesim-editor-envelope/src/TestScenarioEditorFactory.tsx
b/packages/scesim-editor-envelope/src/TestScenarioEditorFactory.tsx
index cb4420b31fd..eaad99703c6 100644
--- a/packages/scesim-editor-envelope/src/TestScenarioEditorFactory.tsx
+++ b/packages/scesim-editor-envelope/src/TestScenarioEditorFactory.tsx
@@ -32,6 +32,13 @@ import {
import { Notification } from "@kie-tools-core/notifications/dist/api";
import { ResourceContent, ResourcesList, WorkspaceEdit } from
"@kie-tools-core/workspace/dist/api";
import { TestScenarioEditorRoot } from "./TestScenarioEditorRoot";
+import { I18nDictionariesProvider } from
"@kie-tools-core/i18n/dist/react-components";
+import {
+ scesimEditorEnvelopeDictionaries,
+ ScesimEditorEnvelopeI18nContext,
+ scesimEditorEnvelopeI18nDefaults,
+ useScesimEditorEnvelopeI18n,
+} from "./i18n";
export class TestScenarioEditorFactory
implements EditorFactory<Editor, KogitoEditorEnvelopeApi,
KogitoEditorChannelApi>
@@ -90,15 +97,22 @@ export class TestScenarioEditorInterface implements Editor {
// This is the argument to ReactDOM.render. These props can be understood
like "static globals".
public af_componentRoot() {
return (
- <TestScenarioEditorRootWrapper
- exposing={(testScenarioEditorRoot) => (this.self =
testScenarioEditorRoot)}
- envelopeContext={this.envelopeContext}
- workspaceRootAbsolutePosixPath={
- this.initArgs.workspaceRootAbsolutePosixPath ??
DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH
- }
- isReadOnly={this.initArgs.isReadOnly}
- locale={this.initArgs.initialLocale}
- />
+ <I18nDictionariesProvider
+ defaults={scesimEditorEnvelopeI18nDefaults}
+ dictionaries={scesimEditorEnvelopeDictionaries}
+ initialLocale={this.initArgs.initialLocale}
+ ctx={ScesimEditorEnvelopeI18nContext}
+ >
+ <TestScenarioEditorRootWrapper
+ exposing={(testScenarioEditorRoot) => (this.self =
testScenarioEditorRoot)}
+ envelopeContext={this.envelopeContext}
+ workspaceRootAbsolutePosixPath={
+ this.initArgs.workspaceRootAbsolutePosixPath ??
DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH
+ }
+ isReadOnly={this.initArgs.isReadOnly}
+ locale={this.initArgs.initialLocale}
+ />
+ </I18nDictionariesProvider>
);
}
}
@@ -117,6 +131,7 @@ function TestScenarioEditorRootWrapper({
isReadOnly: boolean;
locale: string;
}) {
+ const { i18n } = useScesimEditorEnvelopeI18n();
const onNewEdit = useCallback(
(workspaceEdit: WorkspaceEdit) => {
envelopeContext?.channelApi.notifications.kogitoWorkspace_newEdit.send(workspaceEdit);
@@ -161,6 +176,7 @@ function TestScenarioEditorRootWrapper({
workspaceRootAbsolutePosixPath={workspaceRootAbsolutePosixPath}
keyboardShortcutsService={envelopeContext?.services.keyboardShortcuts}
isReadOnly={isReadOnly}
+ i18n={i18n}
locale={locale}
/>
);
diff --git a/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
b/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
index 7084f37916e..5c67b48b458 100644
--- a/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
+++ b/packages/scesim-editor-envelope/src/TestScenarioEditorRoot.tsx
@@ -33,6 +33,7 @@ import { getMarshaller as getDmnMarshaller } from
"@kie-tools/dmn-marshaller";
import * as TestScenarioEditor from
"@kie-tools/scesim-editor/dist/TestScenarioEditor";
import { getMarshaller, SceSimMarshaller, SceSimModel } from
"@kie-tools/scesim-marshaller";
import { EMPTY_ONE_EIGHT } from
"@kie-tools/scesim-editor/dist/resources/EmptyScesimFile";
+import { ScesimEditorEnvelopeI18n } from "./i18n";
export const DMN_MODELS_SEARCH_GLOB_PATTERN = "**/*.dmn";
export const TARGET_DIRECTORY = "target/classes/";
@@ -46,6 +47,7 @@ export type TestScenarioEditorRootProps = {
onRequestWorkspaceFileContent:
WorkspaceChannelApi["kogitoWorkspace_resourceContentRequest"];
onOpenFileFromNormalizedPosixPathRelativeToTheWorkspaceRoot:
WorkspaceChannelApi["kogitoWorkspace_openFile"];
workspaceRootAbsolutePosixPath: string;
+ i18n: ScesimEditorEnvelopeI18n;
locale: string;
};
@@ -277,8 +279,8 @@ export class TestScenarioEditorRoot extends
React.Component<TestScenarioEditorRo
return;
}
const togglePropertiesPanel =
this.props.keyboardShortcutsService?.registerKeyPress(
- "I",
- "Misc | Open/Close dock panel",
+ this.props.i18n.i,
+ this.props.i18n.misc + " | " + this.props.i18n.openCloseDockPanel,
async () => commands.toggleTestScenarioDock()
);
diff --git
a/packages/scesim-editor-envelope/src/i18n/ScesimEditorEnvelopeI18n.ts
b/packages/scesim-editor-envelope/src/i18n/ScesimEditorEnvelopeI18n.ts
new file mode 100644
index 00000000000..1744fe5816d
--- /dev/null
+++ b/packages/scesim-editor-envelope/src/i18n/ScesimEditorEnvelopeI18n.ts
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { ReferenceDictionary } from "@kie-tools-core/i18n/dist/core";
+import { CommonI18n } from "@kie-tools/i18n-common-dictionary";
+
+interface ScesimEditorEnvelopeDictionary extends ReferenceDictionary {
+ testScenarioEditor: string;
+ i: string;
+ misc: string;
+ openCloseDockPanel: string;
+}
+
+export interface ScesimEditorEnvelopeI18n extends
ScesimEditorEnvelopeDictionary, CommonI18n {}
diff --git a/packages/scesim-editor-envelope/src/i18n/index.ts
b/packages/scesim-editor-envelope/src/i18n/index.ts
new file mode 100644
index 00000000000..030d81cc347
--- /dev/null
+++ b/packages/scesim-editor-envelope/src/i18n/index.ts
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export * from "./ScesimEditorEnvelopeI18n";
+export * from "./setup";
diff --git a/packages/scesim-editor-envelope/src/i18n/locales/en.ts
b/packages/scesim-editor-envelope/src/i18n/locales/en.ts
new file mode 100644
index 00000000000..785a65d2c5f
--- /dev/null
+++ b/packages/scesim-editor-envelope/src/i18n/locales/en.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { en as en_common } from "@kie-tools/i18n-common-dictionary";
+import { ScesimEditorEnvelopeI18n } from "../ScesimEditorEnvelopeI18n";
+
+export const en: ScesimEditorEnvelopeI18n = {
+ ...en_common,
+ testScenarioEditor: "Test Scenario Editor",
+ i: "I",
+ misc: "Misc",
+ openCloseDockPanel: "Open/Close dock panel",
+};
diff --git a/packages/scesim-editor-envelope/src/i18n/locales/index.ts
b/packages/scesim-editor-envelope/src/i18n/locales/index.ts
new file mode 100644
index 00000000000..8bf599d3803
--- /dev/null
+++ b/packages/scesim-editor-envelope/src/i18n/locales/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { en } from "./en";
diff --git a/packages/scesim-editor-envelope/src/i18n/setup.ts
b/packages/scesim-editor-envelope/src/i18n/setup.ts
new file mode 100644
index 00000000000..7ac8c80407c
--- /dev/null
+++ b/packages/scesim-editor-envelope/src/i18n/setup.ts
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { en } from "./locales";
+import { useContext } from "react";
+import { I18nDefaults, I18nDictionaries } from
"@kie-tools-core/i18n/dist/core";
+import { ScesimEditorEnvelopeI18n } from "./ScesimEditorEnvelopeI18n";
+import { I18nContextType } from "@kie-tools-core/i18n/dist/react-components";
+
+export const scesimEditorEnvelopeI18nDefaults:
I18nDefaults<ScesimEditorEnvelopeI18n> = {
+ locale: "en",
+ dictionary: en,
+};
+export const scesimEditorEnvelopeDictionaries:
I18nDictionaries<ScesimEditorEnvelopeI18n> = new Map([["en", en]]);
+export const ScesimEditorEnvelopeI18nContext =
React.createContext<I18nContextType<ScesimEditorEnvelopeI18n>>(
+ {} as never
+);
+
+export function useScesimEditorEnvelopeI18n():
I18nContextType<ScesimEditorEnvelopeI18n> {
+ return useContext(ScesimEditorEnvelopeI18nContext);
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6dd695cbfab..01d8d8dd784 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -10315,6 +10315,9 @@ importers:
'@kie-tools-core/envelope-bus':
specifier: workspace:*
version: link:../envelope-bus
+ '@kie-tools-core/i18n':
+ specifier: workspace:*
+ version: link:../i18n
'@kie-tools-core/keyboard-shortcuts':
specifier: workspace:*
version: link:../keyboard-shortcuts
@@ -10333,6 +10336,9 @@ importers:
'@kie-tools/dmn-marshaller':
specifier: workspace:*
version: link:../dmn-marshaller
+ '@kie-tools/i18n-common-dictionary':
+ specifier: workspace:*
+ version: link:../i18n-common-dictionary
'@kie-tools/scesim-editor':
specifier: workspace:*
version: link:../scesim-editor
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]