TBX Docs
Customisation

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
                      Romanian

Your choice is stored as bookLanguage in src/book/bookConfig.json. The template's src/layout.tsx reads that file and passes it to <BookProvider>. No further configuration is needed.

Supported languages

ValueLanguage
"en"English (default)
"ro"Romanian

Changing language after creation

Edit bookLanguage in src/book/bookConfig.json. That file is not overwritten by tbx update.

src/book/bookConfig.json
{
  "bookName": "My Textbook",
  "bookNameSafe": "myTextbook",
  "bookSubtitle": "Year 2",
  "bookType": "default",
  "bookLanguage": "ro"
}

src/layout.tsx reads bookConfig.bookLanguage and passes it as the language prop to <BookProvider>, so all exercise components pick up the change automatically.

How it works

bookConfig.bookLanguage 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>

On this page