initI18n function exported
Last updated: 2026-03-01T23:25:47.122Z
Location
Metrics
LOC: 19
Complexity: 4
Params: 2
Signature
initI18n(
lang: "auto" | "en" | "pt_BR" | "es" = "auto",
): : Promise<void>
Summary
Initialises the i18n catalog for the given language. Must be called once at app startup, before any t() or localizeHTML() calls. Passing "auto" (default) delegates to Chrome's native locale resolution.
Source Code
export async function initI18n(
lang: "auto" | "en" | "pt_BR" | "es" = "auto",
): Promise<void> {
if (lang === "auto") {
_catalog = null;
return;
}
try {
const url = chrome.runtime.getURL(`_locales/${lang}/messages.json`);
const res = await fetch(url);
if (!res.ok) {
_catalog = null;
return;
}
_catalog = (await res.json()) as MessageCatalog;
} catch {
_catalog = null;
}
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| FillableElement | uses |
| renderShell | uses |
| render | uses |
| main | uses |
| debounce | uses |