Labels

Every string the library says out loud lives in one place. A component that hard-codes "Previous slide" is an English component, and this library exists to build products that are not in English.

Usage

Wrap the app once and override only what you are translating; anything you leave out falls back to the English default.

tsx
import { LabelsProvider } from '@ceebee/ui/client';
<LabelsProvider  labels={{    dismiss: 'Tutup',    previousSlide: 'Slide sebelumnya',    nextSlide: 'Slide berikutnya',    goToSlide: (index) => `Ke slide ${index}`,    previousPage: 'Halaman sebelumnya',    nextPage: 'Halaman berikutnya',    pageSummary: (from, to, total) => `${from}${to} dari ${total}`,    chooseFiles: 'Pilih berkas',    dropFilesHere: 'atau jatuhkan di sini',    back: 'Kembali',    next: 'Lanjut',    done: 'Selesai',    skip: 'Lewati',  }}>  <App /></LabelsProvider>

What it covers

AreaStrings
Overlaysdismiss, close
CarouselpreviousSlide, nextSlide, goToSlide(index)
PaginationpreviousPage, nextPage, page(index), pageSummary(from, to, total)
Date and timechooseDate, chooseTime, previousMonth, nextMonth
FileschooseFiles, chooseFile, dropFilesHere, dropFileHere, removeFile(name)
Numbersincrease, decrease
AutoCompleteclear, open
ShellexpandNavigation, collapseNavigation
Tourback, next, done, skip, progress(current, total)

Do

Pass functions for anything with a number in it — word order differs between languages, and a template built from fragments cannot follow it.

Don't

Translate by wrapping components; the strings a component says are its own business, not the call site's.

Props

PropTypeDefaultNotes
labelsPartial<Labels>Only what you are replacing. The rest fall back to English.
useLabels()() => LabelsRead the resolved set inside your own components.
DEFAULT_LABELSLabelsThe English defaults, exported so you can diff against them.

A Tour's own labels prop still wins over the provider, because one tour may speak differently from the rest of the product.