Skip to content

Commit 1b93531

Browse files
committed
Additional functions for use in scripts
1 parent 0b2004f commit 1b93531

34 files changed

Lines changed: 1096 additions & 390 deletions

forms/formconfig.pas

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ TformConfigTrayslate = class(TForm)
216216
rvaluetype4 = 'Currency Fiat Only';
217217
rvaluetype5 = 'Currency Crypto Only';
218218
rvaluetype6 = 'Measurement Units';
219+
219220
rscripthint =
220221
'The script is a standard Pascal program: optional var section, then a main begin ... end. block.' +
221222
sLineBreak + sLineBreak + 'Example:' + sLineBreak + ' var s: string;' + sLineBreak + ' begin' +
@@ -229,18 +230,29 @@ TformConfigTrayslate = class(TForm)
229230
sLineBreak + ' Random integer with exactly Length decimal digits.' + sLineBreak + ' Random : Extended' +
230231
sLineBreak + ' Random float in the range [0, 1).' + sLineBreak + ' IntToHex(Value, Digits) : string' +
231232
sLineBreak + ' Convert integer to hexadecimal string with at least Digits characters.' + sLineBreak +
232-
' ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string' + sLineBreak +
233+
' StrToInt(S) : Integer' + sLineBreak + ' Convert a string to an integer. Raises an exception on invalid input.' +
234+
sLineBreak + ' IntToStr(Value) : string' + sLineBreak + ' Convert an integer to its string representation.' +
235+
sLineBreak + ' Trim(S) : string' + sLineBreak + ' Remove leading and trailing whitespace from S.' +
236+
sLineBreak + ' TrimLeft(S) : string' + sLineBreak + ' Remove leading whitespace from S.' + sLineBreak +
237+
' TrimRight(S) : string' + sLineBreak + ' Remove trailing whitespace from S.' + sLineBreak +
238+
' HtmlEncode(S) : string' + sLineBreak + ' Encode special HTML characters in S into entities.' +
239+
sLineBreak + ' HtmlDecode(S) : string' + sLineBreak + ' Decode HTML entities in S back to characters.' +
240+
sLineBreak + ' UrlEncode(S) : string' + sLineBreak + ' Percent-encode S for safe URL inclusion.' +
241+
sLineBreak + ' UrlDecode(S) : string' + sLineBreak + ' Decode a percent-encoded string S.' +
242+
sLineBreak + ' ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string' + sLineBreak +
233243
' Replace all occurrences of OldPattern with NewPattern in S.' + sLineBreak +
234244
' RegexReplace(Input, Pattern, Replacement) : string' + sLineBreak +
235-
' Replace all matches of the regular expression Pattern in Input with Replacement.' + sLineBreak +
236-
' The search is case-insensitive by default. Use standard regex syntax.' + sLineBreak + sLineBreak +
245+
' Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.' + sLineBreak +
246+
' RegexMatch(Input, Pattern) : Boolean' + sLineBreak + ' Check if Input matches the regex Pattern. Case-insensitive.' +
247+
sLineBreak + ' ExtractBetween(S, StartMarker, EndMarker) : string' + sLineBreak +
248+
' Extract the substring of S between StartMarker and EndMarker.' + sLineBreak + sLineBreak +
237249
'Available parameters (retrieved with GetParam):' + sLineBreak +
238-
' text - the input text to process (possibly truncated to MaxLength)' + sLineBreak +
239-
' source - source language code (may be empty)' + sLineBreak + ' target - target language code' +
240-
sLineBreak + ' timestamp - current Unix timestamp in milliseconds (string)' + sLineBreak +
241-
' random - 9-digit random number (string)' + sLineBreak + ' rand - same as random' +
242-
sLineBreak + ' rand1..rand9 - first 1..9 digits of the random number' + sLineBreak +
243-
'Additional user-defined and custom parameters are also available.';
250+
' text - the input text to process (possibly truncated to MaxLength)' + sLineBreak +
251+
' source - source language code (may be empty)' + sLineBreak + ' target - target language code' +
252+
sLineBreak + ' timestamp - current Unix timestamp in milliseconds (string)' + sLineBreak +
253+
' random - 9-digit random number (string)' + sLineBreak + ' rand - same as random' + sLineBreak +
254+
' rand1..rand9 - first 1..9 digits of the random number' + sLineBreak + sLineBreak +
255+
'Additional initial and custom parameters are also available.';
244256

245257
rscriptresponsehint =
246258
'This script processes the response data. All functions and parameters described in the script hint are available here as well.' +

libs/helpers

locale/trayslate.ar.po

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,43 @@ msgid ""
150150
" Random float in the range [0, 1).\n"
151151
" IntToHex(Value, Digits) : string\n"
152152
" Convert integer to hexadecimal string with at least Digits characters.\n"
153+
" StrToInt(S) : Integer\n"
154+
" Convert a string to an integer. Raises an exception on invalid input.\n"
155+
" IntToStr(Value) : string\n"
156+
" Convert an integer to its string representation.\n"
157+
" Trim(S) : string\n"
158+
" Remove leading and trailing whitespace from S.\n"
159+
" TrimLeft(S) : string\n"
160+
" Remove leading whitespace from S.\n"
161+
" TrimRight(S) : string\n"
162+
" Remove trailing whitespace from S.\n"
163+
" HtmlEncode(S) : string\n"
164+
" Encode special HTML characters in S into entities.\n"
165+
" HtmlDecode(S) : string\n"
166+
" Decode HTML entities in S back to characters.\n"
167+
" UrlEncode(S) : string\n"
168+
" Percent-encode S for safe URL inclusion.\n"
169+
" UrlDecode(S) : string\n"
170+
" Decode a percent-encoded string S.\n"
153171
" ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string\n"
154172
" Replace all occurrences of OldPattern with NewPattern in S.\n"
155173
" RegexReplace(Input, Pattern, Replacement) : string\n"
156-
" Replace all matches of the regular expression Pattern in Input with Replacement.\n"
157-
" The search is case-insensitive by default. Use standard regex syntax.\n"
174+
" Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.\n"
175+
" RegexMatch(Input, Pattern) : Boolean\n"
176+
" Check if Input matches the regex Pattern. Case-insensitive.\n"
177+
" ExtractBetween(S, StartMarker, EndMarker) : string\n"
178+
" Extract the substring of S between StartMarker and EndMarker.\n"
158179
"\n"
159180
"Available parameters (retrieved with GetParam):\n"
160-
" text - the input text to process (possibly truncated to MaxLength)\n"
161-
" source - source language code (may be empty)\n"
162-
" target - target language code\n"
163-
" timestamp - current Unix timestamp in milliseconds (string)\n"
164-
" random - 9-digit random number (string)\n"
165-
" rand - same as random\n"
166-
" rand1..rand9 - first 1..9 digits of the random number\n"
167-
"Additional user-defined and custom parameters are also available."
181+
" text - the input text to process (possibly truncated to MaxLength)\n"
182+
" source - source language code (may be empty)\n"
183+
" target - target language code\n"
184+
" timestamp - current Unix timestamp in milliseconds (string)\n"
185+
" random - 9-digit random number (string)\n"
186+
" rand - same as random\n"
187+
" rand1..rand9 - first 1..9 digits of the random number\n"
188+
"\n"
189+
"Additional initial and custom parameters are also available."
168190
msgstr "يمكن للبرنامج النصي الوصول إلى أي معلمات معرّفة أعلاه باستخدام ‎GetParam('name')‎ وإرجاع القيم باستخدام ‎SetOutput('name', 'value')‎. كما تتوفر الدوال المساعدة التالية: ‎GetTimestamp()‎ و‎GetRandom(Length)‎."
169191

170192
#: formconfig.rscriptresponsehint

locale/trayslate.be.po

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,43 @@ msgid ""
150150
" Random float in the range [0, 1).\n"
151151
" IntToHex(Value, Digits) : string\n"
152152
" Convert integer to hexadecimal string with at least Digits characters.\n"
153+
" StrToInt(S) : Integer\n"
154+
" Convert a string to an integer. Raises an exception on invalid input.\n"
155+
" IntToStr(Value) : string\n"
156+
" Convert an integer to its string representation.\n"
157+
" Trim(S) : string\n"
158+
" Remove leading and trailing whitespace from S.\n"
159+
" TrimLeft(S) : string\n"
160+
" Remove leading whitespace from S.\n"
161+
" TrimRight(S) : string\n"
162+
" Remove trailing whitespace from S.\n"
163+
" HtmlEncode(S) : string\n"
164+
" Encode special HTML characters in S into entities.\n"
165+
" HtmlDecode(S) : string\n"
166+
" Decode HTML entities in S back to characters.\n"
167+
" UrlEncode(S) : string\n"
168+
" Percent-encode S for safe URL inclusion.\n"
169+
" UrlDecode(S) : string\n"
170+
" Decode a percent-encoded string S.\n"
153171
" ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string\n"
154172
" Replace all occurrences of OldPattern with NewPattern in S.\n"
155173
" RegexReplace(Input, Pattern, Replacement) : string\n"
156-
" Replace all matches of the regular expression Pattern in Input with Replacement.\n"
157-
" The search is case-insensitive by default. Use standard regex syntax.\n"
174+
" Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.\n"
175+
" RegexMatch(Input, Pattern) : Boolean\n"
176+
" Check if Input matches the regex Pattern. Case-insensitive.\n"
177+
" ExtractBetween(S, StartMarker, EndMarker) : string\n"
178+
" Extract the substring of S between StartMarker and EndMarker.\n"
158179
"\n"
159180
"Available parameters (retrieved with GetParam):\n"
160-
" text - the input text to process (possibly truncated to MaxLength)\n"
161-
" source - source language code (may be empty)\n"
162-
" target - target language code\n"
163-
" timestamp - current Unix timestamp in milliseconds (string)\n"
164-
" random - 9-digit random number (string)\n"
165-
" rand - same as random\n"
166-
" rand1..rand9 - first 1..9 digits of the random number\n"
167-
"Additional user-defined and custom parameters are also available."
181+
" text - the input text to process (possibly truncated to MaxLength)\n"
182+
" source - source language code (may be empty)\n"
183+
" target - target language code\n"
184+
" timestamp - current Unix timestamp in milliseconds (string)\n"
185+
" random - 9-digit random number (string)\n"
186+
" rand - same as random\n"
187+
" rand1..rand9 - first 1..9 digits of the random number\n"
188+
"\n"
189+
"Additional initial and custom parameters are also available."
168190
msgstr "Сцэнар можа атрымаць доступ да любых параметраў, вызначаных вышэй, з дапамогай GetParam('name') і вярнуць значэнні праз SetOutput('name', 'value'). Таксама даступныя дапаможныя функцыі: GetTimestamp() і GetRandom(Length)."
169191

170192
#: formconfig.rscriptresponsehint

locale/trayslate.bg.po

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,43 @@ msgid ""
150150
" Random float in the range [0, 1).\n"
151151
" IntToHex(Value, Digits) : string\n"
152152
" Convert integer to hexadecimal string with at least Digits characters.\n"
153+
" StrToInt(S) : Integer\n"
154+
" Convert a string to an integer. Raises an exception on invalid input.\n"
155+
" IntToStr(Value) : string\n"
156+
" Convert an integer to its string representation.\n"
157+
" Trim(S) : string\n"
158+
" Remove leading and trailing whitespace from S.\n"
159+
" TrimLeft(S) : string\n"
160+
" Remove leading whitespace from S.\n"
161+
" TrimRight(S) : string\n"
162+
" Remove trailing whitespace from S.\n"
163+
" HtmlEncode(S) : string\n"
164+
" Encode special HTML characters in S into entities.\n"
165+
" HtmlDecode(S) : string\n"
166+
" Decode HTML entities in S back to characters.\n"
167+
" UrlEncode(S) : string\n"
168+
" Percent-encode S for safe URL inclusion.\n"
169+
" UrlDecode(S) : string\n"
170+
" Decode a percent-encoded string S.\n"
153171
" ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string\n"
154172
" Replace all occurrences of OldPattern with NewPattern in S.\n"
155173
" RegexReplace(Input, Pattern, Replacement) : string\n"
156-
" Replace all matches of the regular expression Pattern in Input with Replacement.\n"
157-
" The search is case-insensitive by default. Use standard regex syntax.\n"
174+
" Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.\n"
175+
" RegexMatch(Input, Pattern) : Boolean\n"
176+
" Check if Input matches the regex Pattern. Case-insensitive.\n"
177+
" ExtractBetween(S, StartMarker, EndMarker) : string\n"
178+
" Extract the substring of S between StartMarker and EndMarker.\n"
158179
"\n"
159180
"Available parameters (retrieved with GetParam):\n"
160-
" text - the input text to process (possibly truncated to MaxLength)\n"
161-
" source - source language code (may be empty)\n"
162-
" target - target language code\n"
163-
" timestamp - current Unix timestamp in milliseconds (string)\n"
164-
" random - 9-digit random number (string)\n"
165-
" rand - same as random\n"
166-
" rand1..rand9 - first 1..9 digits of the random number\n"
167-
"Additional user-defined and custom parameters are also available."
181+
" text - the input text to process (possibly truncated to MaxLength)\n"
182+
" source - source language code (may be empty)\n"
183+
" target - target language code\n"
184+
" timestamp - current Unix timestamp in milliseconds (string)\n"
185+
" random - 9-digit random number (string)\n"
186+
" rand - same as random\n"
187+
" rand1..rand9 - first 1..9 digits of the random number\n"
188+
"\n"
189+
"Additional initial and custom parameters are also available."
168190
msgstr "Скриптът може да достъпва всички параметри, дефинирани по-горе, използвайки GetParam('name') и да връща стойности със SetOutput('name', 'value'). Налични са и допълнителни помощни функции: GetTimestamp() и GetRandom(Length)."
169191

170192
#: formconfig.rscriptresponsehint

locale/trayslate.cs.po

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,43 @@ msgid ""
150150
" Random float in the range [0, 1).\n"
151151
" IntToHex(Value, Digits) : string\n"
152152
" Convert integer to hexadecimal string with at least Digits characters.\n"
153+
" StrToInt(S) : Integer\n"
154+
" Convert a string to an integer. Raises an exception on invalid input.\n"
155+
" IntToStr(Value) : string\n"
156+
" Convert an integer to its string representation.\n"
157+
" Trim(S) : string\n"
158+
" Remove leading and trailing whitespace from S.\n"
159+
" TrimLeft(S) : string\n"
160+
" Remove leading whitespace from S.\n"
161+
" TrimRight(S) : string\n"
162+
" Remove trailing whitespace from S.\n"
163+
" HtmlEncode(S) : string\n"
164+
" Encode special HTML characters in S into entities.\n"
165+
" HtmlDecode(S) : string\n"
166+
" Decode HTML entities in S back to characters.\n"
167+
" UrlEncode(S) : string\n"
168+
" Percent-encode S for safe URL inclusion.\n"
169+
" UrlDecode(S) : string\n"
170+
" Decode a percent-encoded string S.\n"
153171
" ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string\n"
154172
" Replace all occurrences of OldPattern with NewPattern in S.\n"
155173
" RegexReplace(Input, Pattern, Replacement) : string\n"
156-
" Replace all matches of the regular expression Pattern in Input with Replacement.\n"
157-
" The search is case-insensitive by default. Use standard regex syntax.\n"
174+
" Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.\n"
175+
" RegexMatch(Input, Pattern) : Boolean\n"
176+
" Check if Input matches the regex Pattern. Case-insensitive.\n"
177+
" ExtractBetween(S, StartMarker, EndMarker) : string\n"
178+
" Extract the substring of S between StartMarker and EndMarker.\n"
158179
"\n"
159180
"Available parameters (retrieved with GetParam):\n"
160-
" text - the input text to process (possibly truncated to MaxLength)\n"
161-
" source - source language code (may be empty)\n"
162-
" target - target language code\n"
163-
" timestamp - current Unix timestamp in milliseconds (string)\n"
164-
" random - 9-digit random number (string)\n"
165-
" rand - same as random\n"
166-
" rand1..rand9 - first 1..9 digits of the random number\n"
167-
"Additional user-defined and custom parameters are also available."
181+
" text - the input text to process (possibly truncated to MaxLength)\n"
182+
" source - source language code (may be empty)\n"
183+
" target - target language code\n"
184+
" timestamp - current Unix timestamp in milliseconds (string)\n"
185+
" random - 9-digit random number (string)\n"
186+
" rand - same as random\n"
187+
" rand1..rand9 - first 1..9 digits of the random number\n"
188+
"\n"
189+
"Additional initial and custom parameters are also available."
168190
msgstr "Skript může přistupovat ke všem výše definovaným parametrům pomocí GetParam('name') a vracet hodnoty pomocí SetOutput('name', 'value'). K dispozici jsou také pomocné funkce: GetTimestamp() a GetRandom(Length)."
169191

170192
#: formconfig.rscriptresponsehint

locale/trayslate.da.po

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,43 @@ msgid ""
150150
" Random float in the range [0, 1).\n"
151151
" IntToHex(Value, Digits) : string\n"
152152
" Convert integer to hexadecimal string with at least Digits characters.\n"
153+
" StrToInt(S) : Integer\n"
154+
" Convert a string to an integer. Raises an exception on invalid input.\n"
155+
" IntToStr(Value) : string\n"
156+
" Convert an integer to its string representation.\n"
157+
" Trim(S) : string\n"
158+
" Remove leading and trailing whitespace from S.\n"
159+
" TrimLeft(S) : string\n"
160+
" Remove leading whitespace from S.\n"
161+
" TrimRight(S) : string\n"
162+
" Remove trailing whitespace from S.\n"
163+
" HtmlEncode(S) : string\n"
164+
" Encode special HTML characters in S into entities.\n"
165+
" HtmlDecode(S) : string\n"
166+
" Decode HTML entities in S back to characters.\n"
167+
" UrlEncode(S) : string\n"
168+
" Percent-encode S for safe URL inclusion.\n"
169+
" UrlDecode(S) : string\n"
170+
" Decode a percent-encoded string S.\n"
153171
" ReplaceAll(S, OldPattern, NewPattern, IgnoreCase=False) : string\n"
154172
" Replace all occurrences of OldPattern with NewPattern in S.\n"
155173
" RegexReplace(Input, Pattern, Replacement) : string\n"
156-
" Replace all matches of the regular expression Pattern in Input with Replacement.\n"
157-
" The search is case-insensitive by default. Use standard regex syntax.\n"
174+
" Replace all regex matches of Pattern with Replacement in Input. Case-insensitive.\n"
175+
" RegexMatch(Input, Pattern) : Boolean\n"
176+
" Check if Input matches the regex Pattern. Case-insensitive.\n"
177+
" ExtractBetween(S, StartMarker, EndMarker) : string\n"
178+
" Extract the substring of S between StartMarker and EndMarker.\n"
158179
"\n"
159180
"Available parameters (retrieved with GetParam):\n"
160-
" text - the input text to process (possibly truncated to MaxLength)\n"
161-
" source - source language code (may be empty)\n"
162-
" target - target language code\n"
163-
" timestamp - current Unix timestamp in milliseconds (string)\n"
164-
" random - 9-digit random number (string)\n"
165-
" rand - same as random\n"
166-
" rand1..rand9 - first 1..9 digits of the random number\n"
167-
"Additional user-defined and custom parameters are also available."
181+
" text - the input text to process (possibly truncated to MaxLength)\n"
182+
" source - source language code (may be empty)\n"
183+
" target - target language code\n"
184+
" timestamp - current Unix timestamp in milliseconds (string)\n"
185+
" random - 9-digit random number (string)\n"
186+
" rand - same as random\n"
187+
" rand1..rand9 - first 1..9 digits of the random number\n"
188+
"\n"
189+
"Additional initial and custom parameters are also available."
168190
msgstr "Scriptet kan få adgang til alle parametre, der er defineret ovenfor, ved hjælp af GetParam('name') og returnere værdier med SetOutput('name', 'value'). Følgende hjælpefunktioner er også tilgængelige: GetTimestamp() og GetRandom(Length)."
169191

170192
#: formconfig.rscriptresponsehint

0 commit comments

Comments
 (0)