Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 13:52, 5 February 2008.

CS000807 - Localizing application strings

From Forum Nokia Wiki


ID CS000807 Creation date February 5, 2008
Platform S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
Tested on devices Nokia E90 Communicator
Category Symbian C++ Subcategory Localization
APIs None Classes StringLoader
Methods None    

Overview

This code example describes how to localize the text strings of an application.

This snippet can be self-signed.

Steps

1. Create the data\[app].rls file.

2. Write the localization information into it:

#ifdef LANGUAGE_SC          // Default: UK English
 
#include "app_loc.l01"
 
#elif defined LANGUAGE_01   // UK English
 
#include "app_loc.l01"
 
#elif defined LANGUAGE_09   // Finnish
 
#include "app_loc.l09"
 
#endif

3. Add the localization strings into the appropriate files (for example, data\[app]_loc.l01 and data\[app]_loc.l09):

// Strings in data\[app]_loc.l01:
 
rls_string STRING_r_localized_text "Localized text."
rls_string STRING_r_localized_string_param "Localized string parameter: %U."
rls_string STRING_r_localized_number_param "Localized number parameter: %N."
// Strings in data\[app]_loc.l09:
 
rls_string STRING_r_localized_text "Kotoistettu teksti."
rls_string STRING_r_localized_string_param "Kotoistettu merkkijonoparametri: %U."
rls_string STRING_r_localized_number_param "Kotoistettu numeroparametri: %N."

4. Create resources from localized strings in data\[app].rss:

RESOURCE TBUF r_localized_text { buf=STRING_r_localized_text; }
RESOURCE TBUF r_localized_string_param { buf=STRING_r_localized_string_param; }
RESOURCE TBUF r_localized_number_param { buf=STRING_r_localized_number_param; }

5. Use StringLoader to load and format resource strings:

#include <stringloader.h>
HBufC* resLocalizedText = StringLoader::LoadLC(R_LOCALIZED_TEXT);
// Use resLocalizedText
CleanupStack::PopAndDestroy(resLocalizedText);
_LIT(KString, "A string");
HBufC* resLocalizedStringParam = StringLoader::LoadLC(R_LOCALIZED_STRING_PARAM, KString);
// Use resLocalizedStringParam
CleanupStack::PopAndDestroy(resLocalizedStringParam);
TInt number = 34;
HBufC* resLocalizedNumberParam = StringLoader::LoadLC(R_LOCALIZED_NUMBER_PARAM, number);
// Use resLocalizedNumberParam
CleanupStack::PopAndDestroy(resLocalizedNumberParam);

6. Insert the LANG attribute into the group\[app].mmp file:

LANG            SC 01 09
Related Discussions
Thread Thread Starter Forum Replies Last Post
symbian binaries : exe and dll's. himsymbian General Symbian C++ 12 2008-06-06 18:46
BTpointtopint client recive?! sblider Bluetooth Technology 0 2004-05-09 15:35
Too many bugs in 9500 Java garzotto Personal Profile 32 2006-07-26 06:44
Active Breakpoints? NigelT Carbide.c++ and CodeWarrior Tools 3 2006-11-29 17:57
Can sip stack support Presence? melanlife VoIP 3 2008-05-07 07:00
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX