Multiple language and currency support

Ruby storefronts (B2C and B2B) support multiple languages and currencies. You can view content and pricing in their preferred language and currency.

Multiple language support

To enable multiple language support in Ruby storefronts (B2C and B2B):
  • Manually build the index if it is not triggered automatically after setting up the languages.
  • Configure the i18n settings in your Next.js application to reflect the configured languages. Ensure all the languages configured in the Commerce+ Store Management tool are included in your Next.js i18n configuration.

  • Refer to the Next.js official guide at https://nextjs.org/docs/pages/building-your-application/routing/internationalization.

Note: Next.js store uses the languageCode_countryCode.

For more information about Multiple languages, see Multiple languages for the Ruby storefront.

Here is an example of the Next.js i18n configuration. The locale language codes are in lowercase to create user-friendly URLs in the Next.js store, such as www.store.com/en-us/furniture.

i18n: {
                locales: [
                        'default',
                        'de-de',
                        'en-us',
                        'es-es',
                        'fr-fr',
                        'it-it',
                        'ja-jp',
                        'ko-kr',
                        'pl-pl',
                        'pt-br',
                        'ro-ro',
                        'ru-ru',
                        'zh-cn',
                        'zh-tw',
                ],
                defaultLocale: 'default',
                localeDetection: false,
        },

Locale language detection scenario
Single language support

If the store supports only one language, it always displays content in that language. In this case, the Next.js store application uses the defaultLocale, which maps to the store default language configured in Commerce+.

Multiple languages support
  • Supported locale language in the URL

    The store page is displayed in the language specified in the URL, for example, https://www.store.com/en-us/myruby.

  • Unsupported or unrecognized locale language in the URL

    The client receives a 404 response. For example, if zh-tw is not supported, the URL https://www.store.com/zh-tw/myruby results in a 404 response.

  • No locale language specified in the URL (this defaults to the store default language configured in Commerce+)

    For example, https://www.store.com/myruby

    • If you have a valid session with a preferred language, the request redirects to that locale language. For example, if your preferred language is United States English, the request redirects to https://www.store.com/en-us/myruby.
    • If no user session exists, the request redirects to the store default locale language. For example, if United States English is set as the default language in Commerce+ for the store, the request redirects to https://www.store.com/en-us/myruby.

When you change your preferred language, your context is updated with the selected language, and the URL updates to match the corresponding locale language.

Multiple currency support

When you changes your currency preference, the currency is updated in your context and applied to product and category requests sent to the Search server. This ensures that the displayed prices are always in your preferred currency. Price Pending is displayed when the selected currency is not enabled for the store.

Note: In the store header, you can select their preferred language and currency from drop-down menus. They can adjust the language, the currency, or both, or they can choose to keep them unchanged. The store adjusts its content and pricing to match your selections across all pages. The option to select language and currency is available in the top right corner of the page.