fix: locale issues

This commit is contained in:
IMB11 2025-07-28 16:41:30 +01:00
parent fe3d360215
commit b87fb1de00

View File

@ -34,7 +34,7 @@ const enabledLocales: string[] = [];
/**
* Overrides for the categories of the certain locales.
*/
const localesCategoriesOverrides: Partial = {
const localesCategoriesOverrides: Partial<Record<string, "fun" | "experimental">> = {
"en-x-pirate": "fun",
"en-x-updown": "fun",
"en-x-lolcat": "fun",
@ -260,28 +260,21 @@ export default defineNuxtConfig({
const omorphiaLocales: string[] = [];
const omorphiaLocaleSets = new Map<string, { files: { from: string }[] }>();
const externalLocales = [
"node_modules/@modrinth/ui/src/locales/en-US",
"node_modules/@modrinth/moderation/locales/en-US",
];
for await (const localeDir of globIterate("node_modules/@modrinth/ui/src/locales/*", {
posix: true,
})) {
const tag = basename(localeDir);
omorphiaLocales.push(tag);
for (const localePath of externalLocales) {
for await (const localeDir of globIterate(localePath, {
posix: true,
})) {
const tag = basename(localeDir);
omorphiaLocales.push(tag);
const localeFiles: { from: string; format?: string }[] = [];
const localeFiles: { from: string; format?: string }[] = [];
omorphiaLocaleSets.set(tag, { files: localeFiles });
omorphiaLocaleSets.set(tag, { files: localeFiles });
for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) {
localeFiles.push({
from: pathToFileURL(localeFile).toString(),
format: "default",
});
}
for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) {
localeFiles.push({
from: pathToFileURL(localeFile).toString(),
format: "default",
});
}
}
@ -308,7 +301,7 @@ export default defineNuxtConfig({
format: "crowdin",
});
} else if (fileName === "meta.json") {
const meta: Record = await fs
const meta: Record<string, { message: string }> = await fs
.readFile(localeFile, "utf8")
.then((date) => JSON.parse(date));
const localeMeta = (locale.meta ??= {});