@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 23 lines 893 Bytes
Raw
1 import { initializeGTSPA } from "gt-react";
2
3 import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from "./locales";
4
5 // English is the source text, so it never loads a chunk.
6 async function loadTranslations(locale: string): Promise<unknown> {
7 if (locale === DEFAULT_LOCALE) return {};
8 const module: { default: unknown } = await import(`./translations/${locale}.json`);
9 return module.default;
10 }
11
12 /** Sets up GT's singletons. `onLocaleRequest` receives GT's own locale changes. */
13 export function initializeI18n(onLocaleRequest: (locale: string) => void): void {
14 void initializeGTSPA({
15 defaultLocale: DEFAULT_LOCALE,
16 locales: [...SUPPORTED_LOCALES],
17 locale: DEFAULT_LOCALE,
18 loadTranslations,
19 // GT's default drops a catalog from its cache after 60 s; call-time `m()` reads that cache.
20 cacheExpiryTime: null,
21 _reload: (state) => onLocaleRequest(state.locale),
22 });
23 }