wie TDateCalendar als Englisch (Days Bildunterschriften), wenn die Standardsprache nicht Englisch ist zu benutzen?

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

Frage

unsere Computereinstellungen hat Regionalsprache ist Koreanisch, mein Problem ist, wenn ich Format verwenden ( ‚MMM DD YYYY‘) den Tag, an koreanische Sprache (Monat) zurückgibt. und sogar die Aktuelles ist nicht Englisch. jede Anregung?

War es hilfreich?

Lösung

Format hat eine überladene Variante, dass Sie die Formateinstellungen außer Kraft setzen können:

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

Wo TFormatSettings ist wie folgt definiert:

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 kann von fast allen Format-Funktionen verwendet werden.

Sie können die Formateinstellungen eines bestimmten Gebietsschema (unter Windows) bekommen. Oder Sie können es selbst erstellen.

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

Alles ist in SysUtils.

Und Sie können die LCID auf dieser Seite finden.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top