×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Internationalising currencies in Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
m (Protected "I18n: Currency" [edit=sysop:move=sysop])
Forum Nokia KB (Talk | contribs)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
 
+
{{KBCS}}
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
|'''ID''' ||  
+
|'''ID''' || CS000856
|'''Creation date''' || March 3, 2008
+
|'''Creation date''' || March 25, 2008
 
|-
 
|-
 
|'''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
|'''Tested on devices''' || Nokia E61i<br />Nokia E90<br />Nokia N95 8GB<br />Nokia 6220 Classic
+
|'''Tested on devices''' || Nokia E61i<br />Nokia E90 Communicator<br />Nokia N95 8GB<br />Nokia 6220 Classic
 
|-
 
|-
 
|'''Category''' || Symbian C++
 
|'''Category''' || Symbian C++
Line 30: Line 30:
 
TBuf<50> myBuf;
 
TBuf<50> myBuf;
  
// The amount is an integer, but it is treated like the last two digits
+
// The amount is an integer, but it is treated as if the last two digits
 
// were decimal digits. E.g. 1249 = 12.49, 2 = 0.02, 002 = 0.02 ...
 
// were decimal digits. E.g. 1249 = 12.49, 2 = 0.02, 002 = 0.02 ...
 
TInt myAmount = 123456789;
 
TInt myAmount = 123456789;
Line 47: Line 47:
 
==See also==
 
==See also==
  
* [[I18n:_Real_Numbers]]
+
* [[CS000855 - I18n: Real Numbers]]
* [[I18n:_Timestamps]]
+
* [[I18n: Timestamps]]
* [[I18n:_Images]]
+
* [[I18n: Images]]
* [[CS000807_-_Localizing_application_strings]]
+
* [[CS000807 - Localizing_application_strings]]
* [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.forum.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]]
+
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Localization]][[Category:S60 3rd Edition]]

Revision as of 12:04, 25 March 2008


Template:KBCS

ID CS000856 Creation date March 25, 2008
Platform S60 3rd Edition, MR
S60 3rd Edition, FP1
S60 3rd Edition, FP2 Beta
Tested on devices Nokia E61i
Nokia E90 Communicator
Nokia N95 8GB
Nokia 6220 Classic
Category Symbian C++ Subcategory Localization
APIs None Classes TLocale
Methods TLocale::FormatCurrency()    

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 format currency according to the locale settings of the device.

Source file

// Buffer for localized text
TBuf<50> myBuf;
 
// The amount is an integer, but it is treated as if the last two digits
// were decimal digits. E.g. 1249 = 12.49, 2 = 0.02, 002 = 0.02 ...
TInt myAmount = 123456789;
 
// Locale is initialized with system's current locale settings
TLocale myLocale;
 
// Format currency according to current locale settings
myLocale.FormatCurrency(myBuf, myAmount);

Postconditions

Currency is formatted according to the locale settings of the device.

See also

65 page views in the last 30 days.