Dot changed to a comma

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
palikem
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sat Oct 28, 2017 9:33 am
Location: Slovensko

Dot changed to a comma

Post by palikem »

Hi everybody.

Can someone explain me?
The program running under WinXP has a dot in the numbers
Clipboard02.jpg
Clipboard02.jpg (62.88 KiB) Viewed 3249 times
And the same program under Win8.1 has a comma
frame.jpg
What can be done to have a dot in numbers and program running under Win8.1
Thank you

Win8.1
wxDev-C++ 7.4.2.569
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Dot changed to a comma

Post by DavidHart »

Hi,

I've just moved this topic from the wxDev-C++ subforum to here, since as far as I can tell it has nothing to do with the wxDev-C++ IDE. Please only post to the wxDev-C++ subforum when you have a question about wxDev-C++ itself e.g. how to make it do ${FOO}.

Regards,

David
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Dot changed to a comma

Post by stahta01 »

Some countries use "," instead "." as the decimal point.

Tim S.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dot changed to a comma

Post by PB »

The application in the screenshot is in Slovak language, Slovak language uses decimal comma.

My guess would be that the XP computer has period set as a decimal separator in MS Windows, while the 8.1 one uses comma. Since the application probably uses wxLocale with the default language, the decimal separator is taken from the OS as expected.
palikem
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sat Oct 28, 2017 9:33 am
Location: Slovensko

Re: Dot changed to a comma

Post by palikem »

PB wrote:The application in the screenshot is in Slovak language, Slovak language uses decimal comma.

My guess would be that the XP computer has period set as a decimal separator in MS Windows, while the 8.1 one uses comma. Since the application probably uses wxLocale with the default language, the decimal separator is taken from the OS as expected.
wxLocale there I did not
The program leaves out certain letters in Slovak
But only winXp
In win8.1 are all letters
This also do not know why it does
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: Dot changed to a comma

Post by xaviou »

Hi.

A Quick trick is a call to setlocale(LC_NUMERIC, "C") witch will force decimals to use the point.

Regards
Xav'
My wxWidgets stuff web page : X@v's wxStuff
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dot changed to a comma

Post by PB »

palikem wrote:wxLocale there I did not
The program leaves out certain letters in Slovak
But only winXp
In win8.1 are all letters
This also do not know why it does
I am sorry, I do not understand. Are you trying to say that the application does not use wxLocale?

I see Slovak and English flags in the screenshot and I assumed it can switch the application language using those two icons.

Are you saying that the strings inside the application are hardcoded in Slovak, and not wrapped in _("") macro?

Did you check what is the decimal separator on the two computers set to in Windows settings?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dot changed to a comma

Post by PB »

xaviou wrote:A Quick trick is a call to setlocale(LC_NUMERIC, "C") witch will force decimals to use the point.
I thought mixing wxLocale and C locale functions was to be avoided?
palikem
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sat Oct 28, 2017 9:33 am
Location: Slovensko

Re: Dot changed to a comma

Post by palikem »

I do not use wxLocale
Yes, the language can be changed using the icon
I wanted to simplify it

Code: Select all

mfile[0] = _("File"); mfile[1] = _("Súbor");
mnew[0] = _("New"); mnew[1] = _("Nový");
mopen[0] = _("Open"); mopen[1] = _("Otvoriť");
msave[0] = _("Save"); msave[1] = _("Uložiť");
msaveas[0] = _("Save As"); msaveas[1] = _("Ulož ako");
mclose[0] = _("Close"); mclose[1] = _("Koniec");
mview[0] = _("View"); mview[1] = _("Vidieť");
But at the end I do complicated.
Now I miss the letters in winXP.
palikem
Experienced Solver
Experienced Solver
Posts: 69
Joined: Sat Oct 28, 2017 9:33 am
Location: Slovensko

Re: Dot changed to a comma

Post by palikem »

xaviou wrote:Hi.

A Quick trick is a call to setlocale(LC_NUMERIC, "C") witch will force decimals to use the point.

Regards
Xav'
The problem with dots and commas, partially solved.

Code: Select all

locale = new wxLocale();
locale->Init(wxLANGUAGE_ENGLISH, wxLOCALE_LOAD_DEFAULT);
I do not know if it's right.
But it works.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dot changed to a comma

Post by PB »

palikem wrote:I do not use wxLocale
Yes, the language can be changed using the icon
I wanted to simplify it

Code: Select all

mfile[0] = _("File"); mfile[1] = _("Súbor");
mnew[0] = _("New"); mnew[1] = _("Nový");
mopen[0] = _("Open"); mopen[1] = _("Otvoriť");
msave[0] = _("Save"); msave[1] = _("Uložiť");
msaveas[0] = _("Save As"); msaveas[1] = _("Ulož ako");
mclose[0] = _("Close"); mclose[1] = _("Koniec");
mview[0] = _("View"); mview[1] = _("Vidieť");
But at the end I do complicated.
Now I miss the letters in winXP.
You are doing it wrong. The _("") macro is there to help with localization. The strings in the source should be only in English and POEdit or similar should be used to generate and translate message catalogues for other languages. Using non-English letters is also brittle (depends on the compiler and source file encoding) and is not recommended.
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: Dot changed to a comma

Post by xaviou »

PB wrote:
xaviou wrote:A Quick trick is a call to setlocale(LC_NUMERIC, "C") witch will force decimals to use the point.
I thought mixing wxLocale and C locale functions was to be avoided?
It is.
But it works :) And if he doesn't use wxLocale there shouldn't be any problem.

Regards
Xav'
My wxWidgets stuff web page : X@v's wxStuff
Post Reply