Languages

🇮🇩 Bahasa Indonesia

The interface ships in Bahasa Indonesia (id, the reference) and English (en).

  • First visit: site.defaultLocale in site.config.ts.
  • Visitors switch in the footer; the choice is stored in their browser (localStorage key locale) and the page reloads in the new language.
  • Emails and API messages always use site.defaultLocale (they’re sent to many people at once).
  • Course content (titles, lessons, quizzes) is written by you in whatever language you type; it is not translated.

Where the text is

Text File
Web pages artifacts/learnspace/src/i18n/locales/id/<area>.ts and …/en/<area>.ts
Emails, API error messages artifacts/api-server/src/lib/i18n.ts
Name, tagline, hero, footer links lib/site-config/site.config.ts ({ id, en } pairs)
Browser title and description built from site.config.ts by artifacts/learnspace/vite.config.ts

Web areas: common, nav (navbar, footer, home), catalog, course, lesson, pass (Learning Pass, checkout), events (workshops, webinars), blog, account (profile, community), legal, creator, admin.

Changing a text

Find it (grep -rn "Lihat katalog" artifacts/learnspace/src/i18n), edit the string in both id/ and en/, done. Placeholders such as {site}, {name}, {price} must stay in both languages.

Adding a text in code

// 1. add the key in locales/id/course.ts   →  certificate: "Unduh sertifikat {title}",
// 2. add the same key in locales/en/course.ts →  certificate: "Download the {title} certificate",
// 3. use it
import { t } from "@/i18n";
<Button>{t("course.certificate", { title: course.title })}</Button>

t() is typed: a misspelt key or a key missing in English fails pnpm run typecheck. Format dates, numbers and money with formatDate, formatNumber, formatMoney from @/i18n so they follow the language too.

On the server: add the key to both dictionaries in api-server/src/lib/i18n.ts and use m("key", { vars }).

Adding a third language (e.g. Javanese jv)

  1. lib/site-config/site.config.ts: export type Locale = "id" | "en" | "jv"; — TypeScript will then ask for a jv value in every { id, en } pair in the config.
  2. Web: copy locales/en/ to locales/jv/, translate, and create locales/jv.ts like locales/en.ts. In src/i18n/index.ts add jv to DICTS, to the check in initialLocale(), and pick an intlLocale() tag ("jv-ID"). Add the option to LANGUAGES in src/components/footer.tsx.
  3. Server: add a jv dictionary in api-server/src/lib/i18n.ts.
  4. pnpm run typecheck lists every missing key.

Tests

Web tests run in Indonesian (src/test/setup.ts), so they keep passing whatever your default language is. When you change an Indonesian string that a test asserts, update the test to use t("…") rather than a new literal.