(refactor) replace process.env.LOCALES by inlining it

This commit is contained in:
Valentyne Stigloher 2024-05-09 15:07:49 +02:00
parent b7b9d89b05
commit afbfec308c
2 changed files with 2 additions and 3 deletions

View File

@ -327,8 +327,6 @@ const nuxtConfig: NuxtConfig = {
HOME_URL: process.env.HOME_URL || 'https://pronouns.page',
TITLE: title,
PUBLIC_KEY: fs.readFileSync(`${__dirname}/keys/public.pem`).toString(),
// @ts-expect-error: Nuxt checks for string, but object works fine
LOCALES: locales,
BUCKET: `https://${process.env.AWS_S3_BUCKET}.s3-${process.env.AWS_REGION}.amazonaws.com`,
CLOUDFRONT: process.env.CLOUDFRONT!,
STATS_FILE: process.env.STATS_FILE!,

View File

@ -11,6 +11,7 @@ import translations from '../data/translations.suml';
import baseTranslations from '../locale/_base/translations.suml';
import { LoadScriptError } from '../src/errors.ts';
import type { Config } from '../locale/config.ts';
import buildLocaleList from '../src/buildLocaleList.ts';
declare global {
interface Window {
@ -61,7 +62,7 @@ const plugin: Plugin = ({ app, store }, inject) => {
});
inject('locales', buildDict(function* () {
const locales = process.env.LOCALES as unknown as Record<string, LocaleDescription>;
const locales = buildLocaleList(app.$config.locale);
if (app.$config.locale !== '_') {
yield [app.$config.locale, locales[app.$config.locale]];
}