mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
do not count unready translations in localization test (#480)
This updates the expected count of languages in a localization test to omit translations that have been started but are not yet ready to be offered to users by default.
This commit is contained in:
@@ -41,14 +41,23 @@ describe("Localization", function() {
|
||||
const namespaces: Set<string> = new Set();
|
||||
for (const file of fs.readdirSync(localeDirectory)) {
|
||||
if (file.endsWith(".json")) {
|
||||
const lang = file.split('.')[0]?.replace(/_/g, '-');
|
||||
const langRaw = file.split('.')[0];
|
||||
const lang = langRaw?.replace(/_/g, '-');
|
||||
const ns = file.split('.')[1];
|
||||
const clientFile = path.join(localeDirectory,
|
||||
`${langRaw}.client.json`);
|
||||
const clientText = fs.readFileSync(clientFile, { encoding: 'utf8' });
|
||||
if (!clientText.includes('Translators: please translate this only when')) {
|
||||
// Translation not ready if this key is not present.
|
||||
continue;
|
||||
}
|
||||
langs.add(lang);
|
||||
namespaces.add(ns);
|
||||
}
|
||||
}
|
||||
assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].sort());
|
||||
assert.deepEqual(gristConfig.namespaces.sort(), [...namespaces].sort());
|
||||
assert.isAbove(gristConfig.supportedLngs.length, 9);
|
||||
});
|
||||
|
||||
// Now make a uz-UZ language file, and test that it is used.
|
||||
|
||||
Reference in New Issue
Block a user