Still have questions?
Contact support
You are looking at an outdated 7.10.0 version of this document. Switch to the 7.12.0 version to see the up to date information.

Localization

Overview

AnyChart Gantt charts support full localization of input and output date time and number formats using locale mechanism. Using locales is really easy and this article will tell you how.

Applying automatic locale

You can use locales created by AnyChart for the most regions and cultures, do that, first link a file from AnyChart CDN or download it on your server and link from there.

Linking from CDN looks like this:

<script src="http://cdn.anychart.com/locale/1.0.0/english-(united-kingdom).js">
<script src="http://cdn.anychart.com/locale/1.0.0/english-(united-states).js">

Linking from your server may look like this:

<script src="./locales/english-(united-kingdom).js">
<script src="http://mydomain.com/anychart-locales/english-(united-states).js">

After you linked the file AnyChart engine knows about it and you can start using it in your AnyGantt charts, just set the code of the locale in either inputLocale or outputLocale. The code of the locale is listed in the CODE column on AnyChart Locales CDN.

Setting input and output locale looks like this:

anychart.format.inputLocale('en-us');
anychart.format.outputLocale('hi-in');

And that's how it works, you can see that names of the month in the timeline changed to Hindu:

JsFiddle Playground

Tuning locale

Locales define the default input and output date time format, but you can tune this using inputDateTimeFormat and {api:anychart.format#outputDateTimeFormat{api} if you want to use input or output format alternative to the locale:

// set locales
anychart.format.inputLocale('en-us');
anychart.format.outputLocale('hi-in');

// tune inputDateTimeFormat and outputDateTimeFormat
anychart.format.inputDateTimeFormat('yyyy-MM-dd'); 
anychart.format.outputDateTimeFormat('dd MMM');

And that's how it will work:

JsFiddle Playground

Locales CDN

You can get all available locales from AnyChart CDN. You can both download them to your server or reference directly from CDN.