1 exam-helloworld-1.js
First run — t shows the source text NOW; await i18n.waitFor("translate") waits for the translations, then the same t calls print Korean.
import { I18n } from "@aurorah/i18n"; // "www.example.com" = your project's namespace (scopes its translation tables) // "ko_kr" = {language}_{country} (ISO 639-1 + ISO 3166-1) const i18n = new I18n({ namespace: "www.example.com", language: "ko_kr", }); const t = i18n.t; // display text without translation console.log(t("Hello~ world !!!")); // Hello~ world !!! console.log(t("menu/marketplace")); // menu/marketplace // wait for translations to be loaded await i18n.waitFor("translate"); // display translations console.log(t("Hello~ world !!!")); // 안녕~ 세상아 !!! console.log(t("menu/marketplace")); // 메뉴/마켓플레이스
# first run — source text now, translations after waitFor("translate") $ node exam-helloworld-1.js Hello~ world !!! menu/marketplace 안녕~ 세상아 !!! 메뉴/마켓플레이스