mirror of
https://github.com/zadam/trilium.git
synced 2026-02-08 07:29:24 +01:00
chore(scripts): improve messages for translation check script
This commit is contained in:
@@ -2,20 +2,21 @@ import { LOCALES } from "../../packages/commons/src/lib/i18n";
|
||||
import { getLanguageStats } from "./utils";
|
||||
|
||||
async function main() {
|
||||
const languageStats = await getLanguageStats("client");
|
||||
const localeIdsWithCoverage = languageStats.results
|
||||
const project = "client";
|
||||
const languageStats = await getLanguageStats(project);
|
||||
const localesWithCoverage = languageStats.results
|
||||
.filter(language => language.translated_percent > 50)
|
||||
.map(language => language.language_code);
|
||||
|
||||
for (const localeId of localeIdsWithCoverage) {
|
||||
for (const localeData of localesWithCoverage) {
|
||||
const { language_code: localeId, translated_percent: percentage, language } = localeData;
|
||||
const locale = LOCALES.find(l => l.id === localeId);
|
||||
if (!locale) {
|
||||
console.error(`Locale not found for id: ${localeId}`);
|
||||
console.error(`❌ Language ${language.name} (${localeId}) has a coverage of ${percentage}% in '${project}', but it is not supported by the application.`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Translation coverage check passed.");
|
||||
console.log("✅ Translation coverage check passed.");
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user