Fix locale test JSON parsing with UTF-8 BOM support

This commit is contained in:
Jeppe B
2026-04-21 17:36:37 +02:00
parent 9f9d6de03f
commit 7bdfb43635
22 changed files with 508 additions and 332 deletions
@@ -1,6 +1,7 @@
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { readJsonFile } from "./helpers/readJsonFile";
const root = process.cwd();
const componentPath = join(root, "src/components/displays/buttons/ActionSettingsWheelButton.vue");
@@ -8,7 +9,7 @@ const activeLocales = ["da", "en", "sv", "de", "no"];
const translationCallPattern = /(?:\$t|\bt)\(\s*(["'])([^"'\\]*(?:\\.[^"'\\]*)*)\1/g;
const readLocale = (locale) => {
return JSON.parse(readFileSync(join(root, `src/i18n/locales/${locale}.json`), "utf8"));
return readJsonFile(join(root, `src/i18n/locales/${locale}.json`));
};
const extractLiteralTranslationKeys = (source) => {