feat: First iteration, multi themes, I18N

This commit is contained in:
gauvainboiche
2026-10-08 11:58:18 +02:00
parent 9240fa3c3c
commit aa9721ac2a
53 changed files with 3363 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
// Loads the static game data and the lists of installed themes / languages.
import { buildContext } from '../engine/context.js';
async function getJson(url) {
const response = await fetch(url);
if (!response.ok) throw new Error(`${url}: HTTP ${response.status}`);
return response.json();
}
export async function loadGameContext() {
const [rules, generators, upgrades] = await Promise.all([
getJson('data/rules.json'),
getJson('data/generators.json'),
getJson('data/upgrades.json'),
]);
return buildContext({ rules, generators, upgrades });
}
/** [{ id, order, assets, locales }] discovered from public/themes/ by the server. */
export const fetchThemes = () => getJson('api/themes');
/** [{ code, name }] discovered from public/locales/ by the server. */
export const fetchLocales = () => getJson('api/locales');