come utilizzare TDateCalendar come l'inglese (Giorni didascalie) quando la lingua predefinita non è l'inglese?

StackOverflow https://stackoverflow.com/questions/4623035

Domanda

le nostre impostazioni del computer non ha lingua regionale è coreana, il mio problema è quando uso FormatDateTime ( 'MMM GG AAAA') restituisce la data in lingua coreana (mese). e anche il datecalendar non è inglese. qualsiasi suggerimento?

È stato utile?

Soluzione

FormatDateTime ha una variante di overload che è possibile utilizzare per sovrascrivere le impostazioni di formato:

function FormatDateTime(const Format: string; DateTime: TDateTime;
  const FormatSettings: TFormatSettings): string; overload;

Dove TFormatSettings è definito come:

type
  TFormatSettings = record
    CurrencyFormat: Byte;
    NegCurrFormat: Byte;
    ThousandSeparator: Char;
    DecimalSeparator: Char;
    CurrencyDecimals: Byte;
    DateSeparator: Char;
    TimeSeparator: Char;
    ListSeparator: Char;
    CurrencyString: string;
    ShortDateFormat: string;
    LongDateFormat: string;
    TimeAMString: string;
    TimePMString: string;
    ShortTimeFormat: string;
    LongTimeFormat: string;
    ShortMonthNames: array[1..12] of string;
    LongMonthNames: array[1..12] of string;
    ShortDayNames: array[1..7] of string;
    LongDayNames: array[1..7] of string;
    TwoDigitYearCenturyWindow: Word;
  end;

TFormatSettings può essere utilizzato da quasi tutte le funzioni di formattazione.

È possibile ottenere le impostazioni del formato di un determinato locale con (su Windows). Oppure si può creare da soli.

procedure GetLocaleFormatSettings(LCID: Integer;
  var FormatSettings: TFormatSettings);

Tutto è in SysUtils.

E trovi la LCID su questo sito .

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top