Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Get started

Localization

LocaleProvider sets the language of every component: built-in labels and screen-reader text, date and number formats, plurals, and writing direction. 32 languages are bundled, and you can add your own.

Try it

Pick a language. Every built-in word below comes from the library: the empty state, the upload prompt, the month and weekday names, the currency format, and the pagination's screen-reader labels. The field labels ("Project images", "Budget") are this page's own text, so they follow the site's language, not the demo's.

locale="es" · dir="ltr"

No results for “blue sneakers”

Try a different search or clear your filters.

Drop files here or browse

Images.

octubre de 2026

lunmarmiéjueviesábdom
tsx
import es from "@vjdesigns/vjdesigns-ui/locales/es";

<LocaleProvider locale="es" messages={es}>
  <App />
</LocaleProvider>

Set the language

Wrap your app in LocaleProvider with a locale and its messages. Each language is a separate import, so your app only downloads the ones it uses. Without a provider, components use English text and the browser's date and number format.

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import es from "@vjdesigns/vjdesigns-ui/locales/es";

<LocaleProvider locale="es" messages={es}>
  <App />
</LocaleProvider>

LocaleProvider sets the built-in text, date and number formats, plural rules, writing direction, and the lang attribute (so screen readers pronounce the text correctly). Menus, dialogs and tooltips keep the language of the area that opened them.

What gets translated

The library translates only its own built-in text. Text your app passes in, like <Button>Save</Button>, is your content: translate it with your app's i18n library (react-i18next, FormatJS and so on).

What LocaleProvider translates
TextTranslated?
Text your app passes in, like button labels and field labelsNo: your app translates it
Built-in names, like "Close", "Next page", "Clear search"Yes: "Schließen", "Nächste Seite", "Suche löschen"
Screen-reader announcements, like "3 results available"Yes: "3 Ergebnisse verfügbar"
Validation messages, empty states, file-upload promptsYes
Dates and numbersYes: "23.10.2026", "4,5"

Dates, times and numbers

Formats follow the full locale, region included, not just the language: en-US and en-GB share English text but write dates differently. Pick a region to see the date field, calendar, time field and currency change. Built-in text stays in English here, so only the formats change; add messages to translate it too. This works without any messages at all, so <LocaleProvider locale="en-GB"> alone gives British formats.

locale="en-GB"

Format: DD/MM/YYYY
Example: 14:30

October 2026

MonTueWedThuFriSatSun
tsx
// Your app gets the same values in every region:
// date: "2026-10-24", time: "14:30", price: 2500.5
<LocaleProvider locale="en-GB">
  <App />
</LocaleProvider>
What follows the locale, and how to override it
SettingExamplesOverride
Typed date format10/24/2026 (en-US), 24/10/2026 (en-GB), 24.10.2026 (de), 2026/10/24 (ja)locale on the component
First day of the weekSunday (en-US, ja, pt-BR), Monday (en-GB, de, fr), Saturday (ar-EG)weekStartsOn
Month and weekday namesOctober, Oktober, octobre, 10月locale on the component
12 or 24 hour clock2:30 PM (en-US), 14:30 (en-GB, de, ja)hourCycle
Numbers and currency€2,500.50 (en), 2.500,50 € (de), 2 500,50 € (fr)formatOptions on NumberInput

Values never change with the locale or time zone: a date is always "2026-10-24" and a time "14:30", so your server and database see one format. People can type the local format or an ISO date in any region. The typed field uses the Gregorian calendar and Western digits (0 to 9) everywhere, so dates stay easy to enter and to check.

Bundled languages

English is built in. These 31 languages ship with the package; import each from @vjdesigns/vjdesigns-ui/locales/<code>.

  • ar Arabic
  • bn Bengali
  • cs Czech
  • da Danish
  • de German
  • el Greek
  • es Spanish
  • fa Persian
  • fi Finnish
  • fr French
  • he Hebrew
  • hi Hindi
  • hu Hungarian
  • id Indonesian
  • it Italian
  • ja Japanese
  • ko Korean
  • nb Norwegian Bokmål
  • nl Dutch
  • pl Polish
  • pt-BR Portuguese (Brazil)
  • ro Romanian
  • ru Russian
  • sv Swedish
  • th Thai
  • tr Turkish
  • uk Ukrainian
  • ur Urdu
  • vi Vietnamese
  • zh-Hans Chinese (Simplified)
  • zh-Hant Chinese (Traditional)

The translations are machine-generated and haven't been reviewed by native speakers yet. If a phrase is wrong or awkward, override it (below) and report it so the bundled locale can be fixed.

Change a few strings

Pass only the strings you want to change. Providers nest, so an inner provider can also switch the language for one part of the page. Per-component props such as clearLabel or labels still win over the provider.

tsx
// Change just a few strings; everything else falls back to the
// outer provider's language (English at the top).
<LocaleProvider locale="en-GB" messages={{ pagination: { next: "Onwards" } }}>
  <App />
</LocaleProvider>
tsx
// Providers nest: one section of the page can use another language.
<LocaleProvider locale="en">
  <Header />
  <LocaleProvider locale="fr" messages={fr}>
    <FrenchStorefront />
  </LocaleProvider>
</LocaleProvider>

Add another language

For a language that isn't bundled, write a complete Messages object, using English as the template. plural(locale) picks the right plural form for any language; # is the formatted number.

tsx
import { en, plural, type Messages } from "@vjdesigns/vjdesigns-ui";

const p = plural("sw");

// Start from English; TypeScript flags any string you miss.
export const sw: Messages = {
  ...en,
  pagination: { ...en.pagination, next: "Ukurasa unaofuata", previous: "Ukurasa uliopita" },
  searchInput: {
    ...en.searchInput,
    results: (count) => p(count, { "=0": "Hakuna matokeo", one: "Tokeo #", other: "Matokeo #" }),
  },
  // ...
};

Switch language at runtime

List your languages as loaders so each one downloads only when it's picked. This page's demo works this way.

LocalizedApp.tsxtsx
import { useEffect, useState } from "react";
import { LocaleProvider, type Messages } from "@vjdesigns/vjdesigns-ui";

// Each language downloads only when someone picks it.
const loaders: Record<string, () => Promise<{ default: Messages }>> = {
  es: () => import("@vjdesigns/vjdesigns-ui/locales/es"),
  fr: () => import("@vjdesigns/vjdesigns-ui/locales/fr"),
  ar: () => import("@vjdesigns/vjdesigns-ui/locales/ar"),
};

export function LocalizedApp({ lang }: { lang: string }) {
  const [messages, setMessages] = useState<Messages>();

  useEffect(() => {
    const load = loaders[lang];
    if (load) load().then((mod) => setMessages(mod.default));
    else setMessages(undefined); // English
  }, [lang]);

  // Until a language loads, the previous one (or English) shows.
  return (
    <LocaleProvider locale={lang} messages={messages}>
      <App />
    </LocaleProvider>
  );
}
tsx
// The library never guesses the language. To follow the browser's,
// pass it in yourself (with the matching messages):
<LocalizedApp lang={navigator.language} />

Right-to-left languages

Arabic, Hebrew, Persian and Urdu get dir="rtl" automatically: layouts mirror, and arrow keys follow the reading direction. Pass dir to override it. Pick العربية or עברית in the demo to see it. Spacing tokens use logical properties, so your own styles mirror too if you use margin-inline-start rather than margin-left; see Design tokens.

Read the current language

useLocale() returns the locale and direction from the nearest provider, and useMessages() the built-in strings, for your own components that need them.

tsx
import { getLocaleDirection, useLocale, useMessages } from "@vjdesigns/vjdesigns-ui";

function Toolbar() {
  const { locale, dir } = useLocale(); // "ar", "rtl"
  const messages = useMessages();     // the built-in strings in effect
  // ...
}

// For server rendering, set lang and dir on <html> yourself:
const dir = getLocaleDirection("he"); // "rtl"

LocaleProvider API

LocaleProvider props
PropTypeDefault
localeRequiredNew in 1.3.0

BCP 47 language tag, e.g. "es", "pt-BR", "ar". Sets lang on the wrapper and the locale for dates, numbers, and plurals in every component.

string—
messagesNew in 1.3.0

Built-in strings for the language, e.g. import es from "@vjdesigns/vjdesigns-ui/locales/es". Partial messages are merged over the outer provider's (English at the top), so you can also override just a few strings. Leave unset to keep the outer messages.

PartialMessages—
dirNew in 1.3.0

Writing direction. Defaults to the locale's: "rtl" for Arabic, Hebrew, Persian, Urdu, and other right-to-left languages.

"ltr""rtl"—
childrenNew in 1.3.0ReactNode—