mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Add the i18n foundation: src/i18n/locale.js (locale resolution with a configurable GEV_DEFAULT_LOCALE / GEV_SECONDARY_LOCALE pair, guarded preference storage, one-shot ?lang= override, <html lang>/<html dir> metadata) and src/i18n/index.js (catalog registry, t(), Intl formatters, applyDocumentTranslations, persistLocaleAndReload). English is the only shipped locale in this PR: the four en catalogs (shell/cockpit/layers/setup) are the reference and the always-shipped fallback, the built-in pair degenerates to en-only, and English output is byte-identical to the strings these replace. Parity gates land with the core (catalog key/placeholder/plural-shape parity, markup coverage of every data-i18n* attribute, repair-pass anchors pinning en byte-identity); additional locales ship as stacked follow-up PRs through the recipe in docs/TRANSLATORS.md. Rebased onto current main: the client defines live in build/vite.js / server/standalone/vite.config.js as before.
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
import { createBrowserViteConfig } from '../../build/vite.js';
|
|
import { localProviderPlugins } from '../providers/local.js';
|
|
import { apiNotFoundPlugin } from './api-not-found.js';
|
|
|
|
const root = fileURLToPath(new URL('../../', import.meta.url));
|
|
|
|
/** Load this checkout's configuration and attach its local provider middleware. */
|
|
export default defineConfig(({ command, mode }) => {
|
|
const loaded = loadEnv(mode, root, '');
|
|
for (const [key, value] of Object.entries(loaded)) {
|
|
if (process.env[key] === undefined) process.env[key] = value;
|
|
}
|
|
return createBrowserViteConfig({
|
|
plugins: [...localProviderPlugins(), apiNotFoundPlugin()],
|
|
googleApiKey: process.env.GOOGLE_MAPS_API_KEY,
|
|
cesiumToken: process.env.CESIUM_ION_TOKEN,
|
|
defaultLocale: process.env.GEV_DEFAULT_LOCALE ?? '',
|
|
secondaryLocale: process.env.GEV_SECONDARY_LOCALE ?? '',
|
|
host: process.env.HOST,
|
|
port: process.env.PORT,
|
|
command,
|
|
});
|
|
});
|