HCL Commerce Version 9.1.17.0 or later

Multiple language and currency support

The HCL Commerce Next.js store applications (Ruby and RubyB2B) support multiple languages and currencies. Users can view content and pricing in their preferred language and currency.

Multiple language support

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

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

Note: Next.js store uses the languageCode_countryCode.

Here is an example of the Next.js i18n configuration. The locale 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 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 HCL Commerce.

Multiple languages support
  • Supported locale 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 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 specified in the URL (this defaults to the store default language configured in HCL Commerce)

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

    • If the user has a valid session with a preferred language, the request redirects to that locale. For example, if the user's 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. For example, if United States English is set as the default language in HCL Commerce for the store, the request redirects to https://www.store.com/en-us/myruby.

When a user changes their preferred language, the user's context is updated with the selected language, and the URL updates to match the corresponding locale.

Multiple currency support

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

Note: In the store header, users 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 the user’s selections across all pages. The option to select language and currency is available in the top right corner of the page.