Skip to content

Internationalization (i18n)

Internationalization (i18n)

Planned

Current Workarounds

While full i18n support is planned, you can implement localization in your application:

Custom Text with Theme

import { PricingTable, useQZPayTheme } from '@qazuor/qzpay-react';
// Create a wrapper component with your own i18n
function LocalizedPricingTable() {
const { t } = useYourI18nLibrary(); // Your i18n solution
return (
<div>
<h2>{t('pricing.title')}</h2>
<PricingTable
onSelectPlan={(plan, price) => handleSelect(plan, price)}
selectedPlanId={currentPlan}
currency="usd"
interval="month"
/>
</div>
);
}

Currency Formatting

Use the browser’s Intl API for currency formatting:

function formatCurrency(amount: number, currency: string, locale: string): string {
return new Intl.NumberFormat(locale, {
style: 'currency',
currency: currency.toUpperCase()
}).format(amount / 100); // Convert from cents
}
// Usage
formatCurrency(9900, 'usd', 'en-US'); // "$99.00"
formatCurrency(9900, 'eur', 'es-ES'); // "99,00 €"
formatCurrency(9900, 'ars', 'es-AR'); // "$ 99,00"

Date Formatting

function formatDate(date: Date, locale: string): string {
return new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(date);
}
// Usage
formatDate(new Date(), 'en-US'); // "January 9, 2024"
formatDate(new Date(), 'es-ES'); // "9 de enero de 2024"

Planned i18n Features

The following features are on our roadmap:

Provider Configuration (Planned)

import { QZPayProvider } from '@qazuor/qzpay-react';
import { esMessages } from '@qazuor/qzpay-react/locales/es';
function App() {
return (
<QZPayProvider
billing={billing}
locale="es"
messages={esMessages}
>
<YourApp />
</QZPayProvider>
);
}

Planned Locales

LocaleLanguageStatus
enEnglish (default)Built-in (current)
esSpanishPlanned
ptPortuguesePlanned

Planned Message Keys

Subscription Messages

KeyDefault (English)
subscription.status.activeActive
subscription.status.trialingTrial
subscription.status.past_duePast Due
subscription.status.canceledCanceled
subscription.status.pausedPaused
subscription.cancel.buttonCancel Subscription
subscription.cancel.confirmAre you sure?
subscription.upgrade.buttonUpgrade
subscription.downgrade.buttonDowngrade

Payment Messages

KeyDefault (English)
payment.status.pendingPending
payment.status.succeededSucceeded
payment.status.failedFailed
payment.error.declinedCard declined
payment.error.expiredCard expired
payment.error.insufficientInsufficient funds
payment.button.payPay Now
payment.button.retryRetry Payment

Component Messages

KeyDefault (English)
pricing.popularMost Popular
pricing.currentCurrent Plan
pricing.selectSelect Plan
invoice.downloadDownload
invoice.viewView Invoice

Contributing Translations

We welcome community contributions for translations. When i18n is implemented, you’ll be able to contribute translations via:

  1. Fork the repository
  2. Create locale file in packages/react/src/locales/
  3. Translate all message keys
  4. Submit a pull request

Feature Request

If i18n is a priority for your project, please upvote or comment on the i18n feature request on GitHub to help us prioritize development.