Language
Localisation and language options
TBX supports multiple languages for exercise UI strings (titles, descriptions, and button labels such as "Check" and "Reset").
Setting language during book creation
When you run tbx create, the CLI prompts you to choose the exercise language:
? Exercise language: › English
RomanianYour choice is written into src/bookConfig.ts and automatically wired into <BookProvider> in src/layout.tsx. No further configuration is needed.
Supported languages
| Value | Language |
|---|---|
"en" | English (default) |
"ro" | Romanian |
Changing language after creation
Open src/bookConfig.ts and update the language field:
export const bookConfig: BookConfig = {
bookType: "default",
language: "ro",
};The template's src/layout.tsx reads this value and passes it to <BookProvider>, so all exercise components pick up the change automatically.
How it works
bookConfig.language is passed as the language prop to <BookProvider>. All exercise components call useBook() internally to read the current language from context and render the appropriate UI strings (type names, tooltips, info text, button labels, and results text).
If you need to pass a language value that is not yet reflected in bookConfig — for example in a custom layout — you can still pass it directly:
import { BookProvider } from "@bside-tech/tbx";
<BookProvider language="ro" pages={pages} chapters={chapters}>
{/* ... */}
</BookProvider>