Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » what about decimal-point and thousand-separator?
icon9.gif  what about decimal-point and thousand-separator? [message #5388] Mon, 18 September 2006 12:37 Go to next message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Hey!

At the moment I am testing the system that has U++ to convert the numbers into strings and it disappoints to me that he is not able to use parameters of the language to establish the point decimal and the thousands separator. Or I am not at least able to find how one becomes.

I have found in Core/Lang.cpp that the code tries to load these data of the system, and also are in the class 'LanguageInfo' but unfortunately, they are not being used in any of the functions of type 'AsString' or 'FormatDouble...' that I have found in Core/Format.cpp

This is specially annoying for the data that contain money, since I don't like to see in my language typical expression "1.000,50" this is in the USA and others paises but in Spain and many others would be "1.000,50"

I will have to write my own functions to do this?

Nico
Re: what about decimal-point and thousand-separator? [message #5389 is a reply to message #5388] Mon, 18 September 2006 12:55 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 590
Registered: December 2005
Location: Budapest, Hungary
Contributor
Currently, the double formatting comes from the operating system.
You can use language specific formatting using strings like "%2!nl". See "Text formatting" in documentation here: http://upp.sourceforge.net/src$Core$Format$en-us.html

Additionally, you can use any formatting and "scanning" in widgets also, see the Convert classes.
Re: what about decimal-point and thousand-separator? [message #5390 is a reply to message #5388] Mon, 18 September 2006 12:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12106
Registered: November 2005
Ultimate Member
nicomesas wrote on Mon, 18 September 2006 06:37

Hey!

At the moment I am testing the system that has U++ to convert the numbers into strings and it disappoints to me that he is not able to use parameters of the language to establish the point decimal and the thousands separator. Or I am not at least able to find how one becomes.

I have found in Core/Lang.cpp that the code tries to load these data of the system, and also are in the class 'LanguageInfo' but unfortunately, they are not being used in any of the functions of type 'AsString' or 'FormatDouble...' that I have found in Core/Format.cpp

This is specially annoying for the data that contain money, since I don't like to see in my language typical expression "1.000,50" this is in the USA and others paises but in Spain and many others would be "1.000,50"

I will have to write my own functions to do this?

Nico


Well, these things are still debated. Anyway, in any case I believe that FormatDouble or AsString should yield always the same result, regardless of language settings.

In this moment, the right way how to do this is to use LanguageInfo. There is

const LanguageInfo& GetLanguageInfo();

that returns current system default info; use

virtual String FormatDouble(double value, int digits, int FD_flags = 0, int fill_exp = 0) const;

from its interface. (GetLanguageInfo().FormatDouble()).

Be however warned that some changes here are still possible.

Alternative path is to use "nl" or "vl" in Format.

http://upp.sourceforge.net/src$Core$Format$en-us.html

"nl"/"vl" are better as they will not change in future.

Mirek
icon7.gif  Re: what about decimal-point and thousand-separator? [message #5392 is a reply to message #5390] Mon, 18 September 2006 13:29 Go to previous message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Thanks Mirek and zsolt.

For Spanish money the format can be %[2!]nl

Nico
Previous Topic: thousand separator problem
Next Topic: Localisation clarifications
Goto Forum:
  


Current Time: Fri Nov 22 16:34:06 CET 2019

Total time taken to generate the page: 0.03110 seconds