ThaiCalendar Format() with i18n

Posted:
April 24th, 2013, 9:42 am
by Theprasit
I'm using i18n for ThaiCalendar and want to use Format() function to convert Date in String format.
I tried with ShowMessage(ThaiCalandar.Format('dd mmmm yyyy', Date) but the result shown only date and year portion without long month name.
Do I miss somethings?
Regards,
TS
Re: ThaiCalendar Format() with i18n

Posted:
April 26th, 2013, 7:50 pm
by Kambiz
I suppose that you have created the calendar instance as
- Code: Select all
ThaiCalendar := TThaiCalendar.Create;
This constructor does not initialize the locale settings and only offers the algorithm of the calendar.
You should either pass a locale ID/Name to the constructor or later call Prepare method of Settings property of the calendar object.
- Code: Select all
TThaiCalendar.Create('th-TH')
OR
- Code: Select all
ThaiCalendar := TThaiCalendar.Create;
ThaiCalendar.Settings.Prepare('th-TH');
Re: ThaiCalendar Format() with i18n

Posted:
April 28th, 2013, 2:34 pm
by Theprasit
You are great!
I did what you mentioned, after change to your method it's work fine.
Thank you for your help and your wonderful component.
TS