Jump to content

How to change locale


photo

Recommended Posts

Hi,

I want to change decimal separator from default C '.' to system separator (in my case ',').

I've included a function to change numeric locale:


Log::message("'%s'", setlocale(LC_NUMERIC, "")); 
Log::message("%.2f", 123.45678);
printf("%.2f", 123.45678);

The output in console is:

'Spanish_Spain.1252'
123.46
123,46

In Unigine log file:

11:14:28 'Spanish_Spain.1252'
11:14:28 123.46

 

I think is a bug in Unigine (it must respect these settings), but maybe I missing something.

 

Thanks in advance.

 

Link to comment

Hi Iván,

 

Internally, engine uses sprintf so it's strange that it's not working with modified C locale properly. Try C++ way:

std::locale::global(std::locale(""));
Link to comment
×
×
  • Create New...