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
LANG 01 02 03 Step II - Create three localization filesAs 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 fileYourAppaif.rss should be like this to localize your application’s caption:
RESOURCE AIF_DATA Step V - Change the class derived from CAknApplicationOver-ride ResourceFileName() function from CEikApplication to your CYourApplicationApp calss.
CMultiLangApp::ResourceFileName() const{ return TFileName();} Step VI - Changes required in the AppUi classFirst of all you have to pass ENonStandardResourceFile for the function call of BaseConstructL() in your AppUi class’s ConstructL() function.
{ BaseConstructL( ENonStandardResourceFile ); //...}
void CMultiLangAppUi::ChooseLanguageL(TInt aLanguageIndex){ _LIT(KResourceFileName, "MultiLang.r%02d"); TFileName resFileName; resFileName.Format(KResourceFileName, aLanguageIndex); #if !defined(__WINS__) && !defined(__WINSCW__) // DeviceCompleteWithAppPath(resFileName); #else // EmulatorresFileName.Insert(0, KEmulatorPath); #endif if (iOffset){ iCoeEnv->DeleteResourceFile(iOffset); } iOffset = iCoeEnv->AddResourceFileL(resFileName); }
Step VII - Changes in the PKG filePut 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"
Figure 1: English language has been selected.
Figure 2: French language has been selected.
Figure 3: German language has been selected.
Download the sample codeYou can download the example application from here.
|
|
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2008 Google |