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