Localizing user interface text

You can translate Management Console (MC) user interface (UI) text with language files in the Vertica server.

You can translate Management Console (MC) user interface (UI) text with language files in the Vertica server. After you translate the UI text, users can select the language from the language selector, a dropdown located to the right of the Message Center bell icon in the MC toolbar.

The required language files include the locales.json file and the resource bundle, a directory of JSON-formatted files that contain the text strings translated into the target language.

Language files are located in the /opt/vconsole/temp/webapp/resources/i18n/lang directory.

locales.json

The locales.json file contains an array of JSON objects with a name key and properties, where each object represents a language that the MC supports. For example, the following object represents Mexican Spanish:

"es_MX": {
    "code": "es_MX",
    "name": "Spanish - Mexico",
    "country_code": "MX"
}

The preceding object provides the following information that you use to translate UI text:

  • The object name key is a two- or four-letter country code. In the preceding example, the name key is es_MX. The resource bundle name must match this country code, or the MC cannot detect the translation files.

  • The MC lists the name value in the language selector. If you translated the UI text into Mexican Spanish, the language selector would list Spanish - Mexico.

Resource bundle

The resource bundle is a directory in /opt/vconsole/temp/webapp/resources/i18n/lang that stores a collection of JSON-formatted files that contain the UI text strings that you can translate. By default, Vertica provides the following resource bundles:

  • en_US (American English)

  • zh_CN (Simplified Chinese)

Creating a custom resource bundle

To create a resource bundle, you must manually create a new directory and copy files from one of the default resource bundles. For example, to create a resource bundle for Mexican Spanish:

  1. Navigate to the directory that contains the language files:

    $ cd /opt/vconsole/temp/webapp/resources/i18n/lang
    
  2. Create a new directory named es_MX:

    $ mkdir es_MX
    
  3. Copy all files from the default en_US resource bundle into the new es_MX resource bundle:

    $ cp en_US/* es_MX
    

Text string file structure

Each JSON file in the resource bundle contains text strings for a specific section of the MC interface. For example, the homepage.json file stores text strings for the Management Console home page. Each JSON file represents MC pages and any child UI components that contain text—including subsections, tabs, and buttons—as individual objects. The file nests these pages and child components hierarchically to convey the page structure. For example, the homepage.json file uses the following structure:

{
    "homepage": {
        ...
      },
      "recentDatabase": {
        ...
      },
      "copyright": {
        ...
      },
      ...

The object properties represent the UI text as key/value pairs, where the key is the component with UI text, and the value is the text string that the MC displays in the UI.

Translating text

To translate a text string, edit the text string value. For example, to translate the title of the Recent Databases section into Spanish, open the homepage.json file in a text editor and update homepage.recentDatabase.title value:

{
    "homepage": {
        ...
        },
        "recentDatabase": {
          "title": "Bases de Datos Recientes",
          ...
}