Localization and RTL
Arabic first. Labels, number formatting, plurals and direction handling in the UI kit.
The UI kit is Arabic first. Arabic is the default locale, every label ships in Arabic and English, and all styles use CSS logical properties, so right to left needs no extra CSS.
Locale
The surface picks its locale in this order:
- The
localeprop ("ar"or"en"). - The host page's
<html lang>(ar-*oren-*). - Arabic.
The server renders the Arabic defaults. The host page is read after mount, so a page with <html lang="en"> switches after hydration unless you pass locale. Pass locale explicitly to avoid the switch.
Separately, tell the agent the user's language so replies come back in it. The locale in your user token (locale: "ar") is the default for a session. See Signing user tokens.
Direction
The dir prop wins. Otherwise the kit reads the host's <html dir>, then falls back to the locale's direction (Arabic is rtl). The floating panel's positions honor direction, and placement uses "end" and "start" so a corner follows the reading direction.
<BaseeraSurface locale="ar" dir="rtl" placement="bottom-end" />Labels
Every visible string and aria label comes from a label set. Each set has an Arabic and an English version. Get one with a helper and override what you need.
| Helper | Returns | Used by |
|---|---|---|
getSurfaceLabels(locale, override?) | SurfaceLabels | The surface, BaseeraStaticChat, ChatTranscript. |
getApprovalLabels(locale, override?, digits?) | ApprovalLabels | ApprovalCard, BaseeraApprovals. |
getToolStatusLabels(locale, override?) | ToolStatusLabels | ToolStatus, BaseeraToolActivity. |
getFieldLabels(locale, override?) | FieldLabels | BaseeraField. |
getKnowledgeUploadLabels(locale, override?) | KnowledgeUploadLabels | BaseeraKnowledgeUpload. |
getReviewLabels(locale, override?, digits?) | ReviewLabels | The immersive review panel. |
import { getSurfaceLabels, getApprovalLabels, getToolStatusLabels } from "@baseera/ui";
const surface = getSurfaceLabels("ar", { name: "نور", placeholder: "اسأل عن فاتورتك" });
const approvals = getApprovalLabels("ar", { approve: "موافقة" });
const tools = getToolStatusLabels("en", { running: (name) => `Checking ${name}` });On the connected components you do not need the helpers: pass a partial override as a prop.
<BaseeraSurface
locale="ar"
labels={{ name: "نور", launcher: "اسأل نور" }}
approvalLabels={{ approve: "موافقة", reject: "رفض" }}
toolLabels={{ getInvoice: "جارٍ مراجعة الفاتورة" }}
/>The raw sets are exported too: surfaceLabelsByLocale, approvalLabelsByLocale, toolStatusLabelsByLocale, fieldLabelsByLocale, knowledgeUploadLabelsByLocale and reviewLabelsByLocale. A locale other than ar or en falls back to Arabic.
Digits and numbers
digits is "arab" (Arabic-Indic, such as ٣) or "latn" (Western, such as 3). The default is Arabic-Indic for Arabic and Western for English. Every number the kit renders, such as counts, "1 of 3", numeric values and plain dates, goes through Intl.NumberFormat with that numbering system.
import { numberFormat, formatDate, plural } from "@baseera/ui";
const fmt = numberFormat("ar", "arab");
fmt(1250); // Arabic-Indic digits
formatDate("2026-11-09", "ar", "arab"); // a Gregorian date in the locale's digits
plural("ar", 3, { one: "ملاحظة", two: "ملاحظتان", few: "{n} ملاحظات", other: "{n} ملاحظة" });plural uses Intl.PluralRules. Arabic has six forms (zero, one, two, few, many, other), English two. {n} in the text is replaced by the formatted count.
Mixed-direction text
Latin ids, dates and names inside an Arabic sentence, or Arabic inside English, need bidi isolation, or they can render out of order. A date can be read backwards. Values you pass to the approval card are isolated for you. For text you build yourself, such as a tool's describe, wrap inserted values with isolate():
import { isolate } from "@baseera/ui";
useBaseeraTool({
name: "markInvoicePaid",
description: "Mark an invoice as paid",
kind: "write",
input,
describe: (i) => `تسجيل الفاتورة ${isolate(i.invoice)} كمدفوعة بتاريخ ${isolate(i.paidOn)}`,
run,
});Names and ids in the kit's own text render with dir="auto" or inside bdi.
Font
--baseera-font defaults to a stack that covers Arabic. Set it, or theme.font, to use your own. If you load a custom web font, make sure it has Arabic glyphs.
Resolve the environment in your own component
import { useBaseeraEnvironment } from "@baseera/ui";
const { locale, dir, digits, fmt } = useBaseeraEnvironment({ locale: "ar" });resolveLocale, resolveDir, resolveDigits, normalizeLocale and dirForLocale are exported for the same purpose outside React.