
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.
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.
- Supported
-
- 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.
- Unsupported or unrecognized
-
- No
locale
specified in the URL (this defaults to the store default language configured in HCL Commerce) -
For example, https://www.store.com/myruby
- No
-
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.