Files
wekan/tests/dueFilterDistinctLabels.test.cjs
T
Lauri Ojansivu 423ac8a145 German: "Due next week" filter says "Nächste Woche fällig", not "Diese Woche fällig".
The filter sidebar's due date options "Due this week" and "Due next week"
had the same German label, so two options returning different cards could
not be told apart. Fixed in de, de-AT, de_DE and de-CH, and the same copied
label in lb, sv and ts. In ak, "Due today" and "Due next week" both said
"search this"; both now say what they filter (low confidence for ak, lb
and ts).

tests/dueFilterDistinctLabels.test.cjs pins the German labels and fails
when any language gives two due date options the same label.

Thanks to d0g2342 and xet7 !

Fixes #6887.
2026-11-08 21:16:56 +02:00

45 lines
2.2 KiB
JavaScript

'use strict';
// #6887: in German the filter sidebar's "Due next week" option said "Diese
// Woche fällig", the same as "Due this week", so the two options that return
// different cards could not be told apart. The same copy sat in de-AT, de_DE,
// de-CH, lb, sv and ts, and in ak "Due today" and "Due next week" were both
// "search this".
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { translationTokens } = require('../releases/translations/placeholder-tokens.mjs');
const dir = path.join(__dirname, '../imports/i18n/data');
const read = code => JSON.parse(fs.readFileSync(path.join(dir, `${code}.i18n.json`), 'utf8'));
const en = read('en');
const keys = Object.keys(en).filter(key => key.startsWith('filter-due-'));
assert.ok(keys.includes('filter-due-this-week') && keys.includes('filter-due-next-week'), 'the due filter keys exist');
// Positive: the German labels say which week.
for (const [code, thisWeek, nextWeek] of [
['de', 'Diese Woche fällig', 'Nächste Woche fällig'],
['de-AT', 'Diese Woche fällig', 'Nächste Woche fällig'],
['de_DE', 'Diese Woche fällig', 'Nächste Woche fällig'],
['de-CH', 'diese Woche fällig', 'nächste Woche fällig'],
]) {
const locale = read(code);
assert.equal(locale['filter-due-this-week'], thisWeek, `${code}: this week`);
assert.equal(locale['filter-due-next-week'], nextWeek, `${code}: next week`);
}
assert.equal(read('sv')['filter-due-next-week'], 'Förfaller nästa vecka', 'sv: next week');
// Negative: in no language do two due-date options share one label.
const locales = fs.readdirSync(dir).filter(file => file.endsWith('.i18n.json')).map(file => file.replace('.i18n.json', ''));
for (const code of locales) {
const locale = read(code);
const seen = new Map();
for (const key of keys) {
const value = locale[key];
if (!value) continue;
assert.deepEqual(translationTokens(value), translationTokens(en[key]), `${code}:${key}: exact placeholders`);
assert.ok(!seen.has(value), `${code}: ${key} and ${seen.get(value)} are both ${JSON.stringify(value)}`);
seen.set(value, key);
}
}
console.log(`due filter labels distinct in ${locales.length} locales`);