mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Restore current key order across locale files. Preserve the 2,417-string completion milestone while keeping newer feature work visible in ordinary translation reports. Retain full-catalog placeholder and feature-specific checks, with negative coverage for regressions and hidden backlog. Thanks to xet7 !
58 lines
1.9 KiB
JavaScript
58 lines
1.9 KiB
JavaScript
// The completed catalog predates newer features; keep its no-regression gate.
|
|
// Full translation work remains visible through fill-translations.mjs --list.
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const { spawnSync } = require('node:child_process');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const fillScript = path.join(root, 'releases/translations/fill-translations.mjs');
|
|
const result = spawnSync(process.execPath, [fillScript, '--completed-catalog', '--list', 'ga'], {
|
|
cwd: root,
|
|
encoding: 'utf8',
|
|
});
|
|
assert.equal(result.status, 0, result.stderr);
|
|
const remaining = JSON.parse(result.stdout);
|
|
// This explicit count makes a skipped or oversized batch visible. The token
|
|
// and tag inventory checks below protect every translated value.
|
|
assert.equal(Object.keys(remaining).length, 0);
|
|
|
|
const english = JSON.parse(
|
|
fs.readFileSync(path.join(root, 'imports/i18n/data/en.i18n.json'), 'utf8'),
|
|
);
|
|
const irish = JSON.parse(
|
|
fs.readFileSync(path.join(root, 'imports/i18n/data/ga.i18n.json'), 'utf8'),
|
|
);
|
|
const tokens = (value) =>
|
|
[
|
|
...value.matchAll(
|
|
/__[A-Za-z0-9_]+__|%[A-Za-z]|%{[A-Za-z0-9]+}|{{[A-Za-z0-9]+}}/g,
|
|
),
|
|
]
|
|
.map(([token]) => token)
|
|
.sort();
|
|
const tags = (value) =>
|
|
[...value.matchAll(/<\/?[A-Za-z][^>]*>/g)]
|
|
.map(([tag]) => tag)
|
|
.sort();
|
|
|
|
for (const [key, value] of Object.entries(irish)) {
|
|
if (value !== english[key]) {
|
|
assert.deepEqual(tokens(value), tokens(english[key]), key);
|
|
}
|
|
assert.deepEqual(tags(value), tags(english[key]), key);
|
|
}
|
|
|
|
assert.equal(irish.accept, 'Glac');
|
|
assert.deepEqual(tokens(irish['activity-changedTitle']), ['%s', '%s']);
|
|
assert.deepEqual(tokens(irish['act-removeChecklistItem']), [
|
|
'__board__',
|
|
'__card__',
|
|
'__checkList__',
|
|
'__checklistItem__',
|
|
'__list__',
|
|
'__swimlane__',
|
|
]);
|
|
assert.match(irish['act-createBoard'], /clár/);
|
|
assert.match(irish['act-createCard'], /cárta/);
|