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"), reader chrome, and the in-book help dialog.

Setting language during book creation

When you run tbx create, the CLI prompts you to choose the language:

? Language: › English
              Romanian
              French
              German

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
"fr"French
"de"German

Help can also show a different locale via forceLanguage. See Help.

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 exercise UI, reader chrome, and the default help dialog pick up the change automatically.

How it works

bookConfig.bookLanguage is passed as the language prop to <BookProvider>. 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). The template chrome and help do the same.

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