feat: parse locale before ww init

This commit is contained in:
Zamitto
2026-01-03 16:54:42 -03:00
parent 8b3bcd88b1
commit 7ed514b6ef

View File

@@ -120,11 +120,16 @@ export function App() {
async (token?: string, locale?: string) => { async (token?: string, locale?: string) => {
if (wokwondersRef.current) return; if (wokwondersRef.current) return;
const possibleLocales = ["en", "pt", "ru"];
const parsedLocale =
possibleLocales.find((l) => l === locale?.slice(0, 2)) ?? "en";
wokwondersRef.current = new WorkWondersSdk(); wokwondersRef.current = new WorkWondersSdk();
await wokwondersRef.current.init({ await wokwondersRef.current.init({
organization: "hydra", organization: "hydra",
token, token,
locale, locale: parsedLocale,
}); });
await wokwondersRef.current.initChangelogWidget(); await wokwondersRef.current.initChangelogWidget();