×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Internationalising images on Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
m (Protected "I18n: Images" [edit=sysop:move=sysop])
hamishwillee (Talk | contribs)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{Archived|timestamp=20120314041414|user=roy.debjit| }}
__NOEDITSECTION__
+
[[Category:Symbian C++]][[Category:Code Snippet]][[Category:Localization]][[Category:S60 3rd Edition (initial release)]][[Category:Code Snippet]]
 
+
{{ArticleMetaData <!-- v1.2 -->
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
|-
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|'''ID''' || &nbsp;
+
|devices= Nokia E61i<br/>Nokia E90 Communicator<br/>Nokia N95 8GB<br/>Nokia 6220 Classic
|'''Creation date''' || March 3, 2008
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|-
+
|platform= S60 3rd Edition, MR<br />S60 3rd Edition, FP1<br />S60 3rd Edition, FP2 Beta
|'''Platform''' || S60 3rd Edition, MR<br />S60 3rd Edition, FP1<br />S60 3rd Edition, FP2 Beta
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|'''Tested on devices''' || Nokia E61i<br />Nokia E90<br />Nokia N95 8GB<br />Nokia 6220 Classic
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|-
+
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|'''Category''' || Symbian C++
+
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|'''Subcategory''' || Localization
+
|keywords= TParse, StringLoader, CFbsBitmap, TParse::Set(), StringLoader::LoadLC(), CFbsBitmap::Load()
|-
+
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
|'''APIs''' || None
+
|translated-by= <!-- [[User:XXXX]] -->
|'''Classes''' || TParse<br />StringLoader<br />CFbsBitmap
+
|translated-from-title= <!-- Title only -->
|-
+
|translated-from-id= <!-- Id of translated revision -->
|'''Methods''' || TParse::Set()<br />StringLoader::LoadLC()<br />CFbsBitmap::Load()
+
|review-by= <!-- After re-review: [[User:username]] -->
|&nbsp; || &nbsp;
+
|review-timestamp= <!-- After re-review: YYYYMMDD -->
|}
+
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080304
 +
|author= [[User:Tapiolaitinen]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= Localization
 +
|id= CS000858
 +
}}
  
 
==Overview==
 
==Overview==
Line 34: Line 41:
 
==Resource files==
 
==Resource files==
  
<tt>data\[app].rls</tt>:
+
{{Icode|data\[app].rls}}:
  
 
<code cpp>
 
<code cpp>
Line 49: Line 56:
 
</code>
 
</code>
  
Declare the location of the "English" bitmap into <tt>data\[app].l01</tt>:
+
Declare the location of the "English" bitmap into {{Icode|data\[app].l01}}:
  
 
<code cpp>
 
<code cpp>
// The paths in the following string are different for 3rd & 2nd Ed. platforms
+
// The paths in the following string are different for S60 3rd & 2nd Edition platforms
 
#ifdef EKA2
 
#ifdef EKA2
 
   #define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_01.mbm"
 
   #define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_01.mbm"
Line 60: Line 67:
 
</code>
 
</code>
  
Declare the location of the "German" bitmap into <tt>data\[app].l03</tt>:
+
Declare the location of the "German" bitmap into {{Icode|data\[app].l03}}:
  
 
<code cpp>
 
<code cpp>
// The paths in the following string are different for 3rd & 2nd Ed. platforms
+
// The paths in the following string are different for S60 3rd & 2nd Edition platforms
 
#ifdef EKA2
 
#ifdef EKA2
 
   #define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_03.mbm"
 
   #define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_03.mbm"
Line 71: Line 78:
 
</code>
 
</code>
  
In the resource file of the application (<tt>data\[app].rss</tt>), create a bitmap resource from the localized string:
+
In the resource file of the application ({{Icode|data\[app].rss}}), create a bitmap resource from the localized string:
  
 
<code cpp>
 
<code cpp>
Line 112: Line 119:
 
==See also==
 
==See also==
  
* [[I18n:_Real_Numbers]]
+
* [[Archived:Internationalising real numbers in Symbian C++]]
* [[I18n:_Currency]]
+
* [[Archived:Internationalising currencies in Symbian C++]]
* [[I18n:_Timestamps]]
+
* [[Internationalising timestamps in Symbian C++]]
* [[CS000807_-_Localizing_application_strings]]
+
* [[Localizing strings on Symbian C++ apps]]
* [http://www.forum.nokia.com/info/sw.nokia.com/id/1c82873d-183e-4073-afdb-22e09a5dc8c5/S60_Platform_Localization_Example_v1_0_en.zip.html Localization Example v.1.0]
+
* [http://www.developer.nokia.com/info/sw.nokia.com/id/1c82873d-183e-4073-afdb-22e09a5dc8c5/S60_Platform_Localization_Example_v1_0_en.zip.html S60 Platform: Localization Example]
 
+
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Localization]]
+

Latest revision as of 03:23, 20 June 2012

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia E61i
Nokia E90 Communicator
Nokia N95 8GB
Nokia 6220 Classic
Compatibility
Platform(s): S60 3rd Edition, MR
S60 3rd Edition, FP1
S60 3rd Edition, FP2 Beta
S60 3rd Edition (initial release)
Article
Keywords: TParse, StringLoader, CFbsBitmap, TParse::Set(), StringLoader::LoadLC(), CFbsBitmap::Load()
Created: tapiolaitinen (04 Mar 2008)
Last edited: hamishwillee (20 Jun 2012)

Contents

[edit] Overview

This code snippet is one of the series of snippets that demonstrate how to implement support for international diversity. This snippet shows how to select a bitmap according to the locale settings of the device.

[edit] MMP file

The following libraries are required:

LIBRARY fbscli.lib

[edit] Resource files

data\[app].rls:

#ifndef __APP_LOC__
#define __APP_LOC__
 
#ifdef LANGUAGE_01 // Language code for UK
#include "..\data\app.l01"
#elif defined LANGUAGE_03 // Language code for German
#include "..\data\app.l03"
#endif
 
#endif // __APP_LOC__

Declare the location of the "English" bitmap into data\[app].l01:

// The paths in the following string are different for S60 3rd & 2nd Edition platforms
#ifdef EKA2
#define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_01.mbm"
#else
#define qtn_loc_bmpfile "%U\\system\\apps\\Localization\\Bitmap_01.mbm"
#endif

Declare the location of the "German" bitmap into data\[app].l03:

// The paths in the following string are different for S60 3rd & 2nd Edition platforms
#ifdef EKA2
#define qtn_loc_bmpfile "%U\\resource\\apps\\Bitmap_03.mbm"
#else
#define qtn_loc_bmpfile "%U\\system\\apps\\Localization\\Bitmap_03.mbm"
#endif

In the resource file of the application (data\[app].rss), create a bitmap resource from the localized string:

RESOURCE TBUF256 r_loc_bmpfile { buf=qtn_loc_bmpfile; }

[edit] Source file

#include <stringloader.h>
// Find the drive where the application has been installed
TParse parse;
parse.Set(Application()->AppFullName(), 0, 0);
 
// Load the name of the bitmap from the resource file
HBufC* bmpFile = StringLoader::LoadLC(R_LOC_BMPFILE, parse.Drive());
 
// Create and load the bitmap
CFbsBitmap* bitmap = new (ELeave)CFbsBitmap;
CleanupStack::PushL(bitmap);
 
// Load the first bitmap (index 0) from a multi-bitmap file
User::LeaveIfError(bitmap->Load(*bmpFile, 0));
 
CleanupStack::Pop(bitmap);
 
// Draw the bitmap onto the screen
// ...
 
CleanupStack::PopAndDestroy(bmpFile);

[edit] Postconditions

A bitmap is selected according to the locale settings of the device.

[edit] See also

This page was last modified on 20 June 2012, at 03:23.
140 page views in the last 30 days.
×