So far this is what i had dig up on the topic. It made sense to post this one here since i am pretty sure somebody’s also looking for this info. Hehehe
Enjoy
Coffee Cup
procedure SetLocaleInfoSample;
var number, ds, lz;
begin
number := 0.7;
// Remember default number settings
ds := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL);
lz := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO);
// Log a number using default settings
Log.Message( FloatToStr(number) );
// Log a number using a different decimal separator
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, ‘,’);
Log.Message( FloatToStr(number) );
// Log a number without the leading zero
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, ‘0’);
Log.Message( FloatToStr(number) );
// Restore original settings
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, ds);
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, lz);
end;
{
The function produces the following output for US English locale:
0.7
0,7
,7
}
procedure ChangeShortDate;
var strOldShortDate;
begin
// Get current short date format
strOldShortDate := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE);
if not SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, ‘yyyy/MM/dd’) then
Log.Error(‘Could not change short date format.’);
// Restore original short date format
if not SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, strOldShortDate) then
Log.Error(‘Could not restore original short date format.’);
end;