Portal

i18n - internationalization

Internationalization (i18n) is configured in the file i18n.config.ts.

i18n - internationalization

Internationalization (i18n) is configured in the file i18n.config.ts.

Here is a sample i18n.config.ts file:

export default defineI18nConfig(() => ({
    legacy: false,
    locale: 'en',
    fallbackLocale: 'en',
    messages: {
        en: {
            // ...
            pricing_client: {
                month: "month",
                year: "year",
                buy_now: "Buy now",
                coming_soon: "Coming soon",
                // ...
            },
        },
        fr: {
            // ...
            pricing_client:{
                month: "mois",
                year: "an",
                buy_now: "Acheter maintenant",
                coming_soon: "Bientôt disponible",
                // ...
            },
        },
        pt: {
            // ...
            pricing_client: {
                month: "mês",
                year: "ano",
                buy_now: "Comprar agora",
                // ...
            },
        },
    ],
}))

In the paxpar source code, localized text appear with the function t():

Here is an example using the id pricing_client.coming_soon:

function checkoutButtonLabel(plan: Plan): string {
  if (plan?.checkout?.enabled) {
    // ...
  } else {
    return t("pricing_client.coming_soon");
  }
}