Join Now
Quality Rating:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)
Expertise Level:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)

This page was last modified 20:22, 17 May 2008.

How to define localization messages

From Forum Nokia Wiki


The language constants are defined in e32const.h.

Define the languages that your component is localized to in your .mmp file:

// file: MyApp.mmp
 
...
 
LANG 01 02 16 // UK English, French, Russian

Place logical strings for different languages in different language-specific files. Dont forget to define the file encoding for those languages that use character sets beyond basic ASCII. For instance:

// file: MyApp.l01 (ELangEnglish = 01)
 
#define message_wait     "Please wait..."
// file: MyApp.l02 (ELangFrench = 02)
 
// the file has to be encoded in UTF-8 for the strings to be rendered correctly:
CHARACTER_SET UTF8 
 
#define message_wait   "Attendez, s'il-vous plait..."
// file: MyApp.l16 (ELangRussian = 16)
 
// the file has to be encoded in UTF-8 for the strings to be rendered correctly:
CHARACTER_SET UTF8
 
#define message_wait   "Пожалуйста, подождите ..."

In file MyApp.rls, include the correct language-specific file:

// file: MyApp.rls
CHARACTER_SET UTF8
 
#if defined LANGUAGE_01
  #include "MyApp.l01"
#elif defined LANGUAGE_02
  #include "MyApp.l02"
#elif defined LANGUAGE_16
  #include "MyApp.l16"
#endif

In MyApp.rss, define the resources based on the strings defined in the language-specific file that was included by MyApp.rls:

// file: MyApp.rss
#include <eikon.rh>
#include "MyApp.rls"
 
RESOURCE TBUF r_message_wait { buf = message_wait; }

In your code, use the localized strings as follows. The string denoted by R_MESSAGE_WAIT will be displayed in the appropriate language. Note the change from lower-case to upper-case.

//file: testexample.cpp
#include <stringloader.h>
...
...
HBufC* message = StringLoader::LoadL( R_MESSAGE_WAIT );
CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
note->ExecuteLD( *message );
delete message;

Finally, add the localized language resources to the package file:

;; file: MyApp.pkg 
 
...
 
; languages supported:
&EN,FR,RU
 
; localization:
{
"$(EPOCROOT)epoc32\data\z\resource\apps\MyApp.r01"
"$(EPOCROOT)epoc32\data\z\resource\apps\MyApp.r02"
"$(EPOCROOT)epoc32\data\z\resource\apps\MyApp.r16"
}-"!:\resource\apps\MyApp.rsc"
Related Discussions
Thread Thread Starter Forum Replies Last Post
Reading SMS's - AT+CMGL and 7650 rusvdw PC Suite API and PC Connectivity SDK 2 2003-05-12 11:38
Asian Language (Japanese/Chinese) localization fonts georgechen Mobile Java General 1 2006-05-24 01:42
How do I draw/display a bitmap on the dialog? jrmfelipe General Symbian C++ 8 2004-02-06 04:09
Auto-increment of build number dracula78 Carbide.c++ and CodeWarrior Tools 8 2007-08-21 12:06
Problem with concatenated messages angeliki_n General Messaging 1 2002-09-30 11:51
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX