Page 1 of 1

X - Axis Date & Time value display in multi language

Posted: Mon Jul 11, 2016 6:11 am
by 15677821
Hi,

We have developed multi language application with Teechart for create different type of charts. We need to display X-axis value in the format of month like 10 May, 12 May, etc. When we change the language from English to other language the X-axis month name is not translated to selected language.

Does Teechart support multi languages for X-axis date time display?

Re: X - Axis Date & Time value display in multi language

Posted: Mon Jul 11, 2016 8:02 am
by yeray
Hello,

TeeChart uses DateTimeToString function to convert the TDateTime values to strings. Since this takes the ShortMonthNames array for the months ('mmm'), you can modify that array using the language you wish. Ie:

Code: Select all

  ShortMonthNames[1] := 'Jan';
  ShortMonthNames[2] := 'Feb';
  ShortMonthNames[3] := 'Mar';
  ShortMonthNames[4] := 'Apr';
  ShortMonthNames[5] := 'May';
  ShortMonthNames[6] := 'Jun';
  ShortMonthNames[7] := 'Jul';
  ShortMonthNames[8] := 'Aug';
  ShortMonthNames[9] := 'Sep';
  ShortMonthNames[10] := 'Oct';
  ShortMonthNames[11] := 'Nov';
  ShortMonthNames[12] := 'Dec';

Re: X - Axis Date & Time value display in multi language

Posted: Mon Jul 11, 2016 4:15 pm
by 15677821
Hello,

Thank you for your reply.I think DateTimeTostring() and given solution in the above post is for Delphi Programming.But I am using Html5 & Javascript to create chart in the application, so how can we achieve the same in the Javascript language?

Re: X - Axis Date & Time value display in multi language

Posted: Tue Jul 12, 2016 8:02 am
by yeray
SenSeo wrote:Thank you for your reply.I think DateTimeTostring() and given solution in the above post is for Delphi Programming.But I am using Html5 & Javascript to create chart in the application, so how can we achieve the same in the Javascript language?
Oups :oops: , let me check it for Javascript.

Re: X - Axis Date & Time value display in multi language

Posted: Tue Jul 12, 2016 8:18 am
by yeray
Hi,

In Javascript you can change the dateFormat.i18n monthNames array:

Code: Select all

  dateFormat.i18n = {
        dayNames: [
            "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
            "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
        ],
        monthNames: [
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
            "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
        ]
    };