Skip to content

Commit 1515077

Browse files
committedFeb 19, 2022
Added human-readable strings for HoloJS generator
1 parent ea328de commit 1515077

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
 

‎generator/holo.js

+42
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,47 @@ const apModule02 = require("./AlgopropCompiler02")
44
const commonModule = require("./common_1_0")
55
const smModule = require("./sm_1_0")
66

7+
8+
const strings = {
9+
"ERR_ALGOPROP_CANNOT_BE_ARGUMENT": "HL1000: Cannot use the name of an algoprop as a function argument or exception handler argument",
10+
"ERR_ALGOPROP_CANNOT_BE_IN_CLASS": "HL1001: Algoprops are not allowed as class members",
11+
"ERR_ARGUMENTS_NOT_ALLOWED_IN_ALGOPROPS": "HL1002: Function arguments are not allowed in algoprops",
12+
"ERR_AWAIT_REQUIRES_ASYNC_FUNCTION": "HL1003: await expressions are only allowed in async functions",
13+
"ERR_BAD_FOREACH": "HL1004: Bad format inside the FOREACH icon",
14+
"ERR_BAD_HANDLER_FORMAT": "HL1005: Bad handler format",
15+
"ERR_BAD_VARIABLE_NAME": "HL1006: Forbidden variable name",
16+
"ERR_BRANCH_NOT_FOUND": "HL1007: Branch not found",
17+
"ERR_BRANCH_NOT_REFERENCED": "HL1008: Branch not referenced",
18+
"ERR_CALL_EXPRESSION_EXPECTED": "HL1009: Call expression expected",
19+
"ERR_CANNOT_ASSIGN_TO_ALGOPROP": "HL1010: Cannot assign to an algoprop",
20+
"ERR_CANNOT_USE_GETHANDLER_OUTSIDE_HANDLER": "HL1011: Cannot use getHandlerData() outside of a handler",
21+
"ERR_CLASS_NAME_NOT_UNIQUE": "HL1012: Class name is not unique",
22+
"ERR_DUPLICATE_DIAGRAM_NAME": "HL1013: Diagram name is not unique",
23+
"ERR_EXPRESSION_EXPECTED": "HL1014: Expression expected",
24+
"ERR_FUNCTION_NAME_AND_ARGUMENTS_EXPECTED": "HL1015: Function name and arguments expected",
25+
"ERR_INCONSISTENT_EVENT_SIGNATURE": "HL1016: Inconsistent event signature",
26+
"ERR_INPUT_IS_NOT_ALLOWED_IN_NORMAL_FUNCTIONS": "HL1017: Input icons are only allowed in async functions",
27+
"ERR_NO_EXIT": "HL1018: The diagram has no end",
28+
"ERR_NO_TEXT_IN_FOREACH": "HL1019: A FOREACH icon cannot be empty",
29+
"ERR_NOT_ALL_PATHS_RETURN_A_VALUE": "HL1020: Not all paths return a value",
30+
"ERR_ONE_FUNCTION_CALL_EXPECTED": "HL1021: One function call expected",
31+
"ERR_ONLY_ASYNC_FUNCTIONS_CAN_HAVE_ON_ERROR": "HL1022: Only async functions can have \"on error\" handler",
32+
"ERR_ONLY_LAST_CASE_CAN_BE_EMPTY": "HL1023: Only the last Case icon can be empty",
33+
"ERR_PAUSE_IS_NOT_ALLOWED_IN_NORMAL_FUNCTIONS": "HL1024: Pause icons are only allowed in async functions",
34+
"ERR_RECEIVE_IS_NOT_ALLOWED_IN_NORMAL_FUNCTIONS": "HL1025: receive construct is only allowed in async functions",
35+
"ERR_THIS_KEYWORD_IS_NOT_ALLOWED": "HL1026: This keyword is not allowed",
36+
"ERR_VALUE_EXPECTED": "HL1027: Value expected",
37+
"ERR_VARIABLE_DECLARATIONS_ARE_NOT_ALLOWED": "HL1028: Variable declarations are not allowed",
38+
}
39+
40+
function translate(text) {
41+
var translated = strings[text]
42+
if (translated) {
43+
return translated
44+
}
45+
return text
46+
}
47+
748
function buildHolo(record, getFromDt) {
849
return buildHoloCore(record, getFromDt, apModule)
950
}
@@ -15,6 +56,7 @@ function buildHolo02(record, getFromDt) {
1556
function buildHoloCore(record, getFromDt, apMod) {
1657
return new Promise(function (resolve) {
1758
var ap = apMod()
59+
ap.translate = translate
1860
var common = commonModule()
1961
var sm = smModule()
2062
var http = {

0 commit comments

Comments
 (0)
Please sign in to comment.