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 673553537e4 kie-issues#3230: Add i18n for 
form-code-generator-vscode-command package (#3231)
673553537e4 is described below

commit 673553537e45c0e5ec058bedc48b83b213674225
Author: Kusuma04-dev <[email protected]>
AuthorDate: Tue Sep 9 03:55:18 2025 +0530

    kie-issues#3230: Add i18n for form-code-generator-vscode-command package 
(#3231)
    
    Co-authored-by: Kusuma <[email protected]>
---
 .../package.json                                   |  2 ++
 .../src/generateFormCodeCommand.ts                 | 39 +++++++++++----------
 .../src/i18n/FormCodeGeneratorI18n.ts              | 40 ++++++++++++++++++++++
 .../src/i18n/index.ts                              | 21 ++++++++++++
 .../src/i18n/locales/en.ts                         | 38 ++++++++++++++++++++
 .../src/i18n/locales/index.ts                      | 20 +++++++++++
 .../src/i18n/setup.ts                              | 30 ++++++++++++++++
 pnpm-lock.yaml                                     |  6 ++++
 repo/graph.dot                                     |  1 +
 repo/graph.json                                    |  5 +++
 10 files changed, 183 insertions(+), 19 deletions(-)

diff --git a/packages/form-code-generator-vscode-command/package.json 
b/packages/form-code-generator-vscode-command/package.json
index d3651ad6ffc..c450f134d19 100644
--- a/packages/form-code-generator-vscode-command/package.json
+++ b/packages/form-code-generator-vscode-command/package.json
@@ -21,9 +21,11 @@
     "lint": "run-script-if --bool \"$(build-env linters.run)\" --then 
\"kie-tools--eslint ./src\""
   },
   "dependencies": {
+    "@kie-tools-core/i18n": "workspace:*",
     "@kie-tools/form-code-generator": "workspace:*",
     "@kie-tools/form-code-generator-bootstrap4-theme": "workspace:*",
     "@kie-tools/form-code-generator-patternfly-theme": "workspace:*",
+    "@kie-tools/i18n-common-dictionary": "workspace:*",
     "@kie-tools/jbpm-form-code-generator-themes": "workspace:*"
   },
   "devDependencies": {
diff --git 
a/packages/form-code-generator-vscode-command/src/generateFormCodeCommand.ts 
b/packages/form-code-generator-vscode-command/src/generateFormCodeCommand.ts
index 8148776b2e3..93d8745d173 100644
--- a/packages/form-code-generator-vscode-command/src/generateFormCodeCommand.ts
+++ b/packages/form-code-generator-vscode-command/src/generateFormCodeCommand.ts
@@ -27,6 +27,8 @@ import { jbpmPatternflyFormCodeGeneratorTheme } from 
"@kie-tools/jbpm-form-code-
 import { FormSchema } from "@kie-tools/form-code-generator/dist/types";
 import { PATTERNFLY_FILE_EXT } from 
"@kie-tools/form-code-generator-patternfly-theme/dist/theme";
 import { BOOTSTRAP4_FILE_EXT } from 
"@kie-tools/form-code-generator-bootstrap4-theme/dist/theme";
+import { formCodeGeneratorI18nDefaults, formCodeGeneratorI18nDictionaries } 
from "./i18n";
+import { I18n } from "@kie-tools-core/i18n/dist/core";
 
 const FORM_CODE_GENERATION_DEST_PATH = "src/main/resources/custom-forms-dev";
 const JSON_SCHEMA_PATH = "target/classes/META-INF/jsonSchema";
@@ -34,6 +36,12 @@ const JSON_SCHEMA_PATH = 
"target/classes/META-INF/jsonSchema";
 const BOOTSTRAP_UI_LIBRARY_NAME = "Bootstrap 4";
 const PATTERNFLY_UI_LIBRARY_NAME = "PatternFly";
 
+const i18n = new I18n(
+  formCodeGeneratorI18nDefaults,
+  formCodeGeneratorI18nDictionaries,
+  vscode.env.language
+).getCurrent();
+
 export async function generateFormsCommand() {
   // Get workspace path as default value
   const defaultPath = vscode.workspace.workspaceFolders ? 
vscode.workspace.workspaceFolders[0].uri.fsPath : undefined;
@@ -43,7 +51,7 @@ export async function generateFormsCommand() {
     canSelectFiles: false,
     canSelectFolders: true,
     canSelectMany: false,
-    title: "Select project folder",
+    title: i18n.generateFormCode.selectProjectFolder,
     defaultUri: defaultPath ? vscode.Uri.file(defaultPath) : undefined,
   });
 
@@ -57,22 +65,18 @@ export async function generateFormsCommand() {
 
   // Check if project has a target folder
   if (fs.existsSync(`${projectPath}/target`) === false) {
-    vscode.window.showErrorMessage(
-      `Couldn't find project's "target" folder. Please install your project 
before using this command.`
-    );
+    
vscode.window.showErrorMessage(i18n.generateFormCode.notFoundProjectsTarget);
     return;
   }
   // Check if project has the JSON Schemas folder
   if (fs.existsSync(`${projectPath}/${JSON_SCHEMA_PATH}`) === false) {
-    vscode.window.showErrorMessage(
-      `Couldn't find any JSON Schema, did you install your project ("mvn clean 
install")?`
-    );
+    vscode.window.showErrorMessage(i18n.generateFormCode.notFoundJsonSchema);
     return;
   }
 
   // Select UI library
   const uiLibrary = await 
vscode.window.showQuickPick([BOOTSTRAP_UI_LIBRARY_NAME, 
PATTERNFLY_UI_LIBRARY_NAME], {
-    placeHolder: "Select the UI library for the generated form(s)",
+    placeHolder: i18n.generateFormCode.uiLibraryPlaceholder,
   });
 
   // Check if a UI library was selected
@@ -107,7 +111,7 @@ export async function generateFormsCommand() {
   }
 
   const shouldOverride = await vscode.window.showQuickPick(["Override", 
"Cancel"], {
-    placeHolder: "You already have custom forms in this project. Do you want 
to override them?",
+    placeHolder: i18n.generateFormCode.customFormsPlaceholder,
   });
   if (shouldOverride === "Override") {
     // Remove previous files.
@@ -127,9 +131,9 @@ async function getFormSchemas(projectPath: string): 
Promise<FormSchema[]> {
   const GENERATE_FOR_SPECIFIC_HUMAN_INTERACTIONS = "Generate form code for 
specific User Tasks";
 
   const generationChoice = await vscode.window.showQuickPick(
-    [GENERATE_FOR_ALL_HUMAN_INTERACTIONS, 
GENERATE_FOR_SPECIFIC_HUMAN_INTERACTIONS],
+    [i18n.generateFormCode.generateForHumanTasks, 
i18n.generateFormCode.generateForSpecificHumanTasks],
     {
-      placeHolder: "Select an option",
+      placeHolder: i18n.generateFormCode.optionPlaceholder,
     }
   );
 
@@ -141,7 +145,7 @@ async function getFormSchemas(projectPath: string): 
Promise<FormSchema[]> {
       })),
       {
         canPickMany: true,
-        placeHolder: "Choose the User Tasks",
+        placeHolder: i18n.generateFormCode.userTaskPlaceholder,
       }
     );
 
@@ -181,10 +185,7 @@ function readAndParseJsonSchemas(projectPath: string, 
jsonSchemaFilesName: strin
     }
   }
   if (failedParsingFilesName.length > 0) {
-    vscode.window.showErrorMessage(
-      "JSON Schema parsing failed for the following files:",
-      failedParsingFilesName.join(", ")
-    );
+    
vscode.window.showErrorMessage(i18n.generateFormCode.parsingFailed(failedParsingFilesName.join(",
 ")));
   }
   return formSchemas;
 }
@@ -198,7 +199,7 @@ function saveFormCode(projectPath: string, uiLibrary: 
string, formSchemas: FormS
         : undefined;
 
   if (formCode === undefined) {
-    vscode.window.showErrorMessage(`The "${uiLibrary}" UI library isn't 
available.`);
+    
vscode.window.showErrorMessage(i18n.generateFormCode.uiLibraryNotAvailable(uiLibrary));
     return undefined;
   }
 
@@ -221,7 +222,7 @@ function saveFormCode(projectPath: string, uiLibrary: 
string, formSchemas: FormS
       );
     });
     vscode.window.showInformationMessage(
-      `Success generating form code for the following files: 
${formAssets.map((formAsset) => formAsset.fileName).join(", ")}`
+      i18n.generateFormCode.successFormGeneration(formAssets.map((formAsset) 
=> formAsset.fileName).join(", "))
     );
   }
 
@@ -232,7 +233,7 @@ function saveFormCode(projectPath: string, uiLibrary: 
string, formSchemas: FormS
   );
   if (formErrors.length > 0) {
     vscode.window.showErrorMessage(
-      `Error generating form code for the following files: 
${formErrors.map((formError) => formError.fileName).join(", ")}`
+      i18n.generateFormCode.errorFormGeneration(formErrors.map((formError) => 
formError.fileName).join(", "))
     );
   }
 }
diff --git 
a/packages/form-code-generator-vscode-command/src/i18n/FormCodeGeneratorI18n.ts 
b/packages/form-code-generator-vscode-command/src/i18n/FormCodeGeneratorI18n.ts
new file mode 100644
index 00000000000..5a85a90b5c1
--- /dev/null
+++ 
b/packages/form-code-generator-vscode-command/src/i18n/FormCodeGeneratorI18n.ts
@@ -0,0 +1,40 @@
+/*
+ * 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";
+
+interface FormCodeGeneratorDictionary extends ReferenceDictionary {
+  generateFormCode: {
+    selectProjectFolder: string;
+    notFoundProjectsTarget: string;
+    notFoundJsonSchema: string;
+    uiLibraryPlaceholder: string;
+    customFormsPlaceholder: string;
+    generateForHumanTasks: string;
+    generateForSpecificHumanTasks: string;
+    optionPlaceholder: string;
+    userTaskPlaceholder: string;
+    parsingFailed(files: string): string;
+    uiLibraryNotAvailable(uiLibrary: string): string;
+    successFormGeneration(files: string): string;
+    errorFormGeneration(files: string): string;
+  };
+}
+
+export interface FormCodeGeneratorI18n extends FormCodeGeneratorDictionary {}
diff --git a/packages/form-code-generator-vscode-command/src/i18n/index.ts 
b/packages/form-code-generator-vscode-command/src/i18n/index.ts
new file mode 100644
index 00000000000..a046761558e
--- /dev/null
+++ b/packages/form-code-generator-vscode-command/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 "./FormCodeGeneratorI18n";
+export * from "./setup";
diff --git a/packages/form-code-generator-vscode-command/src/i18n/locales/en.ts 
b/packages/form-code-generator-vscode-command/src/i18n/locales/en.ts
new file mode 100644
index 00000000000..12aab176521
--- /dev/null
+++ b/packages/form-code-generator-vscode-command/src/i18n/locales/en.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 { FormCodeGeneratorI18n } from "../FormCodeGeneratorI18n";
+
+export const en: FormCodeGeneratorI18n = {
+  generateFormCode: {
+    selectProjectFolder: "Select project folder",
+    notFoundProjectsTarget: `Couldn't find project's "target" folder. Please 
install your project before using this command.`,
+    notFoundJsonSchema: `Couldn't find any JSON Schema, did you install your 
project ("mvn clean install")?`,
+    uiLibraryPlaceholder: "Select the UI library for the generated form(s)",
+    customFormsPlaceholder: "You already have custom forms in this project. Do 
you want to override them?",
+    generateForHumanTasks: "Generate form code for all User Tasks",
+    generateForSpecificHumanTasks: "Generate form code for specific User 
Tasks",
+    optionPlaceholder: "Select an option",
+    userTaskPlaceholder: "Choose the User Tasks",
+    parsingFailed: (files: string): string => `JSON Schema parsing failed for 
the following files: ${files}`,
+    uiLibraryNotAvailable: (uiLibrary: string): string => `The "${uiLibrary}" 
UI library isn't available.`,
+    successFormGeneration: (files: string): string => `Success generating form 
code for the following files: ${files}`,
+    errorFormGeneration: (files: string): string => `Error generating form 
code for the following files: ${files}`,
+  },
+};
diff --git 
a/packages/form-code-generator-vscode-command/src/i18n/locales/index.ts 
b/packages/form-code-generator-vscode-command/src/i18n/locales/index.ts
new file mode 100644
index 00000000000..8bf599d3803
--- /dev/null
+++ b/packages/form-code-generator-vscode-command/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/form-code-generator-vscode-command/src/i18n/setup.ts 
b/packages/form-code-generator-vscode-command/src/i18n/setup.ts
new file mode 100644
index 00000000000..96e9276fd9c
--- /dev/null
+++ b/packages/form-code-generator-vscode-command/src/i18n/setup.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 { en } from "./locales";
+import { FormCodeGeneratorI18n } from "./FormCodeGeneratorI18n";
+import { I18n, I18nDefaults, I18nDictionaries } from 
"@kie-tools-core/i18n/dist/core";
+
+export const formCodeGeneratorI18nDefaults: 
I18nDefaults<FormCodeGeneratorI18n> = {
+  locale: "en",
+  dictionary: en,
+};
+export const formCodeGeneratorI18nDictionaries: 
I18nDictionaries<FormCodeGeneratorI18n> = new Map([["en", en]]);
+
+export const formCodeGeneratorI18n = new I18n(formCodeGeneratorI18nDefaults, 
formCodeGeneratorI18nDictionaries);
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b8495fea733..6dd695cbfab 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5985,6 +5985,9 @@ importers:
 
   packages/form-code-generator-vscode-command:
     dependencies:
+      '@kie-tools-core/i18n':
+        specifier: workspace:*
+        version: link:../i18n
       '@kie-tools/form-code-generator':
         specifier: workspace:*
         version: link:../form-code-generator
@@ -5994,6 +5997,9 @@ importers:
       '@kie-tools/form-code-generator-patternfly-theme':
         specifier: workspace:*
         version: link:../form-code-generator-patternfly-theme
+      '@kie-tools/i18n-common-dictionary':
+        specifier: workspace:*
+        version: link:../i18n-common-dictionary
       '@kie-tools/jbpm-form-code-generator-themes':
         specifier: workspace:*
         version: link:../jbpm-form-code-generator-themes
diff --git a/repo/graph.dot b/repo/graph.dot
index cbff636c2fd..503ba3586dd 100644
--- a/repo/graph.dot
+++ b/repo/graph.dot
@@ -425,6 +425,7 @@ digraph G {
   "@kie-tools/form-code-generator-bootstrap4-theme" -> 
"@kie-tools-core/webpack-base" [ style = "dashed", color = "blue" ];
   "@kie-tools/form-code-generator-patternfly-theme" -> 
"@kie-tools/form-code-generator" [ style = "solid", color = "blue" ];
   "@kie-tools/form-code-generator-patternfly-theme" -> 
"@kie-tools-core/webpack-base" [ style = "dashed", color = "blue" ];
+  "@kie-tools/form-code-generator-vscode-command" -> 
"@kie-tools/i18n-common-dictionary" [ style = "solid", color = "blue" ];
   "@kie-tools/form-code-generator-vscode-command" -> 
"@kie-tools/jbpm-form-code-generator-themes" [ style = "solid", color = "blue" 
];
   "@kie-tools/form-dmn" -> "@kie-tools/form" [ style = "solid", color = "blue" 
];
   "@kie-tools-core/i18n" -> "@kie-tools/eslint" [ style = "dashed", color = 
"purple" ];
diff --git a/repo/graph.json b/repo/graph.json
index 8827b19bdbd..1ed3d6d65cf 100644
--- a/repo/graph.json
+++ b/repo/graph.json
@@ -1030,6 +1030,11 @@
         "target": "@kie-tools/vscode-java-code-completion-extension-plugin",
         "weight": 1
       },
+      {
+        "source": "@kie-tools/form-code-generator-vscode-command",
+        "target": "@kie-tools/i18n-common-dictionary",
+        "weight": 1
+      },
       {
         "source": "@kie-tools/form-code-generator-vscode-command",
         "target": "@kie-tools/jbpm-form-code-generator-themes",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to