@uniweb/build 0.8.24 → 0.8.25
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/package.json +2 -2
- package/src/i18n/audit.js +25 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.25",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@uniweb/theming": "0.1.2"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@uniweb/runtime": "0.6.
|
|
57
|
+
"@uniweb/runtime": "0.6.21",
|
|
58
58
|
"@uniweb/content-reader": "1.1.4",
|
|
59
59
|
"@uniweb/schemas": "0.2.1"
|
|
60
60
|
},
|
package/src/i18n/audit.js
CHANGED
|
@@ -46,15 +46,19 @@ export async function auditLocale(localesPath, locale) {
|
|
|
46
46
|
const valid = []
|
|
47
47
|
const missing = []
|
|
48
48
|
const stale = []
|
|
49
|
+
const needsTags = []
|
|
49
50
|
|
|
50
51
|
// Check manifest entries
|
|
51
52
|
for (const hash of manifestHashes) {
|
|
52
53
|
if (translationHashes.has(hash)) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const source = manifest.units[hash].source
|
|
55
|
+
const translation = getTranslationText(translations[hash])
|
|
56
|
+
valid.push({ hash, source, translation })
|
|
57
|
+
|
|
58
|
+
// Flag entries where source has inline tags but translation doesn't
|
|
59
|
+
if (/<\d+>/.test(source) && !/<\d+>/.test(translation) && translation.length > 0) {
|
|
60
|
+
needsTags.push({ hash, source, translation })
|
|
61
|
+
}
|
|
58
62
|
} else {
|
|
59
63
|
missing.push({
|
|
60
64
|
hash,
|
|
@@ -81,7 +85,8 @@ export async function auditLocale(localesPath, locale) {
|
|
|
81
85
|
total: manifestHashes.size,
|
|
82
86
|
valid,
|
|
83
87
|
missing,
|
|
84
|
-
stale
|
|
88
|
+
stale,
|
|
89
|
+
needsTags
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
|
|
@@ -156,6 +161,9 @@ export function formatAuditReport(results, options = {}) {
|
|
|
156
161
|
lines.push(` Valid: ${result.valid.length} (${coverage}%)`)
|
|
157
162
|
lines.push(` Missing: ${result.missing.length}`)
|
|
158
163
|
lines.push(` Stale: ${result.stale.length}`)
|
|
164
|
+
if (result.needsTags?.length > 0) {
|
|
165
|
+
lines.push(` Needs tags: ${result.needsTags.length}`)
|
|
166
|
+
}
|
|
159
167
|
|
|
160
168
|
if (verbose && result.stale.length > 0) {
|
|
161
169
|
lines.push(`\n Stale entries:`)
|
|
@@ -167,6 +175,17 @@ export function formatAuditReport(results, options = {}) {
|
|
|
167
175
|
lines.push(` ... and ${result.stale.length - 10} more`)
|
|
168
176
|
}
|
|
169
177
|
}
|
|
178
|
+
|
|
179
|
+
if (verbose && result.needsTags?.length > 0) {
|
|
180
|
+
lines.push(`\n Translations missing inline tags:`)
|
|
181
|
+
for (const entry of result.needsTags.slice(0, 10)) {
|
|
182
|
+
const src = truncate(entry.source, 50)
|
|
183
|
+
lines.push(` - ${entry.hash}: "${src}"`)
|
|
184
|
+
}
|
|
185
|
+
if (result.needsTags.length > 10) {
|
|
186
|
+
lines.push(` ... and ${result.needsTags.length - 10} more`)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
return lines.join('\n')
|