Skip to content

Commit

Permalink
Fixing issue with generating language file if custom ID is given
Browse files Browse the repository at this point in the history
  • Loading branch information
skymen committed Jan 17, 2025
1 parent f2b0125 commit bc4766b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions build/generateLangJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,24 @@ function langFromConfig() {
root.actions = {};
Object.keys(actionConfig.config).forEach((key) => {
const action = actionConfig.config[key];
root.actions[key] = {
const id = action.id ? action.id : key;
root.actions[id] = {
"list-name": action.listName,
"display-text": action.displayText,
description: action.description,
params: {},
};
action.params = action.params || [];
action.params.forEach((param) => {
root.actions[key].params[param.id] = {
root.actions[id].params[param.id] = {
name: param.name,
desc: param.desc,
};
if (param.type === "combo") {
root.actions[key].params[param.id].items = {};
root.actions[id].params[param.id].items = {};
param.items.forEach((item) => {
const itemkey = Object.keys(item)[0];
root.actions[key].params[param.id].items[itemkey] = item[itemkey];
root.actions[id].params[param.id].items[itemkey] = item[itemkey];
});
}
});
Expand All @@ -98,23 +99,24 @@ function langFromConfig() {
root.conditions = {};
Object.keys(conditionConfig.config).forEach((key) => {
const condition = conditionConfig.config[key];
root.conditions[key] = {
const id = condition.id ? condition.id : key;
root.conditions[id] = {
"list-name": condition.listName,
"display-text": condition.displayText,
description: condition.description,
params: {},
};
condition.params = condition.params || [];
condition.params.forEach((param) => {
root.conditions[key].params[param.id] = {
root.conditions[id].params[param.id] = {
name: param.name,
desc: param.desc,
};
if (param.type === "combo") {
root.conditions[key].params[param.id].items = {};
root.conditions[id].params[param.id].items = {};
param.items.forEach((item) => {
const itemkey = Object.keys(item)[0];
root.conditions[key].params[param.id].items[itemkey] = item[itemkey];
root.conditions[id].params[param.id].items[itemkey] = item[itemkey];
});
}
});
Expand All @@ -123,19 +125,20 @@ function langFromConfig() {
root.expressions = {};
Object.keys(expressionConfig.config).forEach((key) => {
const expression = expressionConfig.config[key];
root.expressions[key] = {
const id = expression.id ? expression.id : key;
root.expressions[id] = {
"translated-name": key,
description: expression.description,
params: {},
};
expression.params = expression.params || [];
expression.params.forEach((param) => {
root.expressions[key].params[param.id] = {
root.expressions[id].params[param.id] = {
name: param.name,
desc: param.desc,
};
if (param.type === "combo") {
root.expressions[key].params[param.id].items = {};
root.expressions[id].params[param.id].items = {};
param.items.forEach((item) => {
const itemkey = Object.keys(item)[0];
root.expressions[key].params[param.id].items[itemkey] = item[itemkey];
Expand Down

0 comments on commit bc4766b

Please sign in to comment.