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 301d9ed1d09 kie-issues#3254: Add i18n for feel-input-component package
(#3255)
301d9ed1d09 is described below
commit 301d9ed1d0953af3ceedc44eb267d0d5d0926b4e
Author: Kusuma04-dev <[email protected]>
AuthorDate: Fri Sep 19 00:53:22 2025 +0530
kie-issues#3254: Add i18n for feel-input-component package (#3255)
Co-authored-by: Kusuma <[email protected]>
---
.../src/expressionVariable/FeelInputTextbox.tsx | 3 +
.../table/BeeTable/BeeTableEditableCellContent.tsx | 3 +
.../src/dataTypes/ConstraintsExpression.tsx | 2 +
packages/feel-input-component/showcase/index.tsx | 6 +-
packages/feel-input-component/src/FeelConfigs.ts | 311 ++++++++++-----------
packages/feel-input-component/src/FeelInput.tsx | 6 +-
.../src/i18n/FeelInputComponentI18n.ts | 174 ++++++++++++
packages/feel-input-component/src/i18n/index.ts | 21 ++
.../feel-input-component/src/i18n/locales/en.ts | 254 +++++++++++++++++
.../feel-input-component/src/i18n/locales/index.ts | 20 ++
packages/feel-input-component/src/i18n/setup.ts | 36 +++
11 files changed, 675 insertions(+), 161 deletions(-)
diff --git
a/packages/boxed-expression-component/src/expressionVariable/FeelInputTextbox.tsx
b/packages/boxed-expression-component/src/expressionVariable/FeelInputTextbox.tsx
index 6598585bdd0..2f2554fdb11 100644
---
a/packages/boxed-expression-component/src/expressionVariable/FeelInputTextbox.tsx
+++
b/packages/boxed-expression-component/src/expressionVariable/FeelInputTextbox.tsx
@@ -24,6 +24,7 @@ import { NavigationKeysUtils } from "../keysUtils/keyUtils";
import "./FeelInputTextbox.css";
import { FeelInput, FeelInputRef } from "@kie-tools/feel-input-component";
import * as Monaco from "@kie-tools-core/monaco-editor";
+import { useBoxedExpressionEditorI18n } from "../i18n";
export interface FeelInputComponentProps {
value: string;
@@ -33,6 +34,7 @@ export interface FeelInputComponentProps {
export function FeelInputTextbox({ value, onChange, expressionId }:
FeelInputComponentProps) {
const feelInputRef = useRef<FeelInputRef>(null);
+ const { locale } = useBoxedExpressionEditorI18n();
const MONACO_OPTIONS: Monaco.editor.IStandaloneEditorConstructionOptions = {
fixedOverflowWidgets: true,
@@ -105,6 +107,7 @@ export function FeelInputTextbox({ value, onChange,
expressionId }: FeelInputCom
onBlur={onFeelBlur}
feelIdentifiers={feelIdentifiers}
expressionId={expressionId}
+ locale={locale}
/>
</div>
);
diff --git
a/packages/boxed-expression-component/src/table/BeeTable/BeeTableEditableCellContent.tsx
b/packages/boxed-expression-component/src/table/BeeTable/BeeTableEditableCellContent.tsx
index cbc5c65953d..db0f597d8d4 100644
---
a/packages/boxed-expression-component/src/table/BeeTable/BeeTableEditableCellContent.tsx
+++
b/packages/boxed-expression-component/src/table/BeeTable/BeeTableEditableCellContent.tsx
@@ -25,6 +25,7 @@ import { NavigationKeysUtils } from
"../../keysUtils/keyUtils";
import { useBoxedExpressionEditor } from "../../BoxedExpressionEditorContext";
import "./BeeTableEditableCellContent.css";
import { getOperatingSystem, OperatingSystem } from
"@kie-tools-core/operating-system";
+import { useBoxedExpressionEditorI18n } from "../../i18n";
const CELL_LINE_HEIGHT = 20;
@@ -71,6 +72,7 @@ export function BeeTableEditableCellContent({
const [previousValue, setPreviousValue] = useState(value);
const [editingValue, setEditingValue] = useState(value);
const feelInputRef = useRef<FeelInputRef>(null);
+ const { locale } = useBoxedExpressionEditorI18n();
const mode = useMemo(() => {
return isEditing && !isReadOnly ? Mode.Edit : Mode.Read;
@@ -223,6 +225,7 @@ export function BeeTableEditableCellContent({
onBlur={onFeelBlur}
feelIdentifiers={feelIdentifiers}
expressionId={expressionId}
+ locale={locale}
/>
</div>
</>
diff --git a/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
b/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
index 3a6e1eb1cd7..51f9ebd713c 100644
--- a/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
+++ b/packages/dmn-editor/src/dataTypes/ConstraintsExpression.tsx
@@ -49,6 +49,7 @@ export function ConstraintsExpression({
const [isEditing, setEditing] = useState(false);
const valueCopy = useRef(value);
const FEEL_HANDBOOK_URL =
"https://kiegroup.github.io/dmn-feel-handbook/#feel-values";
+ const { locale } = useDmnEditorI18n();
const onFeelBlur = useCallback((valueOnBlur: string) => {
setEditing(false);
@@ -131,6 +132,7 @@ export function ConstraintsExpression({
onPreviewChanged={onPreviewChanged}
enabled={!isReadOnly}
options={monacoOptions as any}
+ locale={locale}
/>
</div>
<HelperText>
diff --git a/packages/feel-input-component/showcase/index.tsx
b/packages/feel-input-component/showcase/index.tsx
index 2eb346f97e7..f173136804b 100644
--- a/packages/feel-input-component/showcase/index.tsx
+++ b/packages/feel-input-component/showcase/index.tsx
@@ -23,6 +23,8 @@ import * as ReactDOM from "react-dom";
import { FeelService } from "./FeelService";
import "./index.css";
import { FeelInput } from "../src";
+import { feelInputComponentDictionaries, feelInputComponentI18nDefaults } from
"../src/i18n";
+import { I18n } from "@kie-tools-core/i18n/dist/core";
const feelServerUrl =
process.env.WEBPACK_REPLACE__FEEL_INPUT_COMPONENT_DEV_WEBAPP__feelServerUrl;
if (!feelServerUrl) {
@@ -71,6 +73,7 @@ const FeelEditor = () => {
}, [feelExpression]);
const feelInput = useMemo(() => {
+ const locale = new I18n(feelInputComponentI18nDefaults,
feelInputComponentDictionaries).getLocale();
return (
<FeelInput
enabled={true}
@@ -81,9 +84,10 @@ const FeelEditor = () => {
options={{
lineNumbers: "on",
}}
+ locale={locale}
/>
);
- }, [setFeelExpression, suggestionProvider]);
+ }, [suggestionProvider]);
const feelOutput = useMemo(() => {
return (
diff --git a/packages/feel-input-component/src/FeelConfigs.ts
b/packages/feel-input-component/src/FeelConfigs.ts
index cd414a19a91..9215e98b654 100644
--- a/packages/feel-input-component/src/FeelConfigs.ts
+++ b/packages/feel-input-component/src/FeelConfigs.ts
@@ -20,6 +20,8 @@
import * as Monaco from "@kie-tools-core/monaco-editor";
import { ReservedWords } from "@kie-tools/dmn-feel-antlr4-parser";
import { Element } from "./themes/Element";
+import { feelInputComponentDictionaries, FeelInputComponentI18n,
feelInputComponentI18nDefaults } from "./i18n";
+import { I18n } from "@kie-tools-core/i18n/dist/core";
export const MONACO_FEEL_LANGUAGE = "feel-language";
@@ -91,7 +93,8 @@ export const feelDefaultConfig = (
};
};
-export const feelDefaultSuggestions = (): Monaco.languages.CompletionItem[] =>
{
+export const feelDefaultSuggestions = (locale: string):
Monaco.languages.CompletionItem[] => {
+ const i18n = new I18n(feelInputComponentI18nDefaults,
feelInputComponentDictionaries).setLocale(locale).getCurrent();
const suggestions: Monaco.languages.CompletionItem[] = [];
const suggestionTypes = {
@@ -125,14 +128,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "abs(n)",
insertText: "abs($1)",
- description: "Returns the absolute value of `n`",
+ description: i18n.functionDescription.absDescription("n"),
parameters: [["n", `\`number\`, \`days and time duration\`, \`years
and months duration\``]],
examples: ["abs( 10 ) = 10", "abs( -10 ) = 10", 'abs( @"PT5H" ) =
@"PT5H"', 'abs( @"-PT5H" ) = @"PT5H"'],
},
{
label: "after(point1, point2)",
insertText: "after($1, $2)",
- description: "Returns true when `point1` is after `point2`",
+ description: i18n.functionDescription.afterPoint("true", "point1",
"point2"),
parameters: [
["point1", `\`number\``],
["point2", `\`number\``],
@@ -142,7 +145,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "after(point, range)",
insertText: "after($1, $2)",
- description: "Returns true when `point` is after `range`",
+ description: i18n.functionDescription.afterPointRange("true", "point",
"range"),
parameters: [
["point", `\`number\``],
["range", `\`range\` (\`interval\`)`],
@@ -152,7 +155,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "after(range, point)",
insertText: "after($1, $2)",
- description: "Returns true when `range` is after `point`",
+ description: i18n.functionDescription.afterRangePoint("true", "range",
"point"),
parameters: [
["range", `\`range\` (\`interval\`)`],
["point", `\`number\``],
@@ -167,7 +170,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "after(range1, range2)",
insertText: "after($1, $2)",
- description: "Returns true when `range1` is after `range2`",
+ description: i18n.functionDescription.afterRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -182,7 +185,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "all(list)",
insertText: "all($1)",
- description: "Returns true if all elements in the `list` are true.",
+ description: i18n.functionDescription.allTrue("true", "list"),
parameters: [["list", `\`list\` of \`boolean\` elements`]],
examples: [
"all( [false,null,true] ) = false",
@@ -195,8 +198,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "any(list)",
insertText: "any($1)",
- description:
- "Returns true if any `list` item is true, else false if empty or all
`list` items are false, else null",
+ description: i18n.functionDescription.anyTrue("true", "list", "false",
"null"),
parameters: [["list", `\`list\` of \`boolean\` elements`]],
examples: [
"any( [false,null,true] ) = true",
@@ -209,7 +211,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "append(list, item)",
insertText: "append($1, $2)",
- description: "Returns new list with items appended",
+ description: i18n.functionDescription.append("list"),
parameters: [
["list", `\`list\``],
["item", "Any type (even more items)"],
@@ -219,7 +221,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "before(point1, point2)",
insertText: "before($1, $2)",
- description: "Returns true when `point1` is before `point2`",
+ description: i18n.functionDescription.beforePoint("true", "point1",
"point2"),
parameters: [
["point1", `\`number\``],
["point2", `\`number\``],
@@ -229,7 +231,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "before(point, range)",
insertText: "before($1, $2)",
- description: "Returns true when `point` is before `range`",
+ description: i18n.functionDescription.beforePointRange("true",
"point", "range"),
parameters: [
["point", `\`number\``],
["range", `\`range\` (\`interval\`)`],
@@ -239,7 +241,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "before(range, point)",
insertText: "before($1, $2)",
- description: "Returns true when a `range` is before `point`",
+ description: i18n.functionDescription.beforeRangePoint("true",
"range", "point"),
parameters: [
["range", `\`range\` (\`interval\`)`],
["point", `\`number\``],
@@ -249,7 +251,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "before(range1, range1)",
insertText: "before($1, $2)",
- description: "Returns true when `range1` is before `range2`",
+ description: i18n.functionDescription.beforeRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -264,15 +266,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "ceiling(n)",
insertText: "ceiling($1)",
- description: "Returns `n` with rounding mode ceiling. If `n` is null
the result is null.",
+ description: i18n.functionDescription.ceiling("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["ceiling( 1.5 ) = 2", "ceiling( -1.5 ) = -1"],
},
{
label: "ceiling(n, scale)",
insertText: "ceiling($1, $2)",
- description:
- "Returns `n` with given scale and rounding mode ceiling. If at least
one of `n` or `scale` is null, the result is null. The `scale` must be in the
range [−6111..6176].",
+ description: i18n.functionDescription.ceilingScale("n", "scale",
"null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -289,7 +290,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "coincides(point1, point2)",
insertText: "coincides($1, $2)",
- description: "Returns true when `point1` coincides with `point2`",
+ description: i18n.functionDescription.coincides("true", "point1",
"point2"),
parameters: [
["point1", `\`number\``],
["point2", `\`number\``],
@@ -299,7 +300,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "coincides(range1, range2)",
insertText: "coincides($1, $2)",
- description: "Returns true when `range1` coincides with `range2`",
+ description: i18n.functionDescription.coincidesRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -313,14 +314,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "concatenate(list...)",
insertText: "concatenate($1)",
- description: "Returns a new list that is a concatenation of the
arguments",
+ description: i18n.functionDescription.concatenate("list"),
parameters: [["list", `Multiple \`list\``]],
examples: ["concatenate( [1,2], [3] ) = [1,2,3]"],
},
{
label: "contains(string, match)",
insertText: "contains($1, $2)",
- description: "Does the `string` contain the `match`?",
+ description: i18n.functionDescription.contains("string", "match"),
parameters: [
["string", `string`],
["match", `string`],
@@ -330,8 +331,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "context(entries)",
insertText: "context($1)",
- description:
- "Returns a new `context` that includes all specified entries. If a
`context` item contains additional entries beyond the required `key` and
`value` entries, the additional entries are ignored. If a `context` item is
missing the required `key` and `value` entries, the final result is null.",
+ description: i18n.functionDescription.contextKeyValue("context",
"key", "value", "null"),
parameters: [["entries", `\`list\` of \`context\``]],
examples: [
'context( [{key:"a", value:1}, {key:"b", value:2}] ) = { a:1, b:2 }',
@@ -342,16 +342,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "context merge(contexts)",
insertText: "context merge($1)",
- description:
- "Returns a new `context` that includes all entries from the given
`contexts`; if some of the keys are equal, the entries are overridden. The
entries are overridden in the same order as specified by the supplied
parameter, with new entries added as the last entry in the new context.",
+ description: i18n.functionDescription.contextMerge("context",
"contexts"),
parameters: [["contexts", `\`list\` of \`context\``]],
examples: ["context merge( [{x:1}, {y:2}] ) = {x:1, y:2}", "context
merge( [{x:1, y:0}, {y:2}] ) = {x:1, y:2}"],
},
{
label: "context put(context, key, value)",
insertText: "context put($1, $2, $3)",
- description:
- "Returns a new `context` that includes the new entry, or overrides
the existing value if an entry for the same key already exists in the supplied
`context` parameter. A new entry is added as the last entry of the new context.
If overriding an existing entry, the order of the keys maintains the same order
as in the original context.",
+ description: i18n.functionDescription.context("context"),
parameters: [
["context", `\`context\``],
["key", `\`string\``],
@@ -366,8 +364,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "context put(context, keys, value)",
insertText: "context put($1, $2, $3)",
- description:
- "Returns the composite of nested invocations to `context put()` for
each item in keys hierarchy in `context`.",
+ description: i18n.functionDescription.contextPut("context", "context
put()"),
parameters: [
["context", `\`context\``],
["keys", `\`list\` of \`string\``],
@@ -383,14 +380,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "count(list)",
insertText: "count($1)",
- description: "Returns size of `list`, or zero if `list` is empty",
+ description: i18n.functionDescription.count("list"),
parameters: [["list", `\`list\``]],
examples: ["count( [1,2,3] ) = 3", "count( [] ) = 0", "count( [1,
[2,3]] ) = 2"],
},
{
label: "date(from)",
insertText: "date($1)",
- description: "convert `from` to a date",
+ description: i18n.functionDescription.date("from"),
parameters: [["from", `\`string\` or \`date and time\``]],
examples: [
'date( "2012-12-25" ) – date( "2012-12-24" ) = duration( "P1D" )',
@@ -400,7 +397,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date(year, month, day)",
insertText: "date($1, $2, $3)",
- description: "Creates a date from `year`, `month`, `day` component
values",
+ description: i18n.functionDescription.dateyear("year", "month", "day"),
parameters: [
["year", `\`number\``],
["month", `\`number\``],
@@ -411,7 +408,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(from)",
insertText: "date and time($1)",
- description: "convert `from` to a date and time",
+ description: i18n.functionDescription.dateTimeFrom("from"),
parameters: [["from", `string`]],
examples: [
'date and time( "2012-12-24T23:59:00" ) + duration( "PT1M" ) = date
and time( "2012-12-25T00:00:00" )',
@@ -420,7 +417,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(date, time)",
insertText: "date and time($1, $2)",
- description: "Creates a date time from the given `date` (ignoring any
time component) and the given `time`",
+ description: i18n.functionDescription.dateTime("date", "time"),
parameters: [
["date", `\`date\` or \`date and time\``],
["time", `\`time\``],
@@ -432,7 +429,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(date, time, timezone)",
insertText: "date and time($1, $2, $3)",
- description: "Creates a date time from the given `date`, `time` and
timezone",
+ description: i18n.functionDescription.datetimezone("date", "time"),
parameters: [
["date", `\`date\` or \`date and time\``],
["time", `\`time\``],
@@ -446,7 +443,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(year, month, day, hour, minute, second)",
insertText: "date and time($1, $2, $3, $4, $5, $6)",
- description: "Creates a date time from the given `year`, `month`,
`day`, `hour`, `minute`, and `second`.",
+ description: i18n.functionDescription.dateYearSecond("year", "month",
"day", "hour", "minute", "second"),
parameters: [
["year", `\`number\``],
["month", `\`number\``],
@@ -460,8 +457,15 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(year, month, day, hour, minute, second, offset)",
insertText: "date and time($1, $2, $3, $4, $5, $6, $7)",
- description:
- "Creates a date time from the given `year`, `month`, `day`, `hour`,
`minute`, `second` and `offset`",
+ description: i18n.functionDescription.datetYearOffset(
+ "year",
+ "month",
+ "day",
+ "hour",
+ "minute",
+ "second",
+ "offset"
+ ),
parameters: [
["year", `\`number\``],
["month", `\`number\``],
@@ -476,8 +480,15 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "date and time(year, month, day, hour, minute, second,
timezone)",
insertText: "date and time($1, $2, $3, $4, $5, $6, $7)",
- description:
- "Creates a date time from the given `year`, `month`, `day`, `hour`,
`minute`, `second` and `timezone`",
+ description: i18n.functionDescription.datetTimeTimezone(
+ "year",
+ "month",
+ "day",
+ "hour",
+ "minute",
+ "second",
+ "timezone"
+ ),
parameters: [
["year", `\`number\``],
["month", `\`number\``],
@@ -492,22 +503,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "day of week(date)",
insertText: "day of week($1)",
- description:
- "Returns the day of the week according to the Gregorian calendar
enumeration: “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”,
“Saturday”, “Sunday”",
+ description: i18n.functionDescription.dayOfWeek("day"),
parameters: [["date", `\`date\` or \`date and time\``]],
examples: ['day of week( date(2019, 9, 17) ) = "Tuesday"'],
},
{
label: "day of year(date)",
insertText: "day of year($1)",
- description: "Returns the Gregorian number of the day within the year",
+ description: i18n.functionDescription.dateOfYear("day"),
parameters: [["date", `\`date\` or \`date and time\``]],
examples: ["day of year( date(2019, 9, 17) ) = 260"],
},
{
label: "decimal(n, scale)",
insertText: "decimal($1, $2)",
- description: "Returns `n` with given `scale. The `scale` must be in
the range [−6111..6176].`",
+ description: i18n.functionDescription.decimal("n", "scale"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -525,14 +535,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "distinct values(list)",
insertText: "distinct values($1)",
- description: "Returns `list` without duplicates",
+ description: i18n.functionDescription.distinctValues("list"),
parameters: [["list", `\`list\``]],
examples: ["distinct values( [1,2,3,2,1] ) = [1,2,3]"],
},
{
label: "duration(from)",
insertText: "duration($1)",
- description: "Converts `from` to a days and time or years and months
duration",
+ description: i18n.functionDescription.duration("from"),
parameters: [["from", `string`]],
examples: [
'date and time( "2012-12-24T23:59:00" ) - date and time(
"2012-12-22T03:45:00" ) = duration( "P2DT20H14M" )',
@@ -542,7 +552,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "during(point, range)",
insertText: "during($1, $2)",
- description: "Returns true when `point` is during `range`",
+ description: i18n.functionDescription.during("true", "point", "range"),
parameters: [
["point", `\`number\``],
["range", `\`range\` (\`interval\`)`],
@@ -559,7 +569,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "during(range1, range2)",
insertText: "during($1, $2)",
- description: "Returns true when a `range1` is during `range2`",
+ description: i18n.functionDescription.duringRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -578,7 +588,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "ends with(string, match)",
insertText: "ends with($1, $2)",
- description: "Does the `string` end with the `match`?",
+ description: i18n.functionDescription.endsWith("string", "match"),
parameters: [
["string", `string`],
["match", `string`],
@@ -588,7 +598,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "even(number)",
insertText: "even($1)",
- description: "Returns true if `number` is even, false if it is odd",
+ description: i18n.functionDescription.even("true", "number", "false"),
parameters: [
["string", `string`],
["match", `string`],
@@ -598,14 +608,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "exp(number)",
insertText: "exp($1)",
- description: "Returns the Euler’s number e raised to the power of
`number`.",
+ description: i18n.functionDescription.exp("number"),
parameters: [["number", `\`number\``]],
examples: ["exp( 5 ) = 148.413159102577"],
},
{
label: "finished by(range, point)",
insertText: "finished by($1, $2)",
- description: "Returns true when `range` is finished by `point`",
+ description: i18n.functionDescription.finishedBy("true", "range",
"point"),
parameters: [
["range", `\`range\` (\`interval\`)`],
["point", `\`number\``],
@@ -615,7 +625,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "finished by(range1, range2)",
insertText: "finished by($1, $2)",
- description: "Returns true when `range1` is finished by `range2`",
+ description: i18n.functionDescription.finishedByRange("true",
"range1", "range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -631,7 +641,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "finishes(point, range)",
insertText: "finishes($1, $2)",
- description: "Returns true when `point` finishes `range`",
+ description: i18n.functionDescription.finishes("true", "point",
"range"),
parameters: [
["point", `\`number\``],
["range", `\`range\` (\`interval\`)`],
@@ -641,7 +651,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "finishes(range1, range2)",
insertText: "finishes($1, $2)",
- description: "Returns true when `range1` finishes `range2`",
+ description: i18n.functionDescription.finishesRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -659,22 +669,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "flatten(list)",
insertText: "flatten($1)",
- description: "Flatten nested lists",
+ description: i18n.functionDescription.flattenNestedLists("lists"),
parameters: [["list", `\`list\``]],
examples: ["flatten( [[1 ,2],[[3]], 4] ) = [1,2,3,4]"],
},
{
label: "floor(n)",
insertText: "floor($1)",
- description: "Returns `n` with rounding mode flooring. If `n` is null
the result is null.",
+ description: i18n.functionDescription.floor("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["floor(1.5) = 1"],
},
{
label: "floor(n, scale)",
insertText: "floor($1, $2)",
- description:
- "Returns `n` with given scale and rounding mode flooring. If at
least one of `n` or scale is null, the result is null. The `scale` must be in
the range [−6111..6176].",
+ description: i18n.functionDescription.floorScale("n", "scale", "null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -684,7 +693,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "get entries(m)",
insertText: "get entries($1)",
- description: "Produces a list of key,value pairs from a context `m`",
+ description: i18n.functionDescription.getEntries("list", "m"),
parameters: [["m", `\`context\``]],
examples: [
'get entries( {key1 : "value1", key2 : "value2"} ) = [ { key :
"key1", value : "value1" }, {key : "key2", value : "value2"} ]',
@@ -693,7 +702,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "get value(m, key)",
insertText: "get value($1, $2)",
- description: "Select the value of the entry named `key` from context
`m`",
+ description: i18n.functionDescription.getValue("m", "key"),
parameters: [
["m", `\`context\``],
["key", `\`string\``],
@@ -706,7 +715,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "includes(range, point)",
insertText: "includes($1, $2)",
- description: "Returns true when `range` includes `point`",
+ description: i18n.functionDescription.includes("true", "range",
"point"),
parameters: [
["range", `\`range\` (\`interval\`)`],
["point", `\`number\``],
@@ -723,7 +732,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "includes(range1, range2)",
insertText: "includes($1, $2)",
- description: "Returns true when `range1` includes `range2`",
+ description: i18n.functionDescription.includesRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -742,7 +751,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "index of(list, match)",
insertText: "index of($1, $2)",
- description: "Returns ascending list of `list` positions containing
`match`",
+ description: i18n.functionDescription.indexOf("list", "match"),
parameters: [
["list", `\`list\``],
["match", `\`string\``],
@@ -752,7 +761,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "insert before(list, position, newItem)",
insertText: "insert before($1, $2, $3)",
- description: "Return new list with `newItem` inserted at `position`",
+ description: i18n.functionDescription.insertBefore("list", "position",
"newItem"),
parameters: [
["list", `\`list\``],
["position", `\`number\``],
@@ -763,7 +772,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "is(value1, value2)",
insertText: "is($1, $2)",
- description: "Returns true if both values are the same element in the
FEEL semantic domain",
+ description: i18n.functionDescription.is("true"),
parameters: [
["value1", `Any type`],
["value2", `Any type`],
@@ -785,7 +794,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "list contains(list, element)",
insertText: "list contains($1, $2)",
- description: "Does the `list` contain the `element`?",
+ description: i18n.functionDescription.listConstains("list", "element"),
parameters: [
["list", `\`list\``],
["element", `Any type`],
@@ -795,7 +804,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "list replace(list, position, newItem)",
insertText: "list replace($1, $2, $3)",
- description: "Returns new list with `newItem` replaced at `position`.",
+ description: i18n.functionDescription.listReplace("list", "newItem",
"position"),
parameters: [
["list", `\`list\``],
["position", `\`number\``],
@@ -806,8 +815,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "list replace(list, match, newItem)",
insertText: "list replace($1, $2, $3)",
- description:
- "Returns new list with `newItem` replaced at all positions where the
`match` function returned `true`",
+ description: i18n.functionDescription.listNewItem("list", "newItem",
"match", "true"),
parameters: [
["list", `\`list\``],
["match", `boolean function(item, newItem)`],
@@ -818,21 +826,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "log(number)",
insertText: "log($1)",
- description: "Returns the natural logarithm (base e) of the `number`
parameter",
+ description: i18n.functionDescription.log("number"),
parameters: [["number", `\`number\``]],
examples: ["log( 10 ) = 2.30258509299"],
},
{
label: "lower case(string)",
insertText: "lower case($1)",
- description: "Returns lowercased `string`",
+ description: i18n.functionDescription.lowerCase("string"),
parameters: [["string", `\`string\``]],
examples: ['lower case( "aBc4" ) = "abc4"'],
},
{
label: "matches(input, pattern)",
insertText: "matches($1, $2)",
- description: "Does the `input` match the regexp `pattern`?",
+ description: i18n.functionDescription.matches("input", "pattern"),
parameters: [
["input", `\`string\``],
["pattern", `\`string\``],
@@ -842,7 +850,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "matches(input, pattern, flags)",
insertText: "matches($1, $2, $3)",
- description: "Does the `input` match the regexp `pattern`?",
+ description: i18n.functionDescription.matches("input", "pattern"),
parameters: [
["input", `\`string\``],
["pattern", `\`string\``],
@@ -856,29 +864,28 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "max(list)",
insertText: "max($1)",
- description: "Returns maximum item, or null if `list` is empty",
+ description: i18n.functionDescription.max("list", "null"),
parameters: [["list", `\`list\``]],
examples: ["min( [1,2,3] ) = 1", "max( 1,2,3 ) = 3", "min( 1 ) = min(
[1] ) = 1", "max( [] ) = null"],
},
{
label: "mean(list)",
insertText: "mean($1)",
- description: "Returns arithmetic mean (average) of `list` of numbers",
+ description: i18n.functionDescription.mean("list"),
parameters: [["list", `\`list\``]],
examples: ["mean( [1,2,3] ) = 2", "mean( 1,2,3 ) = 2", "mean( 1 ) =
1", "mean( [] ) = null"],
},
{
label: "median(list)",
insertText: "median($1)",
- description:
- "Returns the median element of the `list` of numbers. I.e., after
sorting the `list`, if the `list` has an odd number of elements, it returns the
middle element. If the `list` has an even number of elements, returns the
average of the two middle elements. If the `list` is empty, returns null",
+ description: i18n.functionDescription.median("list", "null"),
parameters: [["list", `\`list\``]],
examples: ["median( 8, 2, 5, 3, 4 ) = 4", "median( [6, 1, 2, 3] ) =
2.5", "median( [ ] ) = null"],
},
{
label: "meets(range1, range2)",
insertText: "meets($1, $2)",
- description: "Returns true when `range1` meets `range2`",
+ description: i18n.functionDescription.meets("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -893,7 +900,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "met by(range1, range2)",
insertText: "met by($1, $2)",
- description: "Returns true when `range1` is met `range2`",
+ description: i18n.functionDescription.metBy("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -908,22 +915,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "min(list)",
insertText: "min($1)",
- description: "Returns minimum item, or null if `list` is empty",
+ description: i18n.functionDescription.min("list", "null"),
parameters: [["list", `\`list\``]],
examples: ["min( [1,2,3] ) = 1", "min( 1 ) = 1", "min( [1] ) = 1"],
},
{
label: "mode(list)",
insertText: "mode($1)",
- description:
- "Returns the mode of the numbers in the `list`. If multiple elements
are returned, the numbers are sorted in ascending order.",
+ description: i18n.functionDescription.mode("list"),
parameters: [["list", `\`list\``]],
examples: ["mode( 6, 3, 9, 6, 6 ) = [6]", "mode( [6, 1, 9, 6, 1] ) =
[1, 6]", "mode( [ ] ) = [ ]"],
},
{
label: "modulo(dividend, divisor)",
insertText: "modulo($1, $2)",
- description: "Returns the remainder of the division of `dividend` by
`divisor`",
+ description: i18n.functionDescription.modulo("dividend", "divisor"),
parameters: [
["dividend", `\`number\``],
["divisor", `\`number\``],
@@ -942,14 +948,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "month of year(date)",
insertText: "month of year($1)",
- description: "Returns the month of the year",
+ description: i18n.functionDescription.monthOfYear,
parameters: [["date", `\`date\` or \`date and time\``]],
examples: ['month of year( date(2017, 2, 18) ) = "February"'],
},
{
label: "nn all(list)",
insertText: "nn all($1)",
- description: "Returns true if all elements in the `list` are true.
null values are ignored",
+ description: i18n.functionDescription.nnAll("true", "list", "null"),
parameters: [["list", `\`list\` of \`boolean\` elements`]],
examples: [
"nn all( [false,null,true] ) = false",
@@ -962,7 +968,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn any(list)",
insertText: "nn any($1)",
- description: "Returns true if any element in the `list` is true. null
values are ignored",
+ description: i18n.functionDescription.nnAny("true", "list", "null"),
parameters: [["list", `\`list\` of \`boolean\` elements`]],
examples: [
"nn any( [false,null,true] ) = true",
@@ -975,7 +981,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn count(list)",
insertText: "nn count($1)",
- description: "Returns size of `list`, or zero if `list` is empty. null
values are not counted",
+ description: i18n.functionDescription.nnCount("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn count( [1,2,3] ) = 3",
@@ -987,7 +993,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn max(list)",
insertText: "nn max($1)",
- description: "Returns maximum item, or null if `list` is empty. null
values are ignored",
+ description: i18n.functionDescription.nnMax("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn min( [1,2,3] ) = 1",
@@ -1000,7 +1006,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn mean(list)",
insertText: "nn mean($1)",
- description: "Returns arithmetic mean (average) of numbers. null
values are ignored",
+ description: i18n.functionDescription.nnMean("null"),
parameters: [["list", `\`list\``]],
examples: [
"nn mean( [1,2,3] ) = 2",
@@ -1013,8 +1019,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn median(list)",
insertText: "nn median($1)",
- description:
- "Returns the median element of the `list` of numbers. null values
are ignored. I.e., after sorting the `list`, if the `list` has an odd number of
elements, it returns the middle element. If the `list` has an even number of
elements, returns the average of the two middle elements. If the `list` is
empty, returns null",
+ description: i18n.functionDescription.nnMedian("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn median( 8, 2, 5, 3, 4 ) = 4",
@@ -1026,15 +1031,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn min(list)",
insertText: "nn min($1)",
- description: "Returns minimum item, or null if `list` is empty. null
values are ignored",
+ description: i18n.functionDescription.nnMin("list", "null"),
parameters: [["list", `\`list\``]],
examples: ["nn min( [1,2,3] ) = 1", "nn min( [1,2,null,3] ) = 1", "nn
min( 1 ) = 1", "nn min( [1] ) = 1"],
},
{
label: "nn mode(list)",
insertText: "nn mode($1)",
- description:
- "Returns the mode of the numbers in the `list`. null values are
ignored. If multiple elements are returned, the numbers are sorted in ascending
order",
+ description: i18n.functionDescription.nnMode("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn mode( 6, 3, 9, 6, 6 ) = [6]",
@@ -1046,7 +1050,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn stddev(list)",
insertText: "nn stddev($1)",
- description: "Returns the standard deviation of the numbers in the
`list`. null values are ignored.",
+ description: i18n.functionDescription.nnStddev("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn stddev( 2, 4, 7, 5 ) = 2.081665999466132735282297706979931",
@@ -1059,7 +1063,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "nn sum(list)",
insertText: "nn sum($1)",
- description: "Returns the sum of the numbers in the `list`. null
values are ignored.",
+ description: i18n.functionDescription.nnSum("list", "null"),
parameters: [["list", `\`list\``]],
examples: [
"nn sum( [1,2,3] ) = 6",
@@ -1072,28 +1076,28 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "not(negand)",
insertText: "not($1)",
- description: "Performs the logical negation of the `negand` operand",
+ description: i18n.functionDescription.not("negand"),
parameters: [["negand", `\`boolean\``]],
examples: ["not( true ) = false", "not( null ) = null"],
},
{
label: "now()",
insertText: "now()",
- description: "Returns the current date and time.",
+ description: i18n.functionDescription.now("date", "time"),
parameters: [],
examples: ["now()"],
},
{
label: "number(from)",
insertText: "number($1)",
- description: "Converts `from` to a number.",
+ description: i18n.functionDescription.numbers("from"),
parameters: [["from", "`string` or `number` representing a valid
number"]],
examples: ['number( "1.1" ) = number( "1.1", "null", "null" ) = 1.1',
"number( 5 ) = 5"],
},
{
label: "number(from, grouping separator, decimal separator)",
insertText: "number($1, $2, $3)",
- description: "Converts `from` to a number using the specified
separators.",
+ description: i18n.functionDescription.numberFrom("from"),
parameters: [
["from", "`string` representing a valid number"],
["grouping separator", "Space (` `), comma (`,`), period (`.`), or
null"],
@@ -1104,14 +1108,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "odd(number)",
insertText: "odd($1)",
- description: "Returns true if the specified `number` is odd.",
+ description: i18n.functionDescription.odd("true", "number"),
parameters: [["number", `\`number\``]],
examples: ["odd( 5 ) = true", "odd( 2 ) = false"],
},
{
label: "overlaps after(range1, range2)",
insertText: "overlaps after($1, $2)",
- description: "Returns true when `range1` overlaps after `range2`",
+ description: i18n.functionDescription.overlapsAfter("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -1135,7 +1139,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "overlaps before(range1, range2)",
insertText: "overlaps before($1, $2)",
- description: "Returns true when `range1` overlaps before `range2`",
+ description: i18n.functionDescription.overlapsBefore("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -1155,7 +1159,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "overlaps(range1, range2)",
insertText: "overlaps($1, $2)",
- description: "Returns true when `range1` overlaps `range2`",
+ description: i18n.functionDescription.overlaps("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -1180,14 +1184,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "product(list)",
insertText: "product($1)",
- description: "Returns the product of the numbers in the `list`",
+ description: i18n.functionDescription.product("list"),
parameters: [["list", `\`list\` of \`number\` elements`]],
examples: ["product( [2, 3, 4] ) = 24", "product( [] ) = null",
"product( 2, 3, 4 ) = 24"],
},
{
label: "range(from)",
insertText: "range($1)",
- description: "Convert from a range `string` to a `range`.",
+ description: i18n.functionDescription.rangeFrom("string", "from"),
parameters: [["from", `range \`string\``]],
examples: [
'range( "[18..21)" ) is [18..21)',
@@ -1200,7 +1204,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "remove(list, position)",
insertText: "remove($1, $2)",
- description: "Creates a list with the removed element excluded from
the specified `position`.",
+ description: i18n.functionDescription.remove("list", "position"),
parameters: [
["list", `\`list\``],
["position", `\`number\``],
@@ -1210,7 +1214,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "replace(input, pattern, replacement)",
insertText: "replace($1, $2, $3)",
- description: "Calculates the regular expression replacement",
+ description: i18n.functionDescription.replace,
parameters: [
["input", `\`string\``],
["pattern", `\`string\``],
@@ -1224,7 +1228,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "replace(input, pattern, replacement, flags)",
insertText: "replace($1, $2, $3, $4)",
- description: "Calculates the regular expression replacement",
+ description: i18n.functionDescription.replace,
parameters: [
["input", `\`string\``],
["pattern", `\`string\``],
@@ -1239,15 +1243,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "reverse(list)",
insertText: "reverse($1)",
- description: "Returns a reversed `list`",
+ description: i18n.functionDescription.reverse("list"),
parameters: [["list", `\`list\``]],
examples: ["reverse( [1,2,3] ) = [3,2,1]"],
},
{
label: "round down(n, scale)",
insertText: "round down($1, $2)",
- description:
- "Returns `n` with given `scale` and rounding mode round down. If at
least one of `n` or `scale` is null, the result is null. The `scale` must be in
the range [−6111..6176].",
+ description: i18n.functionDescription.roundDown("n", "scale", "null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -1262,15 +1265,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "round down(n)",
insertText: "round down($1)",
- description: "Returns `n` with rounding mode round down. If `n` is
null, the result is null.",
+ description: i18n.functionDescription.roundDownN("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["round down( 5.5) = 5", "round down( -5.5) = -5"],
},
{
label: "round half down(n, scale)",
insertText: "round half down($1, $2)",
- description:
- "Returns `n` with given `scale` and rounding mode round half down.
If at least one of `n` or `scale` is null, the result is null. The `scale` must
be in the range [−6111..6176].",
+ description: i18n.functionDescription.roundHalfDown("n", "scale",
"null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -1285,15 +1287,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "round half down(n)",
insertText: "round half down($1)",
- description: "Returns `n` with rounding mode round half down. If `n`
is null, the result is null.",
+ description: i18n.functionDescription.roundHalfDownN("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["round half down( 5.5) = 5", "round half down( -5.5) = -5"],
},
{
label: "round half up(n, scale)",
insertText: "round half up($1, $2)",
- description:
- "Returns `n` with given `scale` and rounding mode round half up. If
at least one of `n` or `scale` is null, the result is null. The `scale` must be
in the range [−6111..6176].",
+ description: i18n.functionDescription.roundHalfUp("n", "scale",
"null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -1308,15 +1309,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "round half up(n)",
insertText: "round half up($1)",
- description: "Returns `n` with rounding mode round half up. If `n` is
null, the result is null.",
+ description: i18n.functionDescription.roundHalfUpN("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["round half up(5.5) = 6 ", "round half up( -5.5) = -6"],
},
{
label: "round up(n, scale)",
insertText: "round up($1, $2)",
- description:
- "Returns `n` with given `scale` and rounding mode round up. If at
least one of `n` or `scale` is null, the result is null. The `scale` must be in
the range [−6111..6176].",
+ description: i18n.functionDescription.roundUp("n", "scale", "null"),
parameters: [
["n", `\`number\``],
["scale", `\`number\``],
@@ -1331,22 +1331,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "round up(n)",
insertText: "round up($1)",
- description: "Returns `n` with rounding mode round up. If `n` is null,
the result is null.",
+ description: i18n.functionDescription.roundUpN("n", "null"),
parameters: [["n", `\`number\``]],
examples: ["round up(5.5) = 6", "round up(-5.5) = -6 "],
},
{
label: "sort(list)",
insertText: "sort($1)",
- description:
- "Returns a list of the same elements but ordered according a default
sorting, if the elements are comparable (eg. `number` or `string`)",
+ description: i18n.functionDescription.sort("list", "number", "string"),
parameters: [["list", `\`list\``]],
examples: ["sort( [3,1,4,5,2] ) = [1,2,3,4,5]"],
},
{
label: "sort(list, precedes)",
insertText: "sort($1, $2)",
- description: "Returns a list of the same elements but ordered
according to the sorting function",
+ description: i18n.functionDescription.sortPrecedes("list"),
parameters: [
["list", `\`list\``],
["precedes", `\`function\``],
@@ -1356,8 +1355,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "split(string, delimiter)",
insertText: "split($1, $2)",
- description:
- "Returns a list of the original `string` and splits it at the
`delimiter` regular expression pattern",
+ description: i18n.functionDescription.split("list", "string",
"delimiter"),
parameters: [
["string", `\`string\``],
["delimiter", `\`string\` for a regular expression pattern`],
@@ -1367,14 +1365,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "sqrt(number)",
insertText: "sqrt($1)",
- description: "Returns the square root of the specified `number`.",
+ description: i18n.functionDescription.sqrt("number"),
parameters: [["number", `\`number\``]],
examples: ["sqrt( 16 ) = 4"],
},
{
label: "started by(range, point)",
insertText: "started by($1, $2)",
- description: "Returns true when a `range` is started by a `point`",
+ description: i18n.functionDescription.startedBy("true", "range",
"point"),
parameters: [
["range", `\`range\` (\`interval\`)`],
["point", `\`number\``],
@@ -1387,8 +1385,8 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
},
{
label: "started by(range1, range2)",
- insertText: "started by($1, $2)",
- description: "Returns true when `range1` is started by `range2`",
+ insertText: i18n.functionDescription.startedByRange("true", "range1",
"range2"),
+ description: "",
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -1406,7 +1404,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "starts with(string, match)",
insertText: "starts with($1, $2)",
- description: "Does the `string` start with the `match`?",
+ description: i18n.functionDescription.startsWith("true", "string",
"match"),
parameters: [
["string", `string`],
["match", `string`],
@@ -1416,7 +1414,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "starts(point, range)",
insertText: "starts($1, $2)",
- description: "Returns true when `point` starts a `range`",
+ description: i18n.functionDescription.starts("true", "point", "range"),
parameters: [
["point", `\`number\``],
["range", `\`range\` (\`interval\`)`],
@@ -1426,7 +1424,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "starts(range1, range2)",
insertText: "starts($1, $2)",
- description: "Returns true when a `range1` starts a `range2`",
+ description: i18n.functionDescription.startsRange("true", "range1",
"range2"),
parameters: [
["range1", `\`range\` (\`interval\`)`],
["range2", `\`range\` (\`interval\`)`],
@@ -1444,7 +1442,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "stddev(list)",
insertText: "stddev($1)",
- description: "Returns the standard deviation of the numbers in the
`list`",
+ description: i18n.functionDescription.stddev("list"),
parameters: [["list", `\`list\``]],
examples: [
"stddev( 2, 4, 7, 5 ) = 2.081665999466132735282297706979931",
@@ -1456,22 +1454,21 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "string length(string)",
insertText: "string length($1)",
- description: "Calculates the length of the specified `string`.",
+ description: i18n.functionDescription.stringLength("string"),
parameters: [["string", `\`string\``]],
examples: ['string length( "tes" ) = 3', 'string length( "U01F40Eab" )
= 3'],
},
{
label: "string(from)",
insertText: "string($1)",
- description: "Provides a string representation of the specified
parameter",
+ description: i18n.functionDescription.stringFrom,
parameters: [["from", `Not null value`]],
examples: ['string( 1.1 ) = "1.1"', "string( null ) = null"],
},
{
label: "string join(list)",
insertText: "string join($1)",
- description:
- "Returns a string which is composed by joining all the string
elements from the `list` parameter. Null elements in the `list` parameter are
ignored. If `list` is empty, the result is the empty string.",
+ description: i18n.functionDescription.stringJoin("list"),
parameters: [["list", `\`list\` of \`string\``]],
examples: [
'string join( ["a","b","c"] ) = "abc"',
@@ -1482,8 +1479,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "string join(list, delimiter)",
insertText: "string join($1, $2)",
- description:
- "Returns a string which is composed by joining all the string
elements from the `list` parameter, separated by the `delimiter`. The
`delimiter` can be an empty string. Null elements in the `list` parameter are
ignored. If `list` is empty, the result is the empty string. If `delimiter` is
null, the string elements are joined without a separator.",
+ description: i18n.functionDescription.stringJoinDelimiter("list",
"delimiter", "null"),
parameters: [
["list", `\`list\` of \`string\``],
["delimiter", `\`string\``],
@@ -1500,7 +1496,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "sublist(list, start position)",
insertText: "sublist($1, $2)",
- description: "Returns the sublist from the `start position`",
+ description: i18n.functionDescription.sublist("start position"),
parameters: [
["list", `\`list\``],
["start position", `\`number\``],
@@ -1510,7 +1506,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "sublist(list, start position, length)",
insertText: "substring($1, $2, $3)",
- description: "Returns the sublist from the `start position for the
specified `length`",
+ description: i18n.functionDescription.sublistLength("start position",
"length"),
parameters: [
["list", `\`list\``],
["start position", `\`number\``],
@@ -1521,7 +1517,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "substring after(string, match)",
insertText: "substring after($1, $2)",
- description: "Calculates the substring after the `match`",
+ description: i18n.functionDescription.substringAfter("match"),
parameters: [
["string", `string`],
["match", `string`],
@@ -1531,7 +1527,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "substring before(string, match)",
insertText: "substring before($1, $2)",
- description: "Calculates the substring before the `match`",
+ description: i18n.functionDescription.substringBefore("match"),
parameters: [
["string", `string`],
["match", `string`],
@@ -1541,7 +1537,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "substring(string, start position)",
insertText: "substring($1, $2)",
- description: "Returns the substring from the `start position`. The
first character is at position value 1",
+ description: i18n.functionDescription.substringStartPosition("start
position"),
parameters: [
["string", `\`string\``],
["start position", `\`number\``],
@@ -1551,8 +1547,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "substring(string, start position, length)",
insertText: "substring($1, $2, $3)",
- description:
- "Returns the substring from the `start position` for the specified
`length`. The first character is at position value 1",
+ description: i18n.functionDescription.substringLength("start
position", "length"),
parameters: [
["string", `\`string\``],
["start position", `\`number\``],
@@ -1563,14 +1558,14 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "sum(list)",
insertText: "sum($1)",
- description: "Returns the sum of the numbers in the `list`",
+ description: i18n.functionDescription.sum("list"),
parameters: [["list", `\`list\``]],
examples: ["sum( [1,2,3] ) = 6", "sum( 1,2,3 ) = 6", "sum( 1 ) = 1",
"sum( [] ) = null"],
},
{
label: "time(from)",
insertText: "time($1)",
- description: "Produces a time from the specified parameter",
+ description: i18n.functionDescription.time,
parameters: [["from", `\`string\` or \`date and time\``]],
examples: [
'time( "23:59:00z" ) + duration( "PT2M" ) = time( "00:01:00@Etc/UTC"
)',
@@ -1580,7 +1575,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "time(hour, minute, second)",
insertText: "date and time($1, $2, $3)",
- description: "Creates a time from the given `hour`, `minute`, and
`second`.",
+ description: i18n.functionDescription.timeHour("hour", "minute",
"second"),
parameters: [
["hour", `\`number\``],
["minute", `\`number\``],
@@ -1591,7 +1586,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "time(hour, minute, second, offset)",
insertText: "time($1, $2, $3)",
- description: "Creates a time from the given `hour`, `minute`, `second`
and `offset`",
+ description: i18n.functionDescription.timeOffset("hour", "minute",
"second", "offset"),
parameters: [
["hour", `\`number\``],
["minute", `\`number\``],
@@ -1603,28 +1598,28 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "today()",
insertText: "today()",
- description: "Returns the current date",
+ description: i18n.functionDescription.today,
parameters: [],
examples: ["today()"],
},
{
label: "union(list)",
insertText: "union($1)",
- description: "Returns a list of all the elements from multiple lists
and excludes duplicates",
+ description: i18n.functionDescription.union("list"),
parameters: [["list", `\`list\``]],
examples: ["union( [1,2],[2,3] ) = [1,2,3]"],
},
{
label: "upper case(string)",
insertText: "string($1)",
- description: "Produces an uppercase version of the specified
`string`.",
+ description: i18n.functionDescription.upperCase("string"),
parameters: [["string", `\`string\``]],
examples: ['upper case( "aBc4" ) = "ABC4"'],
},
{
label: "week of year(date)",
insertText: "week of year($1)",
- description: "Returns the Gregorian week of the year as defined by ISO
8601",
+ description: i18n.functionDescription.weekOfYear,
parameters: [["date", `\`date\` or \`date and time\``]],
examples: [
"week of year( date(2019, 9, 17) ) = 38",
@@ -1638,7 +1633,7 @@ export const feelDefaultSuggestions = ():
Monaco.languages.CompletionItem[] => {
{
label: "years and months duration(from, to)",
insertText: "years and months duration($1, $2)",
- description: "Calculates the years and months duration between the two
specified parameters.",
+ description: i18n.functionDescription.yearsAndMonthsDuration,
parameters: [
["from", `\`date\` or \`date and time\``],
["to", `\`date\` or \`date and time\``],
diff --git a/packages/feel-input-component/src/FeelInput.tsx
b/packages/feel-input-component/src/FeelInput.tsx
index ce37e5e2a3a..10ca344a039 100644
--- a/packages/feel-input-component/src/FeelInput.tsx
+++ b/packages/feel-input-component/src/FeelInput.tsx
@@ -51,6 +51,7 @@ export interface FeelInputProps {
options?: Monaco.editor.IStandaloneEditorConstructionOptions;
feelIdentifiers?: FeelIdentifiers;
expressionId?: string;
+ locale: string;
}
export interface FeelInputRef {
@@ -89,6 +90,7 @@ export const FeelInput = React.forwardRef<FeelInputRef,
FeelInputProps>(
options,
feelIdentifiers,
expressionId,
+ locale,
},
forwardRef
) => {
@@ -147,9 +149,9 @@ export const FeelInput = React.forwardRef<FeelInputRef,
FeelInputProps>(
return items;
}
}
- return feelDefaultSuggestions();
+ return feelDefaultSuggestions(locale);
},
- []
+ [locale]
);
useEffect(() => {
diff --git a/packages/feel-input-component/src/i18n/FeelInputComponentI18n.ts
b/packages/feel-input-component/src/i18n/FeelInputComponentI18n.ts
new file mode 100644
index 00000000000..b592ab1b5ef
--- /dev/null
+++ b/packages/feel-input-component/src/i18n/FeelInputComponentI18n.ts
@@ -0,0 +1,174 @@
+/*
+ * 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 FeelInputComponentDictionary extends ReferenceDictionary {
+ functionDescription: {
+ absDescription: (value: string) => string;
+ afterPoint: (result: string, point1: string, point2: string) => string;
+ afterPointRange: (result: string, point: string, range: string) => string;
+ afterRangePoint: (result: string, range: string, point: string) => string;
+ afterRange: (result: string, range1: string, range2: string) => string;
+ allTrue: (result: string, value: string) => string;
+ anyTrue: (result: string, value: string, falseResult: string, nullValue:
string) => string;
+ append: (list: string) => string;
+ beforePoint: (result: string, point1: string, point2: string) => string;
+ beforePointRange: (result: string, point: string, range: string) => string;
+ beforeRangePoint: (result: string, range: string, point: string) => string;
+ beforeRange: (result: string, range1: string, range2: string) => string;
+ ceiling: (value: string, nullValue: string) => string;
+ ceilingScale: (value: string, scale: string, nullValue: string) => string;
+ coincides: (result: string, point1: string, point2: string) => string;
+ coincidesRange: (result: string, range1: string, range2: string) => string;
+ concatenate: (list: string) => string;
+ contains: (value: string, match: string) => string;
+ contextKeyValue: (context: string, key: string, value: string, nullValue:
string) => string;
+ contextMerge: (context: string, contexts: string) => string;
+ context: (context: string) => string;
+ contextPut: (context: string, contextPut: string) => string;
+ count: (list: string) => string;
+ date: (from: string) => string;
+ dateyear: (year: string, month: string, day: string) => string;
+ dateTimeFrom: (from: string) => string;
+ dateTime: (date: string, time: string) => string;
+ datetimezone: (date: string, time: string) => string;
+ dateYearSecond: (year: string, month: string, day: string, hour: string,
minute: string, second: string) => string;
+ datetYearOffset: (
+ year: string,
+ month: string,
+ day: string,
+ hour: string,
+ minute: string,
+ second: string,
+ offset: string
+ ) => string;
+ datetTimeTimezone: (
+ year: string,
+ month: string,
+ day: string,
+ hour: string,
+ minute: string,
+ second: string,
+ timezone: string
+ ) => string;
+ dayOfWeek: (day: string) => string;
+ dateOfYear: (day: string) => string;
+ decimal: (n: string, scale: string) => string;
+ distinctValues: (list: string) => string;
+ duration: (from: string) => string;
+ during: (result: string, point: string, range: string) => string;
+ duringRange: (result: string, range1: string, range2: string) => string;
+ endsWith: (string: string, match: string) => string;
+ even: (result: string, number: string, falseResult: string) => string;
+ exp: (number: string) => string;
+ finishedBy: (result: string, range: string, point: string) => string;
+ finishedByRange: (result: string, range1: string, range2: string) =>
string;
+ finishes: (result: string, point: string, range: string) => string;
+ finishesRange: (result: string, range1: string, range2: string) => string;
+ flattenNestedLists: (list: string) => string;
+ floor: (n: string, nullValue: string) => string;
+ floorScale: (n: string, scale: string, nullValue: string) => string;
+ getEntries: (list: string, m: string) => string;
+ getValue: (m: string, key: string) => string;
+ includes: (result: string, range: string, point: string) => string;
+ includesRange: (result: string, range1: string, range2: string) => string;
+ indexOf: (list: string, match: string) => string;
+ insertBefore: (list: string, position: string, newItem: string) => string;
+ is: (result: string) => string;
+ listConstains: (list: string, element: string) => string;
+ listReplace: (list: string, newItem: string, position: string) => string;
+ listNewItem: (list: string, newItem: string, match: string, trueValue:
string) => string;
+ log: (number: string) => string;
+ lowerCase: (stringValue: string) => string;
+ matches: (input: string, pattern: string) => string;
+ max: (list: string, nullValue: string) => string;
+ mean: (list: string) => string;
+ median: (list: string, nullValue: string) => string;
+ meets: (result: string, range1: string, range2: string) => string;
+ metBy: (result: string, range1: string, range2: string) => string;
+ min: (list: string, nullValue: string) => string;
+ mode: (list: string) => string;
+ modulo: (dividend: string, divisor: string) => string;
+ monthOfYear: string;
+ nnAll: (result: string, list: string, nullValue: string) => string;
+ nnAny: (result: string, list: string, nullValue: string) => string;
+ nnCount: (list: string, nullValue: string) => string;
+ nnMax: (list: string, nullValue: string) => string;
+ nnMean: (nullValue: string) => string;
+ nnMedian: (list: string, nullValue: string) => string;
+ nnMin: (list: string, nullValue: string) => string;
+ nnMode: (list: string, nullValue: string) => string;
+ nnStddev: (list: string, nullValue: string) => string;
+ nnSum: (list: string, nullValue: string) => string;
+ not: (negand: string) => string;
+ now: (date: string, time: string) => string;
+ numbers: (from: string) => string;
+ numberFrom: (from: string) => string;
+ odd: (result: string, number: string) => string;
+ overlapsAfter: (result: string, range1: string, range2: string) => string;
+ overlapsBefore: (result: string, range1: string, range2: string) => string;
+ overlaps: (result: string, range1: string, range2: string) => string;
+ product: (list: string) => string;
+ rangeFrom: (stringValue: string, from: string) => string;
+ remove: (list: string, position: string) => string;
+ replace: string;
+ reverse: (list: string) => string;
+ roundDown: (n: string, scale: string, nullValue: string) => string;
+ roundDownN: (n: string, nullValue: string) => string;
+ roundHalfDown: (n: string, scale: string, nullValue: string) => string;
+ roundHalfDownN: (n: string, nullValue: string) => string;
+ roundHalfUp: (n: string, scale: string, nullValue: string) => string;
+ roundHalfUpN: (n: string, nullValue: string) => string;
+ roundUp: (n: string, scale: string, nullValue: string) => string;
+ roundUpN: (n: string, nullValue: string) => string;
+ sort: (list: string, numberValue: string, stringValue: string) => string;
+ sortPrecedes: (list: string) => string;
+ split: (list: string, stringValue: string, delimiter: string) => string;
+ sqrt: (numberValue: string) => string;
+ startedBy: (result: string, range: string, point: string) => string;
+ startedByRange: (result: string, range1: string, range2: string) => string;
+ startsWith: (result: string, stringValue: string, match: string) => string;
+ starts: (result: string, point: string, range: string) => string;
+ startsRange: (result: string, range1: string, range2: string) => string;
+ stddev: (list: string) => string;
+ stringLength: (stringValue: string) => string;
+ stringFrom: string;
+ stringJoin: (list: string) => string;
+ stringJoinDelimiter: (list: string, delimiter: string, nullValue: string)
=> string;
+ sublist: (startPosition: string) => string;
+ sublistLength: (startPosition: string, length: string) => string;
+ substringAfter: (match: string) => string;
+ substringBefore: (match: string) => string;
+ substringStartPosition: (startPosition: string) => string;
+ substringLength: (startPosition: string, length: string) => string;
+ sum: (list: string) => string;
+ time: string;
+ timeHour: (hour: string, minute: string, second: string) => string;
+ timeOffset: (hour: string, minute: string, second: string, offset: string)
=> string;
+ today: string;
+ union: (list: string) => string;
+ upperCase: (stringValue: string) => string;
+ weekOfYear: string;
+ yearsAndMonthsDuration: string;
+ };
+}
+
+export interface FeelInputComponentI18n extends FeelInputComponentDictionary,
CommonI18n {}
diff --git a/packages/feel-input-component/src/i18n/index.ts
b/packages/feel-input-component/src/i18n/index.ts
new file mode 100644
index 00000000000..39cb038aba6
--- /dev/null
+++ b/packages/feel-input-component/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 "./FeelInputComponentI18n";
+export * from "./setup";
diff --git a/packages/feel-input-component/src/i18n/locales/en.ts
b/packages/feel-input-component/src/i18n/locales/en.ts
new file mode 100644
index 00000000000..69c50f4a1d3
--- /dev/null
+++ b/packages/feel-input-component/src/i18n/locales/en.ts
@@ -0,0 +1,254 @@
+/*
+ * 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 { FeelInputComponentI18n } from "../FeelInputComponentI18n";
+
+export const en: FeelInputComponentI18n = {
+ ...en_common,
+ functionDescription: {
+ absDescription: (value: string): string => `Returns the absolute value of
\`${value}\``,
+ afterPoint: (result: string, point1: string, point2: string): string =>
+ `Returns ${result} when \`${point1}\` is after \`${point2}\``,
+ afterPointRange: (result: string, point: string, range: string): string =>
+ `Returns ${result} when \`${point}\` is after \`${range}\``,
+ afterRangePoint: (result: string, range: string, point: string): string =>
+ `Returns ${result} when \`${range}\` is after \`${point}\``,
+ afterRange: (result: string, range1: string, range2: string): string =>
+ `Returns ${result} when \`${range1}\` is after \`${range2}\``,
+ allTrue: (result: string, list: string): string =>
+ `Returns ${result} if all elements in the \`${list}\` are ${result}.`,
+ anyTrue: (result: string, list: string, falseResult: string, nullValue:
string): string =>
+ `Returns ${result} if any \`${list}\` item is ${result}, else
${falseResult} if empty or all \`${list}\` items are ${falseResult}, else
${nullValue}`,
+ append: (list: string) => `Returns new ${list} with items appended`,
+ beforePoint: (result: string, point1: string, point2: string): string =>
+ `Returns ${result} when \`${point1}\` is before \`${point2}\``,
+ beforePointRange: (result: string, point: string, range: string): string =>
+ `Returns ${result} when \`${point}\` is before \`${range}\``,
+ beforeRangePoint: (result: string, range: string, point: string): string =>
+ `Returns ${result} when a \`${range}\` is before \`${point}\``,
+ beforeRange: (result: string, range1: string, range2: string): string =>
+ `Returns ${result} when \`${range1} is before \`${range2}\``,
+ ceiling: (value: string, nullValue: string): string =>
+ `Returns \`${value} with rounding mode ceiling. If \`${value}\` is
${nullValue} the result is ${nullValue}.`,
+ ceilingScale: (value: string, scale: string, nullValue: string): string =>
+ `Returns \`${value} with given scale and rounding mode ceiling. If at
least one of \`${value}\` or \`${scale}\` is ${nullValue}, the result is
${nullValue}. The \`${scale}\` must be in the range [−6111..6176].`,
+ coincides: (result: string, point1: string, point2: string): string =>
+ `Returns ${result} when \`${point1}\` coincides with \`${point2}\``,
+ coincidesRange: (result: string, range1: string, range2: string): string =>
+ `Returns ${result} when \`${range1}\` coincides with \`${range2}\``,
+ concatenate: (list: string) => `Returns a new ${list} that is a
concatenation of the arguments`,
+ contains: (value: string, match: string): string => `Does the \`${value}
contain the \`${match}\`?`,
+ contextKeyValue: (context: string, key: string, value: string, nullValue:
string): string =>
+ `Returns a new \`${context}\` that includes all specified entries. If a
\`${context}\` item contains additional entries beyond the required \`${key}\`
and \`${value}\` entries, the additional entries are ignored. If a
\`${context}\` item is missing the required \`${key}\` and \`${value}\`
entries, the final result is ${nullValue}.`,
+ contextMerge: (context: string, contexts: string): string =>
+ `Returns a new \`${context}\` that includes all entries from the given
\`${contexts}\`; if some of the keys are equal, the entries are overridden. The
entries are overridden in the same order as specified by the supplied
parameter, with new entries added as the last entry in the new context.`,
+ context: (context: string): string =>
+ `Returns a new \`${context}\` that includes the new entry, or overrides
the existing value if an entry for the same key already exists in the supplied
\`${context}\` parameter. A new entry is added as the last entry of the new
context. If overriding an existing entry, the order of the keys maintains the
same order as in the original context.`,
+ contextPut: (context: string, contextPut: string): string =>
+ `Returns the composite of nested invocations to \`${contextPut}\` for
each item in keys hierarchy in \`${context}\`.`,
+ count: (list: string): string => `Returns size of \`${list}\`, or zero if
\`${list}\` is empty`,
+ date: (from: string): string => `convert \`${from}\` to a date`,
+ dateyear: (year: string, month: string, day: string) =>
+ `Creates a date from \`${year}\`, \`${month}\`, \`${day}\` component
values`,
+ dateTimeFrom: (from: string) => `convert \`${from}\` to a date and time`,
+ dateTime: (date: string, time: string) =>
+ `Creates a date time from the given \`${date}\` (ignoring any time
component) and the given \`${time}\``,
+ datetimezone: (date: string, time: string) =>
+ `Creates a date time from the given \`${date}\`, \`${time}\` and
timezone`,
+ dateYearSecond: (year: string, month: string, day: string, hour: string,
minute: string, second: string) =>
+ `Creates a date time from the given \`${year}\`, \`${month}\`,
\`${day}\`, \`${hour}\`, \`${minute}\`, and \`${second}\`.`,
+ datetYearOffset: (
+ year: string,
+ month: string,
+ day: string,
+ hour: string,
+ minute: string,
+ second: string,
+ offset: string
+ ): string =>
+ `Creates a date time from the given \`${year}\`, \`${month}\`,
\`${day}\`, \`${hour}\`, \`${minute}\`, \`${second}\` and \`${offset}\``,
+ datetTimeTimezone: (
+ year: string,
+ month: string,
+ day: string,
+ hour: string,
+ minute: string,
+ second: string,
+ timezone: string
+ ) =>
+ `Creates a date time from the given \`${year}\`, \`${month}\`,
\`${day}\`, \`${hour}\`, \`${minute}\`, \`${second}\` and \`${timezone}\``,
+ dayOfWeek: (day: string) =>
+ `Returns the ${day} of the week according to the Gregorian calendar
enumeration: “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”,
“Saturday”, “Sunday”`,
+ dateOfYear: (day: string) => `Returns the Gregorian number of the ${day}
within the year`,
+ decimal: (n: string, scale: string) =>
+ `Returns \`${n}\` with given \`${scale}\`. The \`${scale}\` must be in
the range [−6111..6176].`,
+ distinctValues: (list: string) => `Returns \`${list}\` without duplicates`,
+ duration: (from: string) => `Converts \`${from}\` to a days and time or
years and months duration`,
+ during: (result: string, point: string, range: string) =>
+ `Returns ${result} when \`${point}\` is during \`${range}\``,
+ duringRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when a \`${range1}\` is during \`${range2}\``,
+ endsWith: (string: string, match: string) => `Does the \`${string}\` end
with the \`${match}\`?`,
+ even: (result: string, number: string, falseResult: string) =>
+ `Returns ${result} if \`${number}\` is even, ${falseResult} if it is
odd`,
+ exp: (number: string) => `Returns the Euler’s number e raised to the power
of \`${number}\`.`,
+ finishedBy: (result: string, range: string, point: string) =>
+ `Returns ${result} when \`${range}\` is finished by \`${point}\``,
+ finishedByRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` is finished by \`${range2}\``,
+ finishes: (result: string, point: string, range: string) =>
+ `Returns ${result} when \`${point}\` finishes \`${range}\``,
+ finishesRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` finishes \`${range2}\``,
+ flattenNestedLists: (list: string) => `Flatten nested ${list}`,
+ floor: (n: string, nullValue: string) =>
+ `Returns \`${n}\` with rounding mode flooring. If \`${n}\` is
${nullValue} the result is ${nullValue}.`,
+ floorScale: (n: string, scale: string, nullValue: string) =>
+ `Returns \`${n}\` with given scale and rounding mode flooring. If at
least one of \`${n}\` or scale is ${nullValue}, the result is ${nullValue}. The
\`${scale}\` must be in the range [−6111..6176].`,
+ getEntries: (list: string, m: string) => `Produces a ${list} of key,value
pairs from a context \`${m}\``,
+ getValue: (m: string, key: string) => `Select the value of the entry named
\`${key}\` from context \`${m}\``,
+ includes: (result: string, range: string, point: string) =>
+ `Returns ${result} when \`${range}\` includes \`${point}\``,
+ includesRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` includes \`${range2}\``,
+ indexOf: (list: string, match: string) => `Returns ascending list of
\`${list}\` positions containing \`${match}\``,
+ insertBefore: (list: string, position: string, newItem: string) =>
+ `Return new ${list} with \`${newItem}\` inserted at \`${position}\``,
+ is: (result: string) => `Returns ${result} if both values are the same
element in the FEEL semantic domain`,
+ listConstains: (list: string, element: string) => `Does the \`${list}\`
contain the \`${element}\`?`,
+ listReplace: (list: string, newItem: string, position: string) =>
+ `Returns new ${list} with \`${newItem}\` replaced at \`${position}\`.`,
+ listNewItem: (list: string, newItem: string, match: string, trueValue:
string) =>
+ `Returns new ${list} with \`${newItem}\` replaced at all positions where
the \`${match}\` function returned \`${trueValue}\``,
+ log: (number: string) => `Returns the natural logarithm (base e) of the
\`${number}\` parameter`,
+ lowerCase: (stringValue: string) => `Returns lowercased
\`${stringValue}\``,
+ matches: (input: string, pattern: string) => `Does the \`${input}\` match
the regexp \`${pattern}\`?`,
+ max: (list: string, nullValue: string) => `Returns maximum item, or
${nullValue} if \`${list}\` is empty`,
+ mean: (list: string) => `Returns arithmetic mean (average) of \`${list}\`
of numbers`,
+ median: (list: string, nullValue: string) =>
+ `Returns the median element of the \`${list}\` of numbers. I.e., after
sorting the \`${list}\`, if the \`${list}\` has an odd number of elements, it
returns the middle element. If the \`${list}\` has an even number of elements,
returns the average of the two middle elements. If the \`${list}\` is empty,
returns ${nullValue}`,
+ meets: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` meets \`${range2}\``,
+ metBy: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` is met \`${range2}\``,
+ min: (list: string, nullValue: string) => `Returns minimum item, or
${nullValue} if \`${list}\` is empty`,
+ mode: (list: string) =>
+ `Returns the mode of the numbers in the \`${list}\`. If multiple
elements are returned, the numbers are sorted in ascending order.`,
+ modulo: (dividend: string, divisor: string) =>
+ `Returns the remainder of the division of \`${dividend}\` by
\`${divisor}\``,
+ monthOfYear: "Returns the month of the year",
+ nnAll: (result: string, list: string, nullValue: string) =>
+ `Returns ${result} if all elements in the \`${list}\` are ${result}.
${nullValue} values are ignored`,
+ nnAny: (result: string, list: string, nullValue: string) =>
+ `Returns ${result} if any element in the \`${list}\` is ${result}.
${nullValue} values are ignored`,
+ nnCount: (list: string, nullValue: string) =>
+ `Returns size of \`${list}\`, or zero if \`${list}\` is empty.
${nullValue} values are not counted`,
+ nnMax: (list: string, nullValue: string) =>
+ `Returns maximum item, or ${nullValue} if \`${list}\` is empty.
${nullValue} values are ignored`,
+ nnMean: (nullValue: string) => `Returns arithmetic mean (average) of
numbers. ${nullValue} values are ignored`,
+ nnMedian: (list: string, nullValue: string) =>
+ `Returns the median element of the \`${list}\` of numbers. ${nullValue}
values are ignored. I.e., after sorting the \`${list}\`, if the \`${list}\` has
an odd number of elements, it returns the middle element. If the \`${list}\`
has an even number of elements, returns the average of the two middle elements.
If the \`${list}\` is empty, returns ${nullValue}`,
+ nnMin: (list: string, nullValue: string) =>
+ `Returns minimum item, or ${nullValue} if \`${list}\` is empty.
${nullValue} values are ignored`,
+ nnMode: (list: string, nullValue: string) =>
+ `Returns the mode of the numbers in the \`${list}\`. ${nullValue} values
are ignored. If multiple elements are returned, the numbers are sorted in
ascending order`,
+ nnStddev: (list: string, nullValue: string) =>
+ `Returns the standard deviation of the numbers in the \`${list}\`.
${nullValue} values are ignored.`,
+ nnSum: (list: string, nullValue: string) =>
+ `Returns the sum of the numbers in the \`${list}\`. ${nullValue} values
are ignored.`,
+ not: (negand: string) => `Performs the logical negation of the
\`${negand}\` operand`,
+ now: (date: string, time: string) => `Returns the current ${date} and
${time}.`,
+ numbers: (from: string) => `Converts \`${from}\` to a number.`,
+ numberFrom: (from: string) => `Converts \`${from}\` to a number using the
specified separators.`,
+ odd: (result: string, number: string) => `Returns ${result} if the
specified \`${number}\` is odd.`,
+ overlapsAfter: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` overlaps after \`${range2}\``,
+ overlapsBefore: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` overlaps before \`${range2}\``,
+ overlaps: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` overlaps \`${range2}\``,
+ product: (list: string) => `Returns the product of the numbers in the
\`${list}\``,
+ rangeFrom: (stringValue: string, from: string) => `Convert from a range
\`${stringValue}\` to a \`${from}\`.`,
+ remove: (list: string, position: string) =>
+ `Creates a ${list} with the removed element excluded from the specified
\`${position}\`.`,
+ replace: "Calculates the regular expression replacement",
+ reverse: (list: string) => `Returns a reversed \`${list}\``,
+ roundDown: (n: string, scale: string, nullValue: string) =>
+ `Returns \`${n}\` with given \`${scale}\` and rounding mode round down.
If at least one of \`${n}\` or \`${scale}\` is ${nullValue}, the result is
${nullValue}. The \`${scale}\` must be in the range [−6111..6176].`,
+ roundDownN: (n: string, nullValue: string) =>
+ `Returns \`${n}\` with rounding mode round down. If \`${n}\` is
${nullValue}, the result is ${nullValue}.`,
+ roundHalfDown: (n: string, scale: string, nullValue: string) =>
+ `Returns \`${n}\` with given \`${scale}\` and rounding mode round half
down. If at least one of \`${n}\` or \`${scale}\` is ${nullValue}, the result
is ${nullValue}. The \`${scale}\` must be in the range [−6111..6176].`,
+ roundHalfDownN: (n: string, nullValue: string) =>
+ `Returns \`${n}\` with rounding mode round half down. If \`${n}\` is
${nullValue}, the result is ${nullValue}.`,
+ roundHalfUp: (n: string, scale: string, nullValue: string) =>
+ `Returns \`${n}\` with given \`${scale}\` and rounding mode round half
up. If at least one of \`${n}\` or \`${scale}\` is ${nullValue}, the result is
${nullValue}. The \`${scale}\` must be in the range [−6111..6176].`,
+ roundHalfUpN: (n: string, nullValue: string) =>
+ `Returns \`${n}\` with rounding mode round half up. If \`${n}\` is
${nullValue}, the result is ${nullValue}.`,
+ roundUp: (n: string, scale: string, nullValue: string) =>
+ `Returns \`${n}\` with given \`${scale}\` and rounding mode round up. If
at least one of \`${n}\` or \`${scale}\` is ${nullValue}, the result is
${nullValue}. The \`${scale}\` must be in the range [−6111..6176].`,
+ roundUpN: (n: string, nullValue: string) =>
+ `Returns \`${n}\` with rounding mode round up. If \`${n}\` is
${nullValue}, the result is ${nullValue}.`,
+ sort: (list: string, numberValue: string, stringValue: string) =>
+ `Returns a ${list} of the same elements but ordered according a default
sorting, if the elements are comparable (eg. \`${numberValue}\` or
\`${stringValue}\`)`,
+ sortPrecedes: (list: string) =>
+ `Returns a ${list} of the same elements but ordered according to the
sorting function`,
+ split: (list: string, stringValue: string, delimiter: string) =>
+ `Returns a ${list} of the original \`${stringValue}\` and splits it at
the \`${delimiter}\` regular expression pattern`,
+ sqrt: (numberValue: string) => `Returns the square root of the specified
\`${numberValue}\`.`,
+ startedBy: (result: string, range: string, point: string) =>
+ `Returns ${result} when a \`${range}\` is started by a \`${point}\``,
+ startedByRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when \`${range1}\` is started by \`${range2}\``,
+ startsWith: (result: string, stringValue: string, match: string) =>
+ `Does the \`${stringValue}\` start with the \`${match}\`?`,
+ starts: (result: string, point: string, range: string) =>
+ `Returns ${result} when \`${point}\` starts a \`${range}\``,
+ startsRange: (result: string, range1: string, range2: string) =>
+ `Returns ${result} when a \`${range1}\` starts a \`${range2}\``,
+ stddev: (list: string) => `Returns the standard deviation of the numbers
in the \`${list}\``,
+ stringLength: (stringValue: string) => `Calculates the length of the
specified \`${stringValue}\`.`,
+ stringFrom: "Provides a string representation of the specified parameter",
+ stringJoin: (list: string) =>
+ `Returns a string which is composed by joining all the string elements
from the \`${list}\` parameter. Null elements in the \`${list}\` parameter are
ignored. If \`${list}\` is empty, the result is the empty string.`,
+ stringJoinDelimiter: (list: string, delimiter: string, nullValue: string)
=>
+ `Returns a string which is composed by joining all the string elements
from the \`${list}\` parameter, separated by the \`${delimiter}\`. The
\`${delimiter}\` can be an empty string. Null elements in the \`${list}\`
parameter are ignored. If \`${list}\` is empty, the result is the empty string.
If \`${delimiter}\` is ${nullValue}, the string elements are joined without a
separator.`,
+ sublist: (startPosition: string) => `Returns the sublist from the
\`${startPosition}\``,
+ sublistLength: (startPosition: string, length: string) =>
+ `Returns the sublist from the \`${startPosition}\` for the specified
\`${length}\``,
+ substringAfter: (match: string) => `Calculates the substring after the
\`${match}\``,
+ substringBefore: (match: string) => `Calculates the substring before the
\`${match}\``,
+ substringStartPosition: (startPosition: string) =>
+ `Returns the substring from the \`${startPosition}\`. The first
character is at position value 1`,
+ substringLength: (startPosition: string, length: string) =>
+ `Returns the substring from the \`${startPosition}\` for the specified
\`${length}\`. The first character is at position value 1`,
+ sum: (list: string) => `Returns the sum of the numbers in the \`${list}\``,
+ time: "Produces a time from the specified parameter",
+ timeHour: (hour: string, minute: string, second: string) =>
+ `Creates a time from the given \`${hour}\`, \`${minute}\`, and
\`${second}\`.`,
+ timeOffset: (hour: string, minute: string, second: string, offset: string)
=>
+ `Creates a time from the given \`${hour}\`, \`${minute}\`, \`${second}\`
and \`${offset}\``,
+ today: "Returns the current date",
+ union: (list: string) => `Returns a ${list} of all the elements from
multiple lists and excludes duplicates`,
+ upperCase: (stringValue: string) => `Produces an uppercase version of the
specified \`${stringValue}\`.`,
+ weekOfYear: "Returns the Gregorian week of the year as defined by ISO
8601",
+ yearsAndMonthsDuration: "Calculates the years and months duration between
the two specified parameters.",
+ },
+};
diff --git a/packages/feel-input-component/src/i18n/locales/index.ts
b/packages/feel-input-component/src/i18n/locales/index.ts
new file mode 100644
index 00000000000..8bf599d3803
--- /dev/null
+++ b/packages/feel-input-component/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/feel-input-component/src/i18n/setup.ts
b/packages/feel-input-component/src/i18n/setup.ts
new file mode 100644
index 00000000000..52079499172
--- /dev/null
+++ b/packages/feel-input-component/src/i18n/setup.ts
@@ -0,0 +1,36 @@
+/*
+ * 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 { useContext } from "react";
+import { en } from "./locales";
+import { I18nContextType } from "@kie-tools-core/i18n/dist/react-components";
+import { FeelInputComponentI18n } from "./FeelInputComponentI18n";
+import { I18nDefaults, I18nDictionaries } from
"@kie-tools-core/i18n/dist/core";
+
+export const feelInputComponentI18nDefaults:
I18nDefaults<FeelInputComponentI18n> = {
+ locale: "en",
+ dictionary: en,
+};
+export const feelInputComponentDictionaries:
I18nDictionaries<FeelInputComponentI18n> = new Map([["en", en]]);
+export const FeelInputComponentI18nContext =
React.createContext<I18nContextType<FeelInputComponentI18n>>({} as never);
+
+export function useBoxedExpressionEditorI18n():
I18nContextType<FeelInputComponentI18n> {
+ return useContext(FeelInputComponentI18nContext);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]