Languages
🇮🇩 Bahasa Indonesia
The interface ships in Bahasa Indonesia (id, the reference) and English (en).
- First visit:
site.defaultLocaleinsite.config.ts. - Visitors switch in the footer; the choice is stored in their browser (
localStoragekeylocale) 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)
lib/site-config/site.config.ts:export type Locale = "id" | "en" | "jv";— TypeScript will then ask for ajvvalue in every{ id, en }pair in the config.- Web: copy
locales/en/tolocales/jv/, translate, and createlocales/jv.tslikelocales/en.ts. Insrc/i18n/index.tsaddjvtoDICTS, to the check ininitialLocale(), and pick anintlLocale()tag ("jv-ID"). Add the option toLANGUAGESinsrc/components/footer.tsx. - Server: add a
jvdictionary inapi-server/src/lib/i18n.ts. pnpm run typechecklists 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.