Localizing an application


You can enable localization for your bundle and applications (definitions and data). After you localize a bundle, users can view the application user interface (UI) and error messages in the localized language.

Localization files

After you generate a bundle from the archetype, the following files are automatically created in the application project:

  • localized-strings.json (located at bundle\src\main\webapp\resources\i18n)
  • localized-strings.properties (located at bundle\src\main\resources)

For more information about Projects created by the archetype, see Creating-a-Project-using-Maven-and-the-Archetype.


Supported languages

English (EN) is the default language of the BMC Helix Innovation Studio application. You can localize your application in any of the following languages to translate error messages, warning messages, and static strings on your application UI:

  • French—fr
  • German—de
  • Italian—it
  • Japanese—ja
  • Korean—ko
  • Portuguese (Brazil)—pt-BR
  • Russian—ru
  • Simplified Chinese—zh-CN  
  • Spanish—es
  • Dutch—nl
  • Swedish—sv
  • Danish—da 
  • Norwegian—no
  • French (Canada)—fr-CA 
  • English(Canada)—en-CA
  • Thai—th

Before you begin

Before you begin with the localization of your application, make sure that the application is localizable. To make your application localizable, extract the strings that you want to localization from your application code and definitions:

  • Extract the Java-based string in the localized-strings.properties file.
  • Extract the JavaScript-based strings in the localized-strings.json file.

To localize definition-based strings

The following video gives you information to localize your application. The video shows an older version of BMC Helix Innovation Studio. Although there might be minor changes in the UI, the overall functionality remains the same:



icon_play.png https://youtu.be/KcsJPaeI510

  1. Mark the custom view component properties (like field labels, column labels, action button labels, and so on) as localizable:
    1. Navigate to the <view-component-name>.config.js file located in the view-components/<view-component-name> folder.
    2. Mark the view component properties as localizable by setting them as true.
      The following sample code shows how to configure a view component as localizable:

      rxViewComponentProvider.registerComponent([
             {
                  name: 'Display Greetings',
                 group: 'Hello World Components',
                  icon: 'speaker',
                 type: 'rx-greeting',
                  designType: 'rx-greeting-design',
                  propertiesByName: [
                     {
                          name: 'greeting',
                         type: 'string',
                          isRequired: true,
                          isConfig: true,
                          isProperty: true,
                          localizable: true
                     }
                  ]
             }
          ]);
  2. Navigate to the application parent directory and run the following command to redeploy your application:

    mvn clean install Pexport -Pdeploy
  3. In BMC Helix Innovation Studio, if you have created any view definition using the custom view component, you must create the view definition again (this step is required because you would have changed the source code for the view component in Step 1).
  4. Apply translations.

To localize Java-based strings

  1. In the localized-strings.properties file, located at bundle\src\main\resources, add the strings that you want to localize.
  2. Go to the application parent directory and run the following command to import the strings from the localized-strings.properties file to BMC Helix Innovation Studio :

    mvn clean install -Plocalization
  3. Apply translations.

To localize static strings

To localize any static strings in your application code, apply the localization filter to all static HTML strings. To retrieve localized strings, use the localization service.

The following code snippet is an example for using the translate filter:

<input type="search" id="search" class="d-navigation__search-item" placeholder="{{'rx.core.components.search-field.searchbox.placeholder' | translate}}"/>

The following code snippet is an example for using the $translate service:

$translate([
  'tms.approvals.myApprovals.title',
  'tms.approvals.myApprovals.subtitle'
]).then(function (translations) {
    $scope.title = translations['tms.approval.myApprovals.title'];
    $scope.subtitle = translations['tms.approval.myApprovals.subtitle'];
});

Important

Make sure that the string localization key is in the following format:

modulename.componentname.subpart.type.label (modulename.componentname is required)

For example, "tms.approvals.actionbar.action.approve" : "Approve"

To localize OOTB view component definitions

As an application business analyst, you can customize a view definition and localize it by using BMC Helix Innovation Studio. For example, you can edit or create view definitions and then localize your application. 

  1. Log in to BMC Helix Innovation Studio, and through Workspace, navigate to the application for which you want to customize definitions.
  2. Customize the definitions according to your requirements and save the definitions.
  3. Apply translations.

To localize record instances

You can localize record instances by using the locale field. The field ID of the locale field is 160.

  1. Localize the server.
    • In a browser, log in to Mid Tier and open the Action Request System Administration Console.
    • Navigate to General > Server Information > Advanced, and enable Localized Error Messages (Localize Server).
  2. Create a text field with field ID 160 in the record definition for which you want to localize record instances.
  3. Create record instances and provide valid values for the locale fields.

Important

When you use a record definition with a locale field in a view component such as a record grid, only the record instances for the accepted locale are displayed.

To apply translations

  1. In BMC Helix Innovation Studio, in your application, navigate to Translations > Download Translations and download the localized-strings.json file.
    The following example shows a localized-strings.json file:

    {
    "7a97b657-0162-426b-9df9-78e35d0fde6a":"Welcome"
    }
  2. Translate the localized-strings.json file in the following format:

    {
    "fr" : {
    "7a97b657-0162-426b-9df9-78e35d0fde6a":"Bienvenue"
    },
    "de": {
    "7a97b657-0162-426b-9df9-78e35d0fde6a":"
    Willkommen
    "

    }
    }
  3. In BMC Helix Innovation Studio, navigate to Translations > Upload Translations and upload the translated localized-strings.json file.

To localize error messages

To localize the error messages, perform the steps listed in the To localize Java-based strings section.