The Journey  
Intro
The Game
Download
Forum
Paper
Contact
Help  


The Paper - Page 13 - Localization

The Workflow of C++ Game-Development on a Series 60 Platform device

Andreas Jakl, Revision 1.0, July 2004


4.4 Localization

As the name indicates, mobile phones are intended to be used in multiple locations. Therefore it is important to prepare applications for the global market and provide support for different languages. This should be considered right from the beginning, and no text should be hard coded in source files. Care should also be taken about varying text lengths in different languages [10].

4.4.1 Menus

Two areas of the application have to be customized – the menus (if the game uses the standard system menu and does not have its own implementation) and the text in the game itself. Menus are straightforward to do, however this is a lot of work if everything has to be done manually. IDEs such as Borland C++BuilderX support language localization and automate a large part of the work. The following steps are necessary to set it up manually.

  1. In the .mmp file of the project, the languages have to be defined. Example for English and German: LANG 01 03 – a list of the languages Symbian OS supports and their respective code numbers can be found in the definition of TLanguage in the file e32std.h .
  2. The resource file ( .rss ) of your application has to include a .loc file. For the game this would be: #include "journey.loc"
  3. The .loc file can either directly define the strings of the individual languages, or include an external file depending on the current language. For bigger applications that use more text, this method is recommended as it makes it easier to give out the individual language files to translators. The content should look like this:  
        #if defined(LANGUAGE_01) /* English */
        #include "Journey.l01"
        #elif defined(LANGUAGE_03) /* German */
        #include "Journey.l03"
        #else /* Default to UK English */
        #include "Journey.l01"
        #endif
    
  4. The individual .lxx files finally define the strings for the individual languages.  
        #define qtn_menu_continue "Continue Game"
        #define qtn_menu_startgame "Start New Game"
    
  5. These strings are directly used in the menu definitions of the .rss file.  
        RESOURCE MENU_PANE r_journey_view1_menu
        {
        items=
            {
            MENU_ITEM { command=EJourneyCmdContinueGame;
                        txt = qtn_menu_continue;  },
            MENU_ITEM { command=EJourneyCmdStartGame;
                        txt = qtn_menu_startgame; }
            };
        }
    
      
      The compiler will automatically create multiple resource files with the endings .r01 , .r03 , etc.
  6. Finally, the application should only be installed on the phone with the correct language. If available, the installation will automatically use the language which corresponds to the current phone language. The .pkg file based on which the .sis file is created has to define which files should be copied for the individual languages. An example:  
        {
            "\epoc32\release\armi\urel\Journey.r01"
            "\epoc32\release\armi\urel\Journey.r03"
        }  -"!:\system\apps\Journey\Journey.rsc"
    
        
    The package file also has to specify the title of the application for all languages. If you use the additional line specifying that the installation should only be compatible to a specific version of Series 60 (for example v0.9 and higher, meaning that it is compatible with all Series 60 phones), this string also has to be provided multiple times – one for each language:  
        #{"Journey", "Journey"},(0x06EE1210),1,0,0
    
        (0x101F6F88), 0, 0, 0,{"Series60ProductID",
            "Series60ProductID"}
    
    
 

4.4.2 Application text

The localized strings defined in the resource files can also be accessed from within the application, using resource readers .

  1. Again, the text has to be specified as above in the .lxx files. Those defines have to be referenced in the .rss file and are put into TBuf 's:
        RESOURCE TBUF r_areaname_00 {buf = qtn_areaname_00; }
        RESOURCE TBUF r_areaname_01 {buf = qtn_areaname_01; }
    	
        
  2. Those resources can be read and be put into TBuf 's from within the application:
        TBuf<30> textResource;
        CEikonEnv::Static()->ReadResource(textResource,
                                          R_AREANAME_00);


< File Access Part 2 Contents Bitmap Handling >
 
       
© 2004 Andreas Jakl. All Rights Reserved.
Privacy Statement | Contact and Imprint
The Journey