Creating New General Resource Files

“General” resource files are resource files that contain strings used throughout the application.

Procedure

  1. Open the following file in your local development environment:
       ...\JSXAPPS\base\locale\locale.xml
  2. Ensure that the language code for the resource file you are adding is listed in the locales attribute:
    <?xml version="1.0" encoding="UTF-8"?>
    <data jsxnamespace="propsbundle"
          locales="de,es,es_ES,es_MX,fr,fr_FR,fr_CA,id,ja,ko,pl,pt,pt_BR,ru,th,tr,vi,zh,zh_CN,zh_HK,zh_TW,en_GB">
       <locale>
           .
           .
           .

    A number of the likely used language codes are included in the locales attribute by default. If the code for the language you are adding in not already there, add it.

    For a list of language codes, see:

    http://www.loc.gov/standards/iso639-2/php/English_list.php

    Note: Also see Removing Unneeded Locale Keys for information about removing the locale keys for unused locales to improve performance.
  3. Save the changes (if any) to the locale.xml file, but don’t close it yet.
  4. Navigate to the following directory:
       ...\JSXAPPS\base\locale\
  5. Determine if a resource file exists for the language you are adding (for instance, if you are adding Spanish, or a country-specific Spanish, you need a resource file with the name locale.es.xml)—various language resource files with no text strings in them are included by default. These can be used as a starting point for adding your own resource file.
    1. If the needed resource file exists, open it.
    2. If the needed resource file does not exist, copy one of the other ones that does exist (one of those without text strings yet), change the file name to include the appropriate language code (for example locale.es.xml for Spanish), then open it.
  6. From the locale.xml file that you still have open from Step 1, copy all of the text string records, including the <locale> and </locale> elements:
  7. Paste the copied strings into the new resource file that you opened or created in step 5 (for example, locale.es.xml), inside of the existing <data> and </data> elements:
  8. Inside of the <locale> element in the new resource file, add a key attribute and set its value to the language code for the language you are adding. For example, if you are adding Spanish, add key=”es”:
    <?xml version="1.0" encoding="UTF-8"?>
    <data jsxnamespace="propsbundle">
    <locale key="es">
        <!-- tool tip text -->
        <record jsxid="tipAdd" jsxtext="Add the selected item(s)"/>
        <record jsxid="tipAddAccessSet" jsxtext="Create a new privi
           .
           .
           .
  9. Translate the value of every jsxtext attribute in the newly created resource file to language-specific values.

    Note that any record elements that are removed from the new language resource file will cause the application to “fall back” to the strings specified in the default English (United States) locale.xml file.

  10. Optionally, localize the new language resource for specific countries. The purpose of localizing for specific countries is to provide a mechanism for overriding default language text values (translated in step 9) with text values that are specific for a country and that differ from the default.

    For each country-specific locale, create a <locale> element (within the root <data> element) and specify the language code and country code (ll_CC) as the value of the key attribute, then insert record elements into each new <locale> element that are to “override” default language records, with matching jsxid attribute values. For example:

    <data jsxnamespace="propsbundle"
        <locale key="es">
          <!-- DEFAULT LANGUAGE RECORD ELEMENTS HERE -->
           .
           .
           .
    <record jsxid="txtOpen" jsxtext="Abierto"/>
           .
           .
           .
    </locale>      
        <locale key="es_ES">
          <record jsxid="txtOpen" jsxtext="override value for Spain"/> 
        </locale>
        <locale key="es_MX">
          <record jsxid="txtOpen" jsxtext="override value for Mexico"/>
        </locale> 
    </data>
  11. Save the newly created resource file.
  12. Close the new resource file and locale.xml.