mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Fill 3,129 English values and repair 167 seeded values across 130 locale paths. Preserve existing translations and human-verified zh catalogs. Retire 15 completed pending keys. Record provisional terminology in Luganda, Tswana, Tongan, Tsonga, Aymara, Quechua, Wolaytta, Venda, Acehnese, Walloon, Wolof and Tamazight as low confidence pending native review. All 307 translation/Blockly suites and 21 human-preference checks pass. Source tokens match across all 246 catalogs. Expanded browser coverage registers 125 tests; execution requires a running app. Thanks to xet7 !
58 lines
3.0 KiB
JavaScript
58 lines
3.0 KiB
JavaScript
'use strict';
|
|
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const i18next = require('i18next');
|
|
const labels = require('./fixtures/shared-translation-labels.json');
|
|
const directory = path.join(__dirname, '../imports/i18n/data');
|
|
const read = code => JSON.parse(fs.readFileSync(path.join(directory, `${code}.i18n.json`)));
|
|
const source = read('en');
|
|
const locales = fs.readdirSync(directory).filter(f => f.endsWith('.i18n.json'))
|
|
.map(f => f.replace('.i18n.json', '')).filter(c => !/^en(?:[-_]|$)/.test(c));
|
|
|
|
// These are native shared spellings, not blanket exemptions for a language.
|
|
function sharedSpelling(code, key) {
|
|
return key === 'blockly-COLOUR_RGB_RED' && code === 'bi'
|
|
|| key === 'blockly-LISTS_CREATE_WITH_CONTAINER_TITLE_ADD' && ['fy', 'fy-NL'].includes(code)
|
|
|| labels[key] === 'r-item' && ['af', 'af_ZA', 'pt-PT'].includes(code);
|
|
}
|
|
|
|
test('completed shared labels render in every non-English locale without fallback', async () => {
|
|
const { translationTokens } = await import('../releases/translations/placeholder-tokens.mjs');
|
|
const i18n = i18next.createInstance();
|
|
await i18n.init({ lng: 'en', fallbackLng: 'en', initImmediate: false,
|
|
interpolation: { prefix: '__', suffix: '__' }, resources: { en: { translation: source } } });
|
|
for (const code of locales) {
|
|
const data = read(code);
|
|
i18n.addResourceBundle(code, 'translation', data);
|
|
for (const key of Object.keys(labels)) {
|
|
const identity = `${code}:${key}`;
|
|
assert.ok(data[key]?.trim(), identity);
|
|
if (!sharedSpelling(code, key)) assert.notEqual(data[key], source[key], identity);
|
|
assert.doesNotMatch(data[key], /Wolayttatto:|Faka-Tonga:|Aymar aruna:|Tshedimosetso:|Kay willaymi:|Hi Xitsonga:|\(mu Luganda\)/, identity);
|
|
assert.deepEqual(translationTokens(data[key]), translationTokens(source[key]), identity);
|
|
assert.equal(i18n.t(key, { lng: code }), data[key], identity);
|
|
}
|
|
}
|
|
});
|
|
|
|
test('same-source context review excludes misleading homonyms', () => {
|
|
for (const [target, donor] of Object.entries(labels)) assert.equal(source[target], source[donor], target);
|
|
for (const key of ['blockly-CONTROL_KEY', 'blockly-HOME_KEY', 'blockly-END_KEY']) {
|
|
assert.ok(!(key in labels), key);
|
|
}
|
|
const pending = require('../releases/translations/pending-transifex.json').keys.map(row => row.key);
|
|
for (const key of Object.keys(labels)) assert.ok(!pending.includes(key), key);
|
|
});
|
|
|
|
test('repairs retain language-specific vocabulary and cancellation meaning', () => {
|
|
assert.equal(read('ve')['notification-delivery-layout'], 'Nzudzanyo');
|
|
assert.equal(read('ace')['blockly-COLOUR_RGB_RED'], 'mirah');
|
|
assert.equal(read('vo').link, 'Yüm');
|
|
assert.equal(read('to').calendar, 'Tohi māhina');
|
|
assert.notEqual(read('wal')['scrum-state-cancelled'], 'Atto giis', 'cancelled is not an apology');
|
|
assert.equal(read('wal')['scrum-state-cancelled'], 'Aggida');
|
|
assert.notEqual(read('ts')['scrum-state-active'], read('ts')['scrum-state-closed']);
|
|
});
|