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. * Overrides for the categories of the certain locales.
*/ */
const localesCategoriesOverrides: Partial = { const localesCategoriesOverrides: Partial<Record<string, "fun" | "experimental">> = {
"en-x-pirate": "fun", "en-x-pirate": "fun",
"en-x-updown": "fun", "en-x-updown": "fun",
"en-x-lolcat": "fun", "en-x-lolcat": "fun",
@ -260,13 +260,7 @@ export default defineNuxtConfig({
const omorphiaLocales: string[] = []; const omorphiaLocales: string[] = [];
const omorphiaLocaleSets = new Map<string, { files: { from: string }[] }>(); const omorphiaLocaleSets = new Map<string, { files: { from: string }[] }>();
const externalLocales = [ for await (const localeDir of globIterate("node_modules/@modrinth/ui/src/locales/*", {
"node_modules/@modrinth/ui/src/locales/en-US",
"node_modules/@modrinth/moderation/locales/en-US",
];
for (const localePath of externalLocales) {
for await (const localeDir of globIterate(localePath, {
posix: true, posix: true,
})) { })) {
const tag = basename(localeDir); const tag = basename(localeDir);
@ -283,7 +277,6 @@ export default defineNuxtConfig({
}); });
} }
} }
}
return function resolveLocaleImport(tag: string) { return function resolveLocaleImport(tag: string) {
return omorphiaLocaleSets.get(matchLocale([tag], omorphiaLocales, "en-x-placeholder")); return omorphiaLocaleSets.get(matchLocale([tag], omorphiaLocales, "en-x-placeholder"));
@ -308,7 +301,7 @@ export default defineNuxtConfig({
format: "crowdin", format: "crowdin",
}); });
} else if (fileName === "meta.json") { } else if (fileName === "meta.json") {
const meta: Record = await fs const meta: Record<string, { message: string }> = await fs
.readFile(localeFile, "utf8") .readFile(localeFile, "utf8")
.then((date) => JSON.parse(date)); .then((date) => JSON.parse(date));
const localeMeta = (locale.meta ??= {}); const localeMeta = (locale.meta ??= {});