Skip to content

Commit 95289d4

Browse files
authored
Merge pull request #69 from regulaforensics/feature/fe-765
FE-765 - add methods
2 parents c6d85d4 + 435844b commit 95289d4

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

src/ext/process-response.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
Status,
1313
StatusResult,
1414
TextResult,
15+
ChosenDocumentTypeResult,
16+
DocBarCodeInfo,
1517
TransactionInfo
1618
} from "../models/index.js";
1719
import {Text} from "./text.js";
@@ -138,6 +140,14 @@ export class LowLvlResponse implements ProcessResponse {
138140
return <ImagesResult>this.resultByType(Result.IMAGES)
139141
}
140142

143+
public barcodeResult(): DocBarCodeInfo | undefined {
144+
return <DocBarCodeInfo>this.resultByType(Result.BARCODES)
145+
}
146+
147+
public documentTypeResults(): Array<ChosenDocumentTypeResult> | undefined {
148+
return <Array<ChosenDocumentTypeResult>>this.resultsByType(Result.DOCUMENT_TYPE)
149+
}
150+
141151
public resultByType(type: Result): ResultItem | undefined {
142152
for (const container of this.ContainerList.List) {
143153
if (container.result_type === type) {

src/ext/text-field.ts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,150 @@ import {
88
TextFieldValue
99
} from "../models/index.js";
1010

11+
const LCID_MAP: Record<number, string> = {
12+
0: 'Latin',
13+
1078: 'Afrikaans',
14+
1052: 'Albanian',
15+
5121: 'Arabic (Algeria)',
16+
15361: 'Arabic (Bahrain)',
17+
3073: 'Arabic (Egypt)',
18+
2049: 'Arabic (Iraq)',
19+
11265: 'Arabic (Jordan)',
20+
13313: 'Arabic (Kuwait)',
21+
12289: 'Arabic (Lebanon)',
22+
4097: 'Arabic (Libya)',
23+
6145: 'Arabic (Morocco)',
24+
8193: 'Arabic (Oman)',
25+
16385: 'Arabic (Qatar)',
26+
1025: 'Arabic (Saudi Arabia)',
27+
10241: 'Arabic (Syria)',
28+
7169: 'Arabic (Tunisia)',
29+
14337: 'Arabic (U.A.E.)',
30+
9217: 'Arabic (Yemen)',
31+
1067: 'Arabic Armenian',
32+
2092: 'Azeri (Cyrillic)',
33+
1068: 'Azeri (Latin)',
34+
1069: 'Basque',
35+
1059: 'Belarusian',
36+
1026: 'Bulgarian',
37+
1027: 'Catalan',
38+
3076: 'Chinese (HongKong S.A.R.)',
39+
5124: 'Chinese (Macao S.A.R.)',
40+
2052: 'Chinese',
41+
4100: 'Chinese (Singapore)',
42+
1028: 'Chinese (Taiwan)',
43+
1050: 'Croatian',
44+
1029: 'Czech',
45+
1030: 'Danish',
46+
1125: 'Divehi',
47+
2067: 'Dutch (Belgium)',
48+
1043: 'Dutch (Netherlands)',
49+
3081: 'English (Australia)',
50+
10249: 'English (Belize)',
51+
4105: 'English (Canada)',
52+
9225: 'English (Caribbean)',
53+
6153: 'English (Ireland)',
54+
8201: 'English (Jamaica)',
55+
5129: 'English (New Zealand)',
56+
13321: 'English (Philippines)',
57+
7177: 'English (South Africa)',
58+
11273: 'English (Trinidad)',
59+
2057: 'English (United Kingdom)',
60+
1033: 'English (United States)',
61+
12297: 'English (Zimbabwe)',
62+
1061: 'Estonian',
63+
1080: 'Faroese',
64+
1065: 'Farsi',
65+
1035: 'Finnish',
66+
2060: 'French (Belgium)',
67+
3084: 'French (Canada)',
68+
1036: 'French (France)',
69+
5132: 'French (Luxembourg)',
70+
6156: 'French (Monaco)',
71+
4108: 'French (Switzerland)',
72+
1071: 'FYRO Macedonian',
73+
1110: 'Galician',
74+
1079: 'Georgian',
75+
3079: 'German (Austria)',
76+
1031: 'German (Germany)',
77+
5127: 'German (Liechtenstein)',
78+
4103: 'German (Luxembourg)',
79+
2055: 'German (Switzerland)',
80+
1032: 'Greek',
81+
1095: 'Gujarati',
82+
1037: 'Hebrew',
83+
1081: 'Hindi (India)',
84+
1038: 'Hungarian',
85+
1039: 'Icelandic',
86+
1057: 'Indonesian',
87+
1040: 'Italian (Italy)',
88+
2064: 'Italian (Switzerland)',
89+
1041: 'Japanese',
90+
1099: 'Kannada',
91+
1087: 'Kazakh',
92+
1111: 'Konkani',
93+
1042: 'Korean',
94+
1088: 'Kyrgyz (Cyrillic)',
95+
1062: 'Latvian',
96+
1063: 'Lithuanian',
97+
2110: 'Malay (Brunei Darussalam)',
98+
1102: 'Marathi',
99+
1086: 'Malay (Malaysia)',
100+
1104: 'Mongolian (Cyrillic)',
101+
1044: 'Norwegian (Bokmal)',
102+
2068: 'Norwegian (Nynorsk)',
103+
1045: 'Polish',
104+
1046: 'Portuguese (Brazil)',
105+
2070: 'Portuguese (Portugal)',
106+
1094: 'Punjabi',
107+
1047: 'Rhaeto-Romanic',
108+
1048: 'Romanian',
109+
1049: 'Russian',
110+
1103: 'Sanskrit',
111+
3098: 'Serbian (Cyrillic)',
112+
2074: 'Serbian (Latin)',
113+
1051: 'Slovak',
114+
1060: 'Slovenian',
115+
11274: 'Spanish (Argentina)',
116+
16394: 'Spanish (Bolivia)',
117+
13322: 'Spanish (Chile)',
118+
9226: 'Spanish (Colombia)',
119+
5130: 'Spanish (Costa Rica)',
120+
7178: 'Spanish (Dominican Republic)',
121+
12298: 'Spanish (Ecuador)',
122+
17418: 'Spanish (El Salvador)',
123+
4106: 'Spanish (Guatemala)',
124+
18442: 'Spanish (Honduras)',
125+
3082: 'Spanish (International Sort)',
126+
2058: 'Spanish (Mexico)',
127+
19466: 'Spanish (Nicaragua)',
128+
6154: 'Spanish (Panama)',
129+
15370: 'Spanish (Paraguay)',
130+
10250: 'Spanish (Peru)',
131+
20490: 'Spanish (Puerto Rico)',
132+
1034: 'Spanish (Traditional Sort)',
133+
14346: 'Spanish (Uruguay)',
134+
8202: 'Spanish (Venezuela)',
135+
1089: 'Swahili',
136+
1053: 'Swedish',
137+
2077: 'Swedish (Finland)',
138+
1114: 'Syriac',
139+
1097: 'Tamil',
140+
1092: 'Tatar',
141+
1098: 'Telugu',
142+
1054: 'Thai (Thailand)',
143+
1055: 'Turkish',
144+
1058: 'Ukrainian',
145+
1056: 'Urdu',
146+
2115: 'Uzbek (Cyrillic)',
147+
1091: 'Uzbek (Latin)',
148+
1066: 'Vietnamese',
149+
1064: 'Tajik (Cyrillic)',
150+
1090: 'Turkmen',
151+
50001: 'CTC Simplified',
152+
50002: 'CTC Traditional',
153+
9999: 'Custom',
154+
}
11155
export class TextField implements BaseTextField {
12156

13157
// see BaseTextField for docs
@@ -89,6 +233,10 @@ export class TextField implements BaseTextField {
89233
return CheckResult.WAS_NOT_DONE
90234
}
91235

236+
public getLCIDName(): string | undefined {
237+
return LCID_MAP[this.lcid] || String(this.lcid);
238+
}
239+
92240
private getValueBySource(source: Source): TextFieldValue | undefined {
93241
for (const value of this.valueList) {
94242
if (value.source == source) {

0 commit comments

Comments
 (0)