@openmrs/esm-form-entry-app 13.0.2-pre.12945 → 13.0.2-pre.12952
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/dist/1124.48eb5f49f1f2ba3d.js +1 -0
- package/dist/1124.48eb5f49f1f2ba3d.js.map +1 -0
- package/dist/{1465.0395b632fc25f1b9.js → 1465.cb49a4dcc430bbc7.js} +6 -6
- package/dist/{1465.0395b632fc25f1b9.js.map → 1465.cb49a4dcc430bbc7.js.map} +1 -1
- package/dist/4300.6c68ebcae4ae2eac.js +1 -0
- package/dist/4300.6c68ebcae4ae2eac.js.map +1 -0
- package/dist/{main.39cc36c3ec0bd3b7.js → main.a644845484131101.js} +1 -1
- package/dist/{main.39cc36c3ec0bd3b7.js.map → main.a644845484131101.js.map} +1 -1
- package/dist/openmrs-esm-form-entry-app.js +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -2
- package/tools/extract-translations.mjs +77 -0
- package/translations/en.json +18 -14
- package/turbo.json +10 -0
- package/dist/4300.ffbd6d6dac270973.js +0 -1
- package/dist/4300.ffbd6d6dac270973.js.map +0 -1
- package/dist/6731.e6f2403d60cd4f43.js +0 -1
- package/dist/6731.e6f2403d60cd4f43.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Rebuilds translations/en.json from two sources:
|
|
2
|
+
// - the English strings @openmrs/ngx-formentry ships for the keys the form engine uses
|
|
3
|
+
// - the literal keys this app passes to the `translate` pipe or `TranslateService.instant` in src/app
|
|
4
|
+
// Engine keys take the engine's string. App keys keep the string already in en.json.
|
|
5
|
+
import { readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { dirname, join } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
12
|
+
const appDir = join(packageRoot, 'src', 'app');
|
|
13
|
+
const enPath = join(packageRoot, 'translations', 'en.json');
|
|
14
|
+
|
|
15
|
+
const keyPatterns = [/['"]([\w.]+)['"]\s*\|\s*translate\b/g, /\.instant\(\s*['"]([\w.]+)['"]/g];
|
|
16
|
+
|
|
17
|
+
function listSourceFiles(dir) {
|
|
18
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
19
|
+
const path = join(dir, entry.name);
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
return listSourceFiles(path);
|
|
22
|
+
}
|
|
23
|
+
return /(?<!\.spec)\.ts$|\.html$/.test(entry.name) ? [path] : [];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let engineStrings;
|
|
28
|
+
try {
|
|
29
|
+
engineStrings = require('@openmrs/ngx-formentry/translations/en.json');
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
|
|
32
|
+
console.warn(
|
|
33
|
+
'The installed @openmrs/ngx-formentry does not ship translations/en.json. Skipping, translations/en.json is unchanged.',
|
|
34
|
+
);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const appKeys = new Set(
|
|
41
|
+
listSourceFiles(appDir).flatMap((file) => {
|
|
42
|
+
const source = readFileSync(file, 'utf8');
|
|
43
|
+
return keyPatterns.flatMap((pattern) => [...source.matchAll(pattern)].map((match) => match[1]));
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const existingOutput = readFileSync(enPath, 'utf8');
|
|
48
|
+
const existingStrings = JSON.parse(existingOutput);
|
|
49
|
+
const strings = { ...engineStrings };
|
|
50
|
+
const missingKeys = [];
|
|
51
|
+
|
|
52
|
+
for (const key of appKeys) {
|
|
53
|
+
if (key in strings) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (key in existingStrings) {
|
|
57
|
+
strings[key] = existingStrings[key];
|
|
58
|
+
} else {
|
|
59
|
+
missingKeys.push(key);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (missingKeys.length) {
|
|
64
|
+
console.error(`Add English strings for these keys to translations/en.json: ${missingKeys.sort().join(', ')}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const sortedStrings = Object.fromEntries(
|
|
69
|
+
Object.keys(strings)
|
|
70
|
+
.sort()
|
|
71
|
+
.map((key) => [key, strings[key]]),
|
|
72
|
+
);
|
|
73
|
+
const output = JSON.stringify(sortedStrings, null, 2) + '\n';
|
|
74
|
+
|
|
75
|
+
if (output !== existingOutput) {
|
|
76
|
+
writeFileSync(enPath, output);
|
|
77
|
+
}
|
package/translations/en.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"aDayAgo": "a day ago",
|
|
3
|
-
"aFewSecondsAgo": "a few seconds ago",
|
|
4
3
|
"aMinuteAgo": "a minute ago",
|
|
5
4
|
"aMonthAgo": "a month ago",
|
|
6
5
|
"aYearAgo": "a year ago",
|
|
@@ -14,11 +13,11 @@
|
|
|
14
13
|
"chooseMonthAndYear": "Choose month and year",
|
|
15
14
|
"clearEntry": "Are you sure you want to clear this entry?",
|
|
16
15
|
"closeThisPanel": "Close this panel",
|
|
17
|
-
"componentLoadingFailed": "Component loading failed
|
|
16
|
+
"componentLoadingFailed": "Component loading failed...",
|
|
18
17
|
"daysAgo": " days ago",
|
|
19
18
|
"deleteEntry": "Are you sure you want to delete this item?",
|
|
19
|
+
"disallowDecimals": "Decimal values are not allowed",
|
|
20
20
|
"discardButton": "Discard",
|
|
21
|
-
"disallowDecimals": "Decimals are not allowed",
|
|
22
21
|
"enterMoreCharacters": "Please enter 2 or more characters",
|
|
23
22
|
"errorFetchingFormData": "There was an error fetching form data. Details: {detail}",
|
|
24
23
|
"errorLoadingForm": "Error loading form",
|
|
@@ -28,19 +27,19 @@
|
|
|
28
27
|
"formSubmissionFailed": "An error occurred while processing your form submission. Please notify the system administrator and reference the following error: {error}",
|
|
29
28
|
"formSubmittedSuccessfully": "The form has been submitted successfully.",
|
|
30
29
|
"from": "From",
|
|
31
|
-
"futureDateRestriction": "
|
|
30
|
+
"futureDateRestriction": "Dates in the future are not allowed",
|
|
32
31
|
"hoursAgo": " hours ago",
|
|
33
|
-
"invalidDate": "
|
|
32
|
+
"invalidDate": "Invalid date. Please select a valid date",
|
|
34
33
|
"loading": "Loading...",
|
|
35
34
|
"loadingComponent": "Loading component...",
|
|
36
35
|
"matchNotFound": "Match not found",
|
|
37
|
-
"max": "
|
|
38
|
-
"maxDate": "
|
|
36
|
+
"max": "Please enter a value less than or equal to {max}",
|
|
37
|
+
"maxDate": "Please select a date that is on or before {maxDate}",
|
|
39
38
|
"maxEntries": "Cannot have more than {max} entries",
|
|
40
|
-
"maxLength": "
|
|
41
|
-
"min": "
|
|
42
|
-
"minDate": "
|
|
43
|
-
"minLength": "
|
|
39
|
+
"maxLength": "Please enter a value with no more than {maxLength} characters",
|
|
40
|
+
"min": "Please enter a value greater than or equal to {min}",
|
|
41
|
+
"minDate": "Please select a date that is on or after {minDate}",
|
|
42
|
+
"minLength": "Please enter a value with at least {minLength} characters",
|
|
44
43
|
"minusHour": "Subtract an hour",
|
|
45
44
|
"minusMinute": "Subtract a minute",
|
|
46
45
|
"minusSecond": "Subtract a second",
|
|
@@ -50,23 +49,28 @@
|
|
|
50
49
|
"next21Years": "Next 21 years",
|
|
51
50
|
"nextMonth": "Next month",
|
|
52
51
|
"nextYear": "Next year",
|
|
52
|
+
"orderNumber": "Order number",
|
|
53
53
|
"patientIdentifierDuplication": "Patient identifier duplication",
|
|
54
54
|
"patientIdentifierDuplicationDescription": "The identifier provided is already associated with an existing patient. Please check the identifier and try again.",
|
|
55
|
-
"orderNumber": "Order number",
|
|
56
55
|
"previous": "Previous",
|
|
57
56
|
"previous21Years": "Previous 21 years",
|
|
58
57
|
"previousMonth": "Previous month",
|
|
59
58
|
"previousValue": "Previous value",
|
|
60
59
|
"previousYear": "Previous year",
|
|
60
|
+
"referenceRangeCriticalHigh": "Critically high (limit: {limit})",
|
|
61
|
+
"referenceRangeCriticalLow": "Critically low (limit: {limit})",
|
|
62
|
+
"referenceRangeHigh": "Above normal range (limit: {limit})",
|
|
63
|
+
"referenceRangeLow": "Below normal range (limit: {limit})",
|
|
61
64
|
"remove": "Remove",
|
|
62
|
-
"requiredField": "This field is required
|
|
63
|
-
"search": "Search...",
|
|
65
|
+
"requiredField": "This field is required",
|
|
64
66
|
"saveAndCloseButton": "Save and close",
|
|
67
|
+
"search": "Search...",
|
|
65
68
|
"selectWeeks": "Select weeks",
|
|
66
69
|
"set": "Set",
|
|
67
70
|
"submitting": "Submitting...",
|
|
68
71
|
"to": "To",
|
|
69
72
|
"tryOpeningAnotherForm": "Try opening another form",
|
|
73
|
+
"unknownError": "An unknown error occurred",
|
|
70
74
|
"useValue": "Use value",
|
|
71
75
|
"weeks": "Weeks",
|
|
72
76
|
"yearsAgo": " years ago"
|
package/turbo.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turborepo.org/schema.json",
|
|
3
|
+
"extends": ["//"],
|
|
4
|
+
"tasks": {
|
|
5
|
+
"extract-translations": {
|
|
6
|
+
"inputs": ["src/app/**/*.ts", "src/app/**/*.html", "translations/en.json", "tools/extract-translations.mjs"],
|
|
7
|
+
"outputs": ["translations/en.json"]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_form_entry_app=self.webpackChunk_openmrs_esm_form_entry_app||[]).push([[4300],{34300(e){e.exports=JSON.parse('{"aDayAgo":"a day ago","aFewSecondsAgo":"a few seconds ago","aMinuteAgo":"a minute ago","aMonthAgo":"a month ago","aYearAgo":"a year ago","add":"Add","addHour":"Add an hour","addMinute":"Add a minute","addSecond":"Add a second","anHourAgo":"an hour ago","cancel":"Cancel","changeToMonthView":"Change to month view","chooseMonthAndYear":"Choose month and year","clearEntry":"Are you sure you want to clear this entry?","closeThisPanel":"Close this panel","componentLoadingFailed":"Component loading failed.","daysAgo":" days ago","deleteEntry":"Are you sure you want to delete this item?","discardButton":"Discard","disallowDecimals":"Decimals are not allowed","enterMoreCharacters":"Please enter 2 or more characters","errorFetchingFormData":"There was an error fetching form data. Details: {detail}","errorLoadingForm":"Error loading form","errorLoadingResults":"Unable to load results. Please try again.","errorWithForm":"There was an error with this form","fix":"Fix","formSubmissionFailed":"An error occurred while processing your form submission. Please notify the system administrator and reference the following error: {error}","formSubmittedSuccessfully":"The form has been submitted successfully.","from":"From","futureDateRestriction":"Future dates are not allowed!","hoursAgo":" hours ago","invalidDate":"The provided date is invalid!","loading":"Loading...","loadingComponent":"Loading component...","matchNotFound":"Match not found","max":"Max value should be {max}","maxDate":"Max date should be {maxDate}","maxEntries":"Cannot have more than {max} entries","maxLength":"Max length should be {maxLength}","min":"Min value should be {min}","minDate":"Min date should be {minDate}","minLength":"Min length should be {minLength}","minusHour":"Subtract an hour","minusMinute":"Subtract a minute","minusSecond":"Subtract a second","minutesAgo":" minutes ago","monthsAgo":" months ago","next":"Next","next21Years":"Next 21 years","nextMonth":"Next month","nextYear":"Next year","patientIdentifierDuplication":"Patient identifier duplication","patientIdentifierDuplicationDescription":"The identifier provided is already associated with an existing patient. Please check the identifier and try again.","orderNumber":"Order number","previous":"Previous","previous21Years":"Previous 21 years","previousMonth":"Previous month","previousValue":"Previous value","previousYear":"Previous year","remove":"Remove","requiredField":"This field is required!","search":"Search...","saveAndCloseButton":"Save and close","selectWeeks":"Select weeks","set":"Set","submitting":"Submitting...","to":"To","tryOpeningAnotherForm":"Try opening another form","useValue":"Use value","weeks":"Weeks","yearsAgo":" years ago"}')}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"4300.ffbd6d6dac270973.js","mappings":"AAAA,aAAa,8GAA8G,SAAS,uBAAuB,uxBAAuxB,OAAO,wUAAwU,MAAM,qVAAqV,IAAI,iCAAiC,QAAQ,uCAAuC,KAAK,4CAA4C,UAAU,8BAA8B,IAAI,iCAAiC,QAAQ,qCAAqC,UAAU,y8BAAy8B,IAAI","sources":["webpack://_openmrs_esm_form_entry_app/4300.ffbd6d6dac270973.js"],"names":[],"sourceRoot":""}
|