Files
Trilium/apps/client/src/services/i18n.spec.ts

20 lines
754 B
TypeScript
Raw Normal View History

2025-04-28 10:56:20 +03:00
import { LOCALES } from "@triliumnext/commons";
import { readFileSync } from "fs";
2025-04-28 11:03:38 +03:00
import { join } from "path";
2025-06-19 21:30:35 +03:00
import { describe, expect, it } from "vitest";
2025-04-28 10:56:20 +03:00
describe("i18n", () => {
it("translations are valid JSON", () => {
for (const locale of LOCALES) {
if (locale.contentOnly || locale.id === "en_rtl") {
2025-04-28 10:56:20 +03:00
continue;
}
2025-04-28 11:03:38 +03:00
const translationPath = join(__dirname, "..", "translations", locale.id, "translation.json");
2025-04-28 10:56:20 +03:00
const translationFile = readFileSync(translationPath, { encoding: "utf-8" });
expect(() => JSON.parse(translationFile), `JSON error while parsing locale '${locale.id}' at "${translationPath}"`)
.not.toThrow();
}
});
});