Skip to content
BuildBase

Internationalization (i18n) overview

Built-in i18n with 8 locales, RTL support, and locale-aware number and currency formatting.

All pre-built UI in BuildBase is translated into 8 languages. Set the locale on SaaSOSProvider and everything - settings screens, pricing pages, error messages - adapts automatically.

<SaaSOSProvider
  serverUrl="https://api.console.buildbase.app"
  orgId="your-org-id"
  locale="es" // Spanish
>

Supported locales: en, es, fr, de, ja, zh, hi, ar.

useTranslation()

For locale-aware formatting in your own components:

import { useTranslation } from '@buildbase/sdk/react';

function PriceDisplay({ cents, currency }) {
  const { t, fmtCents, fmtNum, dir } = useTranslation();

  return (
    <div dir={dir}>
      <p>{t('subscription.currentPlan')}</p>
      <p>{fmtCents(cents, currency)}</p>
      <p>{fmtNum(1234)}</p>
    </div>
  );
}
ReturnTypeDescription
t(key)functionTranslate a key to the current locale
localestringCurrent locale code
dir'ltr' / 'rtl'Text direction ('rtl' for Arabic)
fmtCents(cents, currency)functionFormat cents as currency - $49.99 (en), ٤٩٫٩٩ (ar)
fmtNum(n)functionFormat number - 1,234 (en), १,२३४ (hi), ١٬٢٣٤ (ar)

RTL support

Arabic (ar) automatically sets dir to 'rtl'. Use it on your container to flip the layout:

const { dir } = useTranslation();

<div dir={dir}>{/* Layout flips automatically for Arabic */}</div>;

The SDK's own screens flip by themselves. With locale="ar" on the provider, the settings dialog puts its list of screens on the right and writes numbers and dates in native numerals. Role names are your own, so they stay as you named them.

The settings dialog in Arabic: the list of screens on the right, the members screen reading from right to left, the seat count as ٣ / ١٠ and the role names viewer and editor as the app named them

Native numerals

fmtCents and fmtNum use native numeral systems:

LocalefmtCents(4999, 'usd')fmtNum(1234)
en$49.991,234
hi₹49.99 (Devanagari)१,२३४
ar٤٩٫٩٩ (Arabic-Indic)١٬٢٣٤

Your own words, in every language

Use your own words for anything the SDK shows, such as "Billing" where it says "Subscription". Set them in ui.messages on the provider. They are merged over the active language's strings, key by key. A key you set applies in every language, and a key you leave out keeps the SDK's wording. See Visibility and wording.

The hosted sign-in page

The sign-in page speaks the same languages. signIn() sends the provider's locale, or auth.locale when you want the sign-in page in another one, so a person who was reading your app in Spanish signs in in Spanish. The page also has a language switcher in its footer, and emails stay in English. See Sign-in page brand and language.

Next Steps