mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +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:
parent
e1ec94faa7
commit
f5eb8f7730
@ -1317,7 +1317,7 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
const options = section.options();
|
const options = section.options();
|
||||||
const colIds = section.viewFields().all().map((f) => f.column().colId());
|
const colIds = section.viewFields().all().map((f) => f.column().colId());
|
||||||
const chartType = section.chartType();
|
const chartType = section.chartType();
|
||||||
const theme = section.theme();
|
const sectionTheme = section.theme();
|
||||||
|
|
||||||
// we must read the current layout from the view layout because it can override the one in
|
// we must read the current layout from the view layout because it can override the one in
|
||||||
// `section.layoutSpec` (in particular it provides a default layout when missing from the
|
// `section.layoutSpec` (in particular it provides a default layout when missing from the
|
||||||
@ -1351,7 +1351,7 @@ export class GristDoc extends DisposableWithEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update theme, and chart type
|
// update theme, and chart type
|
||||||
await newSection.theme.saveOnly(theme);
|
await newSection.theme.saveOnly(sectionTheme);
|
||||||
await newSection.chartType.saveOnly(chartType);
|
await newSection.chartType.saveOnly(chartType);
|
||||||
|
|
||||||
// The newly-added section should be given focus.
|
// The newly-added section should be given focus.
|
||||||
|
@ -41,14 +41,23 @@ describe("Localization", function() {
|
|||||||
const namespaces: Set<string> = new Set();
|
const namespaces: Set<string> = new Set();
|
||||||
for (const file of fs.readdirSync(localeDirectory)) {
|
for (const file of fs.readdirSync(localeDirectory)) {
|
||||||
if (file.endsWith(".json")) {
|
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 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);
|
langs.add(lang);
|
||||||
namespaces.add(ns);
|
namespaces.add(ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].sort());
|
assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].sort());
|
||||||
assert.deepEqual(gristConfig.namespaces.sort(), [...namespaces].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.
|
// Now make a uz-UZ language file, and test that it is used.
|
||||||
|
Loading…
Reference in New Issue
Block a user