Adding support for a language to an Aurora-based store with REST API
With the language added to HCL Commerce, you can now add the language
to the list of supported languages for your asset stores and customer-facing store. You
can then select to view your store in the new language. However, the text for your store will still
display in the default language. You customize your storefront text to display in the new language
in the next lesson.
Procedure
- Compose the REST API request to add the language to a specific store.To compose the API call you need the following details for identifying the store and language:
- The store ID. This ID identifies the store where you are adding the support for the language.
- The language ID. This ID must be a negative integer. This ID is used to identify the language locale within HCL Commerce.
If you want to add the language to an extended sites store, you need to complete multiple POST calls. You need to first add the language to the asset stores for the extended sites store and then add the language to the extended site store itself. Add the language to these stores in the following sequence- Storefront asset store
- (Optional) Catalog asset store. Add the language to the catalog asset store if you need to add catalog descriptions in the new language to be shared by multiple extended site stores.
- Extended sites store.
When you are adding languages to a store you need to use the following Administrative REST API:- Store languages (https://localhost:443/rest/admin/v2/store-languages)
The body of the call to add the language to the storefront and catalog asset stores and to an extended site store can resemble the following body structure:{ "items": [ { \"storeId\":{{storeAssetStroreId}}, \"languageId\":\"{{langId}}\" \"currency\": null\ }, { \"storeId\":{{catalogAssetStoreId}}, \"languageId\":\"{{langId}}\" \"currency\": null\ }, { \"storeId\":{{esiteStoreId}}, \"languageId\":\"{{langId}}\" \"currency\": null\ }, ] }
- Run your REST API calls add the language to your store.To run your REST API calls, you can bundle your REST calls into a JSON collection with the API calls for adding the language to HCL Commerce to run all the calls in sequence. The following collection shows how to bundle the API calls for adding a language. The collection also includes the calls needed to build the index so you can view your changes in the storefront.To use this collection, you need to define the environment variables for the API. The API calls within the collection are structured with variables. The values that are used for the variables can be included within a separate JSON file. The following file includes sample values for defining the Dutch Netherlands language for the default Aurora storefront and catalog asset stores and an extended site store. Replace the sample values that are set within the file with the values for the stores and the language that you are adding to your environment. You can then use the collection and values files to run the API requests to add the language.Note: If you need to delete a language, you can use the same REST API.
- Verify that your language is added to HCL Commerce and your
store.