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 01d4038f02c kie-issues#3244: Review i18n in unitables package (#3246)
01d4038f02c is described below

commit 01d4038f02c70927e2671543f3c09ecb8b265060
Author: Kusuma04-dev <[email protected]>
AuthorDate: Tue Sep 9 03:55:25 2025 +0530

    kie-issues#3244: Review i18n in unitables package (#3246)
    
    Co-authored-by: Kusuma <[email protected]>
---
 packages/online-editor/src/i18n/locales/en.ts             |  4 +++-
 packages/unitables-dmn/src/DmnRunnerOutputsTable.tsx      | 14 ++++++--------
 packages/unitables-dmn/src/i18n/locales/en.ts             |  4 ++--
 packages/unitables/src/Unitables.tsx                      | 10 +++++-----
 packages/unitables/src/UnitablesWrapper.tsx               | 15 ++++++++++-----
 packages/unitables/src/i18n/UnitablesI18n.ts              |  8 ++++++++
 packages/unitables/src/i18n/locales/en.ts                 |  9 +++++++++
 .../unitables/src/uniforms/UnitablesNotSupportedField.tsx | 12 ++++++++++--
 8 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/packages/online-editor/src/i18n/locales/en.ts 
b/packages/online-editor/src/i18n/locales/en.ts
index 2f6add5d92a..3b44e84a5c5 100644
--- a/packages/online-editor/src/i18n/locales/en.ts
+++ b/packages/online-editor/src/i18n/locales/en.ts
@@ -459,7 +459,9 @@ export const en: OnlineI18n = {
         " and report an issue. Don't forget to upload the current file, and 
the used inputs",
       ],
     },
-    table: { ...en_unitables },
+    table: {
+      ...en_unitables,
+    },
     modal: {
       initial: {
         runDmnModels: "Run your models and see live forms and results as you 
edit.",
diff --git a/packages/unitables-dmn/src/DmnRunnerOutputsTable.tsx 
b/packages/unitables-dmn/src/DmnRunnerOutputsTable.tsx
index 89d5d0b7d65..2d172654bdc 100644
--- a/packages/unitables-dmn/src/DmnRunnerOutputsTable.tsx
+++ b/packages/unitables-dmn/src/DmnRunnerOutputsTable.tsx
@@ -90,7 +90,7 @@ export function DmnRunnerOutputsTable({
       {outputError ? (
         outputError
       ) : numberOfResults > 0 ? (
-        <ErrorBoundary ref={outputErrorBoundaryRef} 
setHasError={setOutputError} error={<OutputError />}>
+        <ErrorBoundary ref={outputErrorBoundaryRef} 
setHasError={setOutputError} error={<OutputError i18n={i18n} />}>
           <OutputsBeeTable
             scrollableParentRef={scrollableParentRef}
             i18n={i18n}
@@ -105,12 +105,10 @@ export function DmnRunnerOutputsTable({
         <EmptyState>
           <EmptyStateHeader icon={<EmptyStateIcon icon={CubeIcon} />} />
           <TextContent>
-            <Text component={"h2"}>No Decision results yet...</Text>
+            <Text component={"h2"}>{i18n.noDecisionResults}</Text>
           </TextContent>
           <EmptyStateBody>
-            <TextContent>
-              Add input and decision nodes, provide values to the inputs at 
the left and see the Decisions results here.
-            </TextContent>
+            <TextContent>{i18n.addInputDecisionNodes}</TextContent>
           </EmptyStateBody>
         </EmptyState>
       )}
@@ -118,16 +116,16 @@ export function DmnRunnerOutputsTable({
   );
 }
 
-function OutputError() {
+function OutputError(props: { i18n: DmnUnitablesI18n }) {
   return (
     <div>
       <EmptyState>
         <EmptyStateHeader icon={<EmptyStateIcon icon={ExclamationIcon} />} />
         <TextContent>
-          <Text component={"h2"}>Error</Text>
+          <Text component={"h2"}>{props.i18n.error}</Text>
         </TextContent>
         <EmptyStateBody>
-          <p>An error has happened while trying to show your Decision 
results</p>
+          <p>{props.i18n.errorMessage}</p>
         </EmptyStateBody>
       </EmptyState>
     </div>
diff --git a/packages/unitables-dmn/src/i18n/locales/en.ts 
b/packages/unitables-dmn/src/i18n/locales/en.ts
index 748629a1600..a1fc28d0f15 100644
--- a/packages/unitables-dmn/src/i18n/locales/en.ts
+++ b/packages/unitables-dmn/src/i18n/locales/en.ts
@@ -19,11 +19,11 @@
 
 import { DmnUnitablesI18n } from "..";
 import { en as en_common } from "@kie-tools/i18n-common-dictionary";
-import { en as en_boxed_expression } from 
"@kie-tools/boxed-expression-component/dist/i18n/locales/en";
+import { en as en_unitables } from "@kie-tools/unitables/dist/i18n/locales/en";
 
 export const en: DmnUnitablesI18n = {
   ...en_common,
-  ...en_boxed_expression,
+  ...en_unitables,
   schema: {
     selectPlaceholder: "Select...",
   },
diff --git a/packages/unitables/src/Unitables.tsx 
b/packages/unitables/src/Unitables.tsx
index f3562681c2e..e6fdc3ad82b 100644
--- a/packages/unitables/src/Unitables.tsx
+++ b/packages/unitables/src/Unitables.tsx
@@ -226,7 +226,7 @@ export const Unitables = ({
       >
         <OutsideRowMenu height={128} isFirstChild={true}>{`#`}</OutsideRowMenu>
         {rows.map((_, rowIndex) => (
-          <Tooltip key={rowIndex} content={`Open row ${rowIndex + 1} in the 
form view`}>
+          <Tooltip key={rowIndex} content={i18n.openRowFormView(rowIndex)}>
             <OutsideRowMenu height={61} isLastChild={rowIndex === rows.length 
- 1}>
               <Button
                 className={"kie-tools--masthead-hoverable"}
@@ -258,7 +258,7 @@ export const Unitables = ({
           />
         </div>
       ) : (
-        <EmptyUnitables />
+        <EmptyUnitables i18n={i18n} />
       )}
       <div ref={() => setFormsDivRendered(true)} id={FORMS_ID} />
     </>
@@ -298,16 +298,16 @@ function OutsideRowMenu({
   );
 }
 
-function EmptyUnitables() {
+function EmptyUnitables(props: { i18n: UnitablesI18n }) {
   return (
     <div style={{ width: "50vw" }}>
       <EmptyState>
         <EmptyStateHeader icon={<EmptyStateIcon icon={CubeIcon} />} />
         <TextContent>
-          <Text component={"h2"}>No inputs node yet...</Text>
+          <Text component={"h2"}>{props.i18n.noInputNodes}</Text>
         </TextContent>
         <EmptyStateBody>
-          <TextContent>Add an input node and see a custom table 
here.</TextContent>
+          <TextContent>{props.i18n.addInputNode}</TextContent>
         </EmptyStateBody>
       </EmptyState>
     </div>
diff --git a/packages/unitables/src/UnitablesWrapper.tsx 
b/packages/unitables/src/UnitablesWrapper.tsx
index 9376584d41e..101bd0458df 100644
--- a/packages/unitables/src/UnitablesWrapper.tsx
+++ b/packages/unitables/src/UnitablesWrapper.tsx
@@ -30,6 +30,7 @@ import {
 import { ExclamationIcon } from 
"@patternfly/react-icons/dist/js/icons/exclamation-icon";
 import { Text, TextContent } from 
"@patternfly/react-core/dist/js/components/Text";
 import { ErrorBoundary } from "@kie-tools/dmn-runner/dist/ErrorBoundary";
+import { UnitablesI18n } from "./i18n";
 
 export function UnitablesWrapper(props: UnitablesProps) {
   const inputErrorBoundaryRef = useRef<ErrorBoundary>(null);
@@ -42,9 +43,13 @@ export function UnitablesWrapper(props: UnitablesProps) {
   return (
     <UnitablesContextProvider rowsInputs={props.rows}>
       {props.error ? (
-        <InputError />
+        <InputError i18n={props.i18n} />
       ) : (
-        <ErrorBoundary ref={inputErrorBoundaryRef} 
setHasError={props.setError} error={<InputError />}>
+        <ErrorBoundary
+          ref={inputErrorBoundaryRef}
+          setHasError={props.setError}
+          error={<InputError i18n={props.i18n} />}
+        >
           <Unitables {...props} />
         </ErrorBoundary>
       )}
@@ -52,16 +57,16 @@ export function UnitablesWrapper(props: UnitablesProps) {
   );
 }
 
-function InputError() {
+function InputError(props: { i18n: UnitablesI18n }) {
   return (
     <div style={{ width: "50vw" }}>
       <EmptyState>
         <EmptyStateHeader icon={<EmptyStateIcon icon={ExclamationIcon} />} />
         <TextContent>
-          <Text component={"h2"}>Error</Text>
+          <Text component={"h2"}>{props.i18n.error}</Text>
         </TextContent>
         <EmptyStateBody>
-          <p>An error has happened while trying to show your inputs</p>
+          <p>{props.i18n.errorMessage}</p>
         </EmptyStateBody>
       </EmptyState>
     </div>
diff --git a/packages/unitables/src/i18n/UnitablesI18n.ts 
b/packages/unitables/src/i18n/UnitablesI18n.ts
index 86303031d63..5db120fc644 100644
--- a/packages/unitables/src/i18n/UnitablesI18n.ts
+++ b/packages/unitables/src/i18n/UnitablesI18n.ts
@@ -25,6 +25,14 @@ interface UnitablesDictionary extends ReferenceDictionary {
   schema: {
     selectPlaceholder: string;
   };
+  recursiveNotSupported: string;
+  openRowFormView: (rowIndex: number) => string;
+  noInputNodes: string;
+  addInputNode: string;
+  error: string;
+  errorMessage: string;
+  noDecisionResults: string;
+  addInputDecisionNodes: string;
 }
 
 export interface UnitablesI18n extends UnitablesDictionary, CommonI18n, 
BoxedExpressionEditorI18n {}
diff --git a/packages/unitables/src/i18n/locales/en.ts 
b/packages/unitables/src/i18n/locales/en.ts
index f2cb08159a4..17adb0344b0 100644
--- a/packages/unitables/src/i18n/locales/en.ts
+++ b/packages/unitables/src/i18n/locales/en.ts
@@ -27,4 +27,13 @@ export const en: UnitablesI18n = {
   schema: {
     selectPlaceholder: "Select...",
   },
+  recursiveNotSupported: "Recursive structures are not supported yet",
+  openRowFormView: (rowIndex: number): string => `Open row ${rowIndex + 1} in 
the form view`,
+  noInputNodes: "No inputs node yet...",
+  addInputNode: "Add an input node and see a custom table here.",
+  error: "Error",
+  errorMessage: "An error has happened while trying to show your inputs",
+  noDecisionResults: "No Decision results yet...",
+  addInputDecisionNodes:
+    "Add input and decision nodes, provide values to the inputs at the left 
and see the Decisions results here.",
 };
diff --git a/packages/unitables/src/uniforms/UnitablesNotSupportedField.tsx 
b/packages/unitables/src/uniforms/UnitablesNotSupportedField.tsx
index e51a864e8f5..8b24f3aa544 100644
--- a/packages/unitables/src/uniforms/UnitablesNotSupportedField.tsx
+++ b/packages/unitables/src/uniforms/UnitablesNotSupportedField.tsx
@@ -21,6 +21,7 @@ import * as React from "react";
 import { HTMLFieldProps } from "uniforms";
 import { connectField, filterDOMProps } from "uniforms/esm";
 import wrapField from "@kie-tools/uniforms-patternfly/dist/esm/wrapField";
+import { UnitablesI18n } from "../i18n";
 
 export type UnitablesNotSupportedFieldProps = HTMLFieldProps<
   object,
@@ -28,7 +29,14 @@ export type UnitablesNotSupportedFieldProps = HTMLFieldProps<
   { recursion: boolean; recursionRef: string }
 >;
 
-function UnitablesNotSupportedField({ recursion, recursionRef, ...props }: 
UnitablesNotSupportedFieldProps) {
+interface UnitablesI18nProps {
+  i18n: UnitablesI18n;
+}
+
+function UnitablesNotSupportedField(
+  { recursion, recursionRef, ...props }: UnitablesNotSupportedFieldProps,
+  unitableI18nProp: UnitablesI18nProps
+) {
   return wrapField(
     props as any,
     <div style={{ display: "flex" }} {...filterDOMProps(props)}>
@@ -43,7 +51,7 @@ function UnitablesNotSupportedField({ recursion, 
recursionRef, ...props }: Unita
           width: "100%",
         }}
       >
-        Recursive structures are not supported yet
+        {unitableI18nProp.i18n.recursiveNotSupported}
       </div>
     </div>
   );


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

Reply via email to