Page 1 of 1

Dot changed to a comma

Posted: Fri Mar 23, 2018 9:37 pm
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 1663 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

Re: Dot changed to a comma

Posted: Fri Mar 23, 2018 10:09 pm
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

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 1:04 am
by stahta01
Some countries use "," instead "." as the decimal point.

Tim S.

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 6:20 am
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.

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 7:18 am
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

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 9:37 am
by xaviou
Hi.

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

Regards
Xav'

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 9:39 am
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?

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 9:40 am
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?

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 9:51 am
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.

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 9:56 am
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.

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 10:04 am
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.

Re: Dot changed to a comma

Posted: Sat Mar 24, 2018 1:15 pm
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'