Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Multi-language support at run time

From Wiki
Jump to: navigation, search
Article Metadata
Created: vvsnaresh (21 Mar 2007)
Last edited: hamishwillee (27 Jul 2012)

The following shows you some easy and important steps to provide multi-language support during runtime for S60:

First Step: In your project's MMP file replace the line



LANG 01 02 03 04

Here, 01 02 03 and 04 represents the number of languages you want to give support to.

Second Step: You have to create four localization files with file extensions as .l01, .l02, .l03 and .l04 for languages say, Chinese, English Latin and German.In these localization files, one can keep all the strings in the concerned language.

NOTE:It is advisable to follow the TLanguage enumeration found in e32const.h when choosing the number, corresponding to the language.

Third Step: And edit your LOC file as follows:

// 01 is Chinese, 02 is English, 03 is Latin and 04 is German
#ifdef LANGUAGE_01
#include "LangFile.l01"
#ifdef LANGUAGE_02
#include "LangFile.l02"
#ifdef LANGUAGE_03
#include "LangFile.l03"
#ifdef LANGUAGE_04
#include "LangFile.l04"

Fourth Step: <AppName>aif.rss file should look like as follows to localize your application’s caption.

CAPTION { code=01; caption="LangFile"; },
CAPTION { code=02; caption="LangFile"; },
CAPTION { code=03; caption="LangFile"; },
CAPTION { code=04; caption="LangFile"; }

Fifth Step: Now, change the class derived from CAknApplication; Over-ride ResourceFileName() function from CEikApplication to your CYourApplicationApp class.

TFileName CLangFileApp::ResourceFileName() const
return TFileName();

Sixth Step: Now, some changes are required in your AppUi class; You have to pass ENonStandardResourceFile for the function call of BaseConstructL() in your AppUi class’s ConstructL() function.

void CLangFileAppUi::ConstructL()
BaseConstructL( ENonStandardResourceFile );

Add the following new function in your AppUi class;

void CLangFileAppUi::ChooseLanguageL(TInt aLanguageIndex)
_LIT(KResourceFileName, "LangFile.r%02d");
TFileName resFileName;
resFileName.Format(KResourceFileName, aLanguageIndex);
#if !defined(__WINS__) && !defined(__WINSCW__)
// Device
// Emulator
resFileName.Insert(0, KEmulatorPath);
if (iOffset) iCoeEnv->DeleteResourceFile(iOffset);
iOffset = iCoeEnv->AddResourceFileL(resFileName);

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

Seventh Step: Add the following in your .pkg file;


Related links:

This page was last modified on 27 July 2012, at 07:32.
21 page views in the last 30 days.