diff --git a/gui/src/client.ts b/gui/src/client.ts index bd67b480..eb32d61d 100644 --- a/gui/src/client.ts +++ b/gui/src/client.ts @@ -223,7 +223,9 @@ export interface ApiClient { /** * Load extra strings from the server. */ - strings(): Promise>; + strings(): Promise; + }>>; /** * Start a txt2img pipeline. @@ -394,10 +396,14 @@ export function makeClient(root: string, f = fetch): ApiClient { const res = await f(path); return await res.json() as Array; }, - async strings(): Promise> { + async strings(): Promise; + }>> { const path = makeApiUrl(root, 'settings', 'strings'); const res = await f(path); - return await res.json() as Record; + return await res.json() as Record; + }>; }, async img2img(model: ModelParams, params: Img2ImgParams, upscale?: UpscaleParams): Promise { const url = makeImageURL(root, 'img2img', params); diff --git a/gui/src/main.tsx b/gui/src/main.tsx index 1214eafa..c71349cb 100644 --- a/gui/src/main.tsx +++ b/gui/src/main.tsx @@ -65,8 +65,11 @@ export async function main() { }); const strings = await client.strings(); - for (const [lang, data] of Object.entries(strings)) { - i18n.addResourceBundle(lang, 'translation', data, true); + for (const [lang, translation] of Object.entries(strings)) { + console.log('adding strings', lang, translation); + for (const [namespace, data] of Object.entries(translation)) { + i18n.addResourceBundle(lang, namespace, data, true); + } } // prep zustand with a slice for each tab, using local storage