Главная страница | назад





Article #20875: Changing Formatiing routines with system settings

Question: I'm trying to use setlocale() function to set the decimal seperator for a French version of my software. I thought that this would be simple, but it doesn't seem to work.

Answer: The setlocale() will work for the printf() family of functions, but will not make the change within the VCl. The Sysutils header provides variables so you change various formatting routines. These variables are initially set by using the Win32 routine GetLocaleInfo() which grabs the formats from the operating sytem.

The following are a set of variables used to define the format for numeric or date/time strings:

  • AnsiString CurrencyString;
  • Byte CurrencyFormat;
  • Byte NegCurrFormat;
  • char ThousandSeparator;
  • char DecimalSeparator;
  • Byte CurrencyDecimals;
  • char DateSeparator;
  • AnsiString ShortDateFormat;
  • AnsiString LongDateFormat;
  • char TimeSeparator;
  • AnsiString TimeAMString;
  • AnsiString TimePMString;
  • AnsiString ShortTimeFormat;
  • AnsiString LongTimeFormat;
  • AnsiString ShortMonthNames[12];
  • AnsiString LongMonthNames[12];
  • AnsiString ShortDayNames[7];
  • AnsiString LongDayNames[7];

    Note: The applications UpdateFormsSettings() method set whether you can make changes to the system settings. Default is true.

  • Last Modified: 28-FEB-00