From d8f33641a5ea83485dc9975fe4b7be584415a78a Mon Sep 17 00:00:00 2001 From: Sasha Sorokin <10401817+brawaru@users.noreply.github.com> Date: Wed, 23 Aug 2023 21:18:58 +0200 Subject: [PATCH] Enable all locales on staging instances (#1336) --- nuxt.config.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index d7c2fd752..8bbccb989 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -58,6 +58,9 @@ const localesCategoriesOverrides: Partial 'en-x-lolcat': 'fun', 'en-x-uwu': 'fun', 'ru-x-bandit': 'fun', + ar: 'experimental', + he: 'experimental', + pes: 'experimental', } export default defineNuxtConfig({ @@ -200,6 +203,8 @@ export default defineNuxtConfig({ async 'vintl:extendOptions'(opts) { opts.locales ??= [] + const isProduction = getDomain() === 'https://modrinth.com' + const resolveCompactNumberDataImport = await (async () => { const compactNumberLocales: string[] = [] const resolvedImports = new Map() @@ -225,7 +230,7 @@ export default defineNuxtConfig({ for await (const localeDir of globIterate('locales/*/', { posix: true })) { const tag = basename(localeDir) - if (!enabledLocales.includes(tag) && opts.defaultLocale !== tag) continue + if (isProduction && !enabledLocales.includes(tag) && opts.defaultLocale !== tag) continue const locale = opts.locales.find((locale) => locale.tag === tag) ?? @@ -246,8 +251,9 @@ export default defineNuxtConfig({ }) } } else if (fileName === 'meta.json') { - /** @type {Record} */ - const meta = await fs.readFile(localeFile, 'utf8').then((date) => JSON.parse(date)) + const meta: Record = await fs + .readFile(localeFile, 'utf8') + .then((date) => JSON.parse(date)) locale.meta ??= {} for (const key in meta) { locale.meta[key] = meta[key].message