Saltar al contenido principal

Internacionalización

El SDK incluye tablas en inglés (en) y español (es). Para ajustes de copy puntuales, sobrescribe strings individuales con <RiftProvider strings={{...}}>. Para agregar un locale completo, extiende las tablas incluidas.

Orden de resolución

useLocale().t(key, params?) resuelve cada clave en este orden:

  1. Override del consumidor en <RiftProvider strings={...}>.
  2. Tabla incluida para el subtag primario del locale resuelto ("es-MX" -> "es").
  3. Tabla incluida en inglés.
  4. La clave literal, como indicador visible de "missing string" durante desarrollo.

El locale activo se negocia en useLocale():

  1. <RiftProvider locale="...">, si coincide con config.locales.supported.
  2. El subtag primario de ese locale ("es-MX" -> "es"), si está presente en supported.
  3. config.locales.default.
  4. "en" como fallback final.

Sobrescribir strings individuales

La mayoría de los consumidores solo necesitan ajustar unas cuantas etiquetas. Pásalas al provider:

<RiftProvider
locale="es-MX"
strings={{
"reservation.reserve": "Apartar boletos",
"checkout.confirm": "Pagar ahora",
"captcha.actionVerify": "Verifica que no eres un bot",
}}
>
{children}
</RiftProvider>

Los overrides aplican globalmente al subárbol. También siguen disponibles los overrides por componente mediante sus props de etiqueta, por ejemplo <ReserveButton label="..."> o <CheckoutForm submitLabel="...">.

Interpolación de placeholders

Las claves con segmentos {placeholder} reciben sustituciones mediante el argumento params de t():

t("ticketRow.increment", { name: "VIP" });
// -> "Add one VIP ticket"

Cuando sobrescribas una clave que toma placeholders, conserva los mismos nombres. El SDK hace match por nombre exacto.

Agregar un locale nuevo

Para un locale de terceros, publica overrides por clave mediante la prop strings. La tabla debe implementar cada clave de StringKey, el set canónico del SDK. TypeScript lo valida en el código fuente.

import { type StringsTable } from "@feelrift/react";

const fr: StringsTable = {
"event.hostedBy": "Organisé par {name}",
"event.dateRangeLabel": "Quand",
"event.locationLabel": "Où",
"event.organizerLabel": "Organisateur",
"reservation.reserve": "Réserver",
// ...every other key in StringKey
};

<RiftProvider locale="fr-FR" strings={fr}>
{children}
</RiftProvider>;

Cuando uses un locale fuera de los incluidos (en / es), el SDK cae a inglés en cualquier clave no provista. Tipar los overrides como StringsTable ayuda a detectar claves faltantes en compile time.

Catálogo de claves

Cada clave que expone el SDK. Los placeholders se muestran en {braces}. Los valores de la columna "Default en inglés" se mantienen en inglés porque son la tabla base del SDK.

Event header

ClaveDefault en inglésNotas
event.hostedByHosted by {name}Prefijo de la fila de organizador.
event.dateRangeLabelWhenEtiqueta <dt> visualmente oculta.
event.locationLabelWhereEtiqueta <dt> visualmente oculta.
event.organizerLabelOrganizerEtiqueta <dt> visualmente oculta.

Reservation

ClaveDefault en inglés
reservation.reserveReserve
reservation.reservingReserving…
reservation.expiresInExpires in {remaining}
reservation.expiredReservation expired
reservation.priceChangedTitlePrice has changed
reservation.priceChangedDetailThe total updated from {oldTotal} to {newTotal} between reservation and checkout.
reservation.priceChangedAcceptAccept new price
reservation.priceChangedCancelCancel

Ticket row

ClaveDefault en inglésNotas
ticketRow.fromPriceFrom {price}Display del tier más barato.
ticketRow.remaining{count} leftSe muestra cuando showRemaining está activo.
ticketRow.soldOutSold out
ticketRow.incrementAdd one {name} ticketaria-label del botón de incremento.
ticketRow.decrementRemove one {name} ticketaria-label del botón de decremento.

Estimate / breakdown

ClaveDefault en inglés
estimate.subtotalSubtotal
estimate.grandSubtotalSubtotal
estimate.totalTotal
estimate.colQuantityQty
estimate.colItemItem
estimate.colPricePrice
estimate.disclaimerWe pick the cheapest available tier first. Final price (including any fees) is confirmed when you reserve.
estimate.emptyPick tickets to see the breakdown.

Checkout

ClaveDefault en inglés
checkout.emailLabelEmail address
checkout.emailPlaceholderyou@example.com
checkout.confirmConfirm and pay
checkout.confirmFreeConfirm
checkout.confirmingConfirming…
checkout.resumingResuming checkout…
checkout.windowClosedThe checkout window for this reservation has closed.
checkout.missingReturnUrlThis checkout requires a return URL but none was configured. Contact the organizer if this persists.

Captcha

ClaveDefault en inglés
captcha.statusIdleCaptcha required
captcha.statusSolvingSolving captcha…
captcha.statusSolvedCaptcha solved
captcha.statusErrorCaptcha failed
captcha.actionVerifyVerify you're human
captcha.actionRetryTry again

Auth

ClaveDefault en inglés
auth.signInSign in
auth.signOutSign out
auth.signingInSigning in…
auth.alreadySignedInAlready signed in.

Orders

ClaveDefault en inglés
orders.titleYour orders
orders.emptyYou don't have any orders yet.
orders.loadingLoading your orders…
orders.errorCouldn't load your orders.

Errors

ClaveDefault en inglés
error.genericSomething went wrong. Please try again.
error.rateLimitedToo many requests. Try again in {seconds} seconds.
error.insufficientInventoryThese tickets are no longer available.

Relacionado