i have this procedure:
procedure Initialize(out FormatSettings: TFormatSettings);
const
LongDayNamesEx : array [1..7] of string = ('Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato', 'Domenica');
LongMonthNamesEx : array [1..12] of string = ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');
begin
FormatSettings := TFormatSettings.Create;
with FormatSettings do
begin
LongDayNames := LongDayNamesEx;
LongMonthNames := LongMonthNamesEx;
end;
end;
And i get an error about incompatible types (E2008). How i can solve this problem? I don’t want to use something as:
LongDayNames[1] := 'Lunedì';
LongDayNames[2] := 'Martedì';
...
LongDayNames[7] := 'Domenica';
LongMonthNames[1] := 'Gennaio';
LongMonthNames[2] := 'Febbraio';
...
LongMonthNames[12] := 'Dicembre';
if not stricly necessary.
Thanks for help.
Andreas gave you a good answer to the direct question that you asked.
Taking a different approach, I think you could solve your problem more easily by passing the locale when you initlialise the object. For example:
for Italian. Then the system will fill out the locale specific settings, day names, month names etc.
Or perhaps you would use the overload that takes a locale ID is more appropriate. No matter, you surely get the idea.