Implementing UI text localization

To allow your application to support different languages:

  1. In the resource file for your application, use unique symbolic IDs, also known as a logical name, for all UI texts that need to appear on the screen.

    Note: The Symbian platform provides some unique symbolic IDs that you can use in your code, which means that the UI texts used for these IDs match those used elsewhere in the device. Do not define any values for these symbolic IDs.

  2. For each language your application supports, create a resource file as follows:

    1. Create a text file with the extension lNN, where NN is a two digit number that matches the Symbian platform language code for your target language.

      The file naming suggestion reflects the Symbian platform convention, Symbian platform uses <application_name>_NN.rls.

    2. Define all the symbolic IDs using the following syntax:

      #define symbolicID "value in target language"

      Each symbolic ID must be on its own line.

    3. Repeat for each supported language.

  3. Create a file to include the compiled localization files in your resource file, as follows:

    1. Create a text file with the extension loc.

      The file naming suggestion reflects the Symbian platform naming convention, Symbian platform uses <application_name>.rls.

    2. Add #ifdef, #elif, and #include statements for including the appropriate languages in your application resource files. An example syntax is as follows:

      #ifndef __LOCALIZATION_LOC__
      #define __LOCALIZATION_LOC__
                                  
      #ifdef LANGUAGE_SC			// language code for default
      #include "..\data\localization.l01"
      
      #elif LANGUAGE_01			// language code for UK
      #include "..\data\localization.l01"
      
      #endif 
      #endif
  4. Include your loc file in your resource file.

  5. Add your supported language codes to the LANG statement in your project mmp file.

  6. Build your resource files

    Note: Some IDEs do not fully support building resource files for different languages, so you may need to use the command line interface of the Symbian build chain.

  7. Include the appropriate compiled resource files in your deployment package.

The following localization strategies are available:

  • Create an installation package for each language your application supports and add only the appropriate compiled resource file to the package.

  • Create an installation package that includes support for more than one language, which means there is more than one compiled resource file in the package. The mobile device user selects the desired language upon installation, and only the compiled resource file is installed.

  • Create an installation package that includes support for more than one language, which means there is more than one compiled resource file in the package.