Customizing the store to display text for a new language

With the new language added to the store, you need to customize your store pages to actually display text in the new language.

Procedure

  1. Create the resource bundle to define the text that is displayed on your storefront widgets.
    1. Within your programming environment workspace, go to the crs-custom-web\WebContent\WEB-INF\classes\com\ibm\commerce\stores\widget\properties directory.
    2. Create a widgettext_locale.properties file within the properties directory, where locale is the locale for your new language.
      For example, widgettext_nl_NL.properties, where "nl_NL" is the locale for the (Dutch Nederlands) language.

      To create your new properties file, you can copy and use the sample widgettext_en_US.properties file that is included within the SDK_workspace_dir\crs\crs-ibm-web.war\Widgets_801\Properties directory. You can access the file with a file browsing utility.

  2. Create the properties files for displaying text in your new language on your store pages.
    1. Within your programming environment workspace, go to the crs-custom-web\WebContent\WEB-INF\classes\CustomStoreSAS directory, where CustomStoreSAS is the directory for your custom storefront asset store.
    2. Create a custom version of the following properties for the new language.
      • Address_locale.properties
      • AddressText_locale.properties
      • OrgEntity_locale.properties
      • OrgEntityText_locale.properties
      • RemoteWidgetText_locale.properties
      • storeErrorMessages_locale.properties
      • storetext_v2_locale.properties
      • UserRegistration_locale.properties
      • UserRegistrationB2B_locale.properties
      • UserRegistrationText_locale.properties
      Where locale is the locale for your new language. For example, widgettext_nl_NL.properties, where "nl_NL" is the locale for the (Dutch Nederlands) language. Depending on your store requirements and structure, the properties files that you need to create can be different.

      Include the new properties files within the same CustomStoreSAS directory. Use the sample properties files that are provided for the default supported languages as templates for creating your own properties files. Stores that are based on the Aurora store include sample properties files and other store files that are created to display text for the supported languages. You can add storefront messages and text in other languages by creating and customizing properties files for the store.

  3. Replace the translatable text within your properties files to include the text for your store within the new language that you need to support.
  4. Generate the locale and js files for the new language.
    1. Go to the crs-custom-web\WebContent\CustomStoreSAS\nls directory.
    2. Create a copy of the en and en_US folders within the nls directory.
      For example, crs-custom-web\WebContent\CustomStoreSAS\nls\nl_NL
    3. Rename the copied files and folders so that the new file names include the language code and locale for your new language.
      For example, nl and nl_NL for the Dutch Nederlands language.
    4. Remove the nls file from within each of your new folders.
    5. For each of your new folders, update any included NumberFormattingData.js and StoreText.js files.
  5. Rebuild your store code to generate the nls.js JavaScript file for the new language.
    1. Open the crs-custom-web\Gruntfile.js for editing.
    2. Add your new language to the "localesforJs".
      For example, "nl" and "nl_NL".
    3. Configure and run the command to rebuild your store code.

    Verify that your nls.js files are generated.

  6. Optional: Set the SEO URL Keyword to define the store token for your new language.

    If you want to display SEO URL keywords in your new language, you need to add the SEO URL keyword for the store token for your new language. SEO URL keywords display for a store language only when a store token SEO URL keyword exists for that language.

    If you want the language that you are adding to be the default language for your store, you need to add the SEO URL keyword for the store token for your new language. When a shopper browses you store, the store tries to find the SEO URL keywords for the language that is being used by the shopper. If the store cannot find the keywords by searching for the store token keyword, the store defaults to displaying the URL keywords for the default language. If your store uses a language other than United States English as the default language, you need to configure a store token to reference your preferred language so that your store can default to your preferred language and URL keywords.

  7. If your are adding the language within your developer environment, restart the Store server in Eclipse.
    You do not need to complete this step when you are adding languages within your runtime environments.

What to do next

When a language is added to a store, your business users and developers must add text and content for that language. Text and content need to be created or updated for the new language for any catalogs, categories, products, SKUs, attributes, advertisements, images, or other object that includes language-sensitive content or properties that need to display in that language.
  • Add text and content in other languages with Management Center.

    When business users are working with different Management Center tools, they can select the input language for entering content in other languages for any language-sensitive properties, such as product names and descriptions and marketing content. Users can also upload descriptions in different languages for catalog objects with the catalog upload feature in the Catalogs tool.

  • Add text in other languages through API.

    Developers can add descriptions and other language-sensitive data in different languages directly to an environment database through REST API calls. To add this data, use the Administrative API. For more information, see Administrative REST API.