Google Groups Home
Help | Sign in
Recent pages and files
How to provide the Multi-Language support at runtime for Series 60.    

How to provide the Multi-Language support at runtime for Series 60.

I’m going to demonstrate how to make an application supports mutli-language at run time. In the following example I’ve used three language support, English, French and German.

Step I - Change the MMP file.

The first step is to make a modification in the MMP file. In the MMP file you can see one line like this:

 

LANG  SC


Replace that with the following line:

 

LANG  01 02 03 

Step II - Create three localization files

As we are going to give support for three languages, English, French and German, the localization file extension should be l01, l02 and l03 respectively. You can put all the strings in this localization files.

Step III - Change the LOC file.

Now you have to change the LOC file below:

 

// 01 = (British) English

#ifdef

LANGUAGE_01

#include

"MultiLang.l01"

#endif

// 02 = French

#ifdef

LANGUAGE_02

#include

"MultiLang.l02"

#endif

// 03 = German

#ifdef

LANGUAGE_03

#include

"MultiLang.l03"

#endif

Step VI - Change the YourAppAif.rss file

YourAppaif.rss should be like this to localize your application’s caption:

 

RESOURCE AIF_DATA
          {
          caption_list=
                    {
                    CAPTION { code=01; caption="MultiLang"; }, // Eglish
                    CAPTION { code=02; caption="MultiLang"; }, // French
                    CAPTION { code=03; caption="MultiLang"; }  // German
                    };
  
          app_uid=0x02a5dd83;
          num_icons=2;
          embeddability=KAppNotEmbeddable;
          newfile=KAppDoesNotSupportNewFile;
          }

Step V - Change the class derived from CAknApplication

Over-ride ResourceFileName() function from CEikApplication to your CYourApplicationApp calss.

 

CMultiLangApp::ResourceFileName()

const

          {

          return TFileName();

          }

Step VI - Changes required in the AppUi class

First of all you have to pass ENonStandardResourceFile for the function call of BaseConstructL() in your AppUi class’s ConstructL() function.

 

          {

          BaseConstructL( ENonStandardResourceFile );

          //...

          }


Next create the following new function in your AppUi class.

 

void

CMultiLangAppUi::ChooseLanguageL(TInt aLanguageIndex)

          {

          _LIT(KResourceFileName, "MultiLang.r%02d");

          TFileName resFileName;

          resFileName.Format(KResourceFileName, aLanguageIndex);

#if

!defined(__WINS__) && !defined(__WINSCW__)

          // Device

          CompleteWithAppPath(resFileName);

#else

          // Emulator

          resFileName.Insert(0, KEmulatorPath);

#endif

          if (iOffset)

                    {

                    iCoeEnv->DeleteResourceFile(iOffset);

                    }

          iOffset = iCoeEnv->AddResourceFileL(resFileName);

          }


Now you can change the language of the application by calling ChooseLanguageL([LanguageIndex]) function.

Step VII - Changes in the PKG file

Put the following lines to your package file.

 

"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang.r01"-"!:\system\apps\MultiLang\MultiLang.r01"
"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang.r02"-"!:\system\apps\MultiLang\MultiLang.r02"
"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang.r03"-"!:\system\apps\MultiLang\MultiLang.r03"
"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang_caption.r01"-"!:\system\apps\MultiLang\MultiLang_caption.r01"
"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang_caption.r02"-"!:\system\apps\MultiLang\MultiLang_caption.r02"
"\Symbian\7.0s\Series60_v21\Epoc32\data\z\system\apps\MultiLang\MultiLang_caption.r03"-"!:\system\apps\MultiLang\MultiLang_caption.r03"


Here are the sample images of the application.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 1: English language has been selected.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 2: French language has been selected.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 3: German language has been selected.

 

Download the sample code

You can download the example application from here.

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google