Localization

Overview

The AnyChart Stock component gives developer a flexible mechanism for language/culture-dependent display localization, allowing to make his charts understandable for any user anywhere in the world.

to top

Using Non-Latin Symbols

When you localize data any part of the component, you will, most likely, need to use non-latin symbols in, for example, months names, weekday names, context menu texts and so on. When you do so, you need to put these texts in <![CDATA[]]> and make sure your XML is UTF-8 encoded. CSV files with non-latin symbols should be UTF-8 encoded as well.

For example, you need to set genitive months names in Russian:

XML/JSON Syntax
Plain code
01 <months>
02   <genitive_names><![CDATA[Января,Февраля,Марта,Апреля,Мая,Июня,Июля,Августа,Сентября,Октября,Ноября,Декабря]]></genitive_names>
03   <genitive_short_names><![CDATA[Янв,Фев,Мар,Апр,Мая,Июн,Июл,Авг,Сен,Окт,Ноя,Дек]]></genitive_short_names>
04 </months>
01{
02  genitiveNames: "Января,Февраля,Марта,Апреля,Мая,Июня,Июля,Августа,Сентября,Октября,Ноября,Декабря",
03  genitiveShortNames: "Янв,Фев,Мар,Апр,Мая,Июн,Июл,Авг,Сен,Окт,Ноя,Дек"
04}

Note: it is recommended to use <![CDATA[]]> section, even there are no non-latin symbols.

to top

Display Locale Settings

Display Locale deals with all the issues of the date-time and number-related localization. It includes the settings of the date-time display format, number display format, month and weekday names, etc.

Please read the following : This document describes in-depth all display locale settings, but we want to note that there is a very handy utility that eases display locale configuration dramatically, this is Localization and Date-Time Utility, please read about it, launch it and play with it as you read this article - the utility is a real time saver, when you need to configure months names, weekday names and other language/culture dependent things.

Month Names

The following two tokens can be used in the date formatting string for setting the format of the text to be used for displaying month name:

By default, the component shows English names and abbreviations, and in order to change that, you would need to use the tags <names>, <short_names> and <shortest_names>; here you should list the alternative names, beginning with January.

The sample XML below shows how month names can be changed to Russian:

XML/JSON Syntax
Plain code
02   <date_time>
03     <months>
04       <names><![CDATA[Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь,Октябрь,Ноябрь,Декабрь]]></names>
05       <short_names><![CDATA[Янв,Фев,Мар,Апр,Май,Июн,Июл,Авг,Сен,Окт,Ноя,Дек]]></short_names>
06       <shortest_names><![CDATA[Я,Ф,М,А,М,И,И,А,С,О,Н,Д]]></shortest_names>
07     </months>
08   </date_time>
01{
02  dateTime: {
03    months: {
04      names: "Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь,Октябрь,Ноябрь,Декабрь",
05      shortNames: "Янв,Фев,Мар,Апр,Май,Июн,Июл,Авг,Сен,Окт,Ноя,Дек",
06      shortestNames: "Я,Ф,М,А,М,И,И,А,С,О,Н,Д"
07    }
08  }
09}

When such settings are applied, you get the following results - respectively with the %N, %MMM and %MMMM token in the formatting string:

Original Date Format: %dd %N %yyyy г. Format: %dd %MMM %yyyy г. Format: %dd %MMMM %yyyy г.
1/24/2010 24 Я 2010 г. 24 Янв 2010 г. 24 Январь 2010 г.
2/24/2010 24 Ф 2010 г. 24 Фев 2010 г. 24 Февраль 2010 г.
3/24/2010 24 М 2010 г. 24 Мар 2010 г. 24 Март 2010 г.
4/24/2010 24 А 2010 г. 24 Апр 2010 г. 24 Апрель 2010 г.
5/24/2010 24 М 2010 г. 24 Май 2010 г. 24 Май 2010 г.
6/24/2010 24 И 2010 г. 24 Июн 2010 г. 24 Июнь 2010 г.
7/24/2010 24 И 2010 г. 24 Июл 2010 г. 24 Июль 2010 г.
8/24/2010 24 А 2010 г. 24 Авг 2010 г. 24 Август 2010 г.
9/24/2010 24 С 2010 г. 24 Сен 2010 г. 24 Сентябрь 2010 г.
10/24/2010 24 О 2010 г. 24 Окт 2010 г. 24 Октябрь 2010 г.
11/24/2010 24 Н 2010 г. 24 Ноя 2010 г. 24 Ноябрь 2010 г.
12/24/2010 24 Д 2010 г. 24 Дек 2010 г. 24 Декабрь 2010 г.

Learn more about date time formatting in:

to top

Genitive Month Names

In many languages, when indicating date with the textual designation of months, it is necessary to put the month names in the proper cases in order to observe the rules of the grammar.

For example, if you use the format string "%d %MMMM, %yyyy" for the date "1/27/2009" taking just the Russian translation of the month names, you will have: "27 Январь, 2009" (January 27, 2009), which is unacceptable from the Russian grammar's point of view, because the case of the noun here should be changed from nominative to genitive. To ensure the normal perception of the date by a native speaker of Russian, the result must appear as: "27 Января, 2009".

But month names are used not only in the full date specifications; they are also used in X-Axis labels, where they should appear in the nominative case. So, special tokens are available for using names of months in the genitive case:

But before you start using these tokens, you should specify all the month names in the genitive case for the given language. You can do that in the <genitive_names> and <genitive_short_names> nodes, the same way you set the nominative names.

The sample XML below shows how genitive names are set for Russian:

XML/JSON Syntax
Plain code
02   <date_time>
03     <months>
04       <genitive_names><![CDATA[Января,Февраля,Марта,Апреля,Мая,Июня,Июля,Августа,Сентября,Октября,Ноября,Декабря]]></genitive_names>
05       <genitive_short_names><![CDATA[Янв,Фев,Мар,Апр,Мая,Июн,Июл,Авг,Сен,Окт,Ноя,Дек]]></genitive_short_names>
06     </months>
07   </date_time>
01{
02  dateTime: {
03    months: {
04      genitiveNames: "Января,Февраля,Марта,Апреля,Мая,Июня,Июля,Августа,Сентября,Октября,Ноября,Декабря",
05      genitiveShortNames: "Янв,Фев,Мар,Апр,Мая,Июн,Июл,Авг,Сен,Окт,Ноя,Дек"
06    }
07  }
08}

When you apply the settings shown above, the dates will appear as:

Original Date Format: %dd %MMMMMM %yyyy г.
1/24/2010 24 Января 2010 г.
2/24/2010 24 Февраля 2010 г.
3/24/2010 24 Марта 2010 г.
4/24/2010 24 Апреля 2010 г.
5/24/2010 24 Мая 2010 г.
6/24/2010 24 Июня 2010 г.
7/24/2010 24 Июля 2010 г.
8/24/2010 24 Августа 2010 г.
9/24/2010 24 Сентября 2010 г.
10/24/2010 24 Октября 2010 г.
11/24/2010 24 Ноября 2010 г.
12/24/2010 24 Декабря 2010 г.

Learn more about date time formatting in:

to top

Weekday Names

To show weekday names as text, use the following tokens:

To set the full and abbreviated weekday names, use the <names>, <short_names> and <shortest_names> nodes; here you should list the new weekday names beginning with Sunday.

The sample XML below shows how to set Russian names:

XML/JSON Syntax
Plain code
02   <date_time>
03     <week_days>
04       <names><![CDATA[Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота]]></names>
05       <short_names><![CDATA[Вс,Пн,Вт,Ср,Чт,Пт,Сб]]></short_names>
06       <shortest_names><![CDATA[В,П,В,С,Ч,П,С]]></shortest_names>
07     </week_days>
08   </date_time>
01{
02  dateTime: {
03    weekDays: {
04      names: "Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",
05      shortNames: "Вс,Пн,Вт,Ср,Чт,Пт,Сб",
06      shortestNames: "В,П,В,С,Ч,П,С"
07    }
08  }
09}

When the settings shown above are applied, the %w, %d and %dddd tokens placed in the formatting string lead to the following results:

Original Date Format: %w %dd.%MM.%yyyy г. Format: %ddd %dd.%MM.%yyyy г. Format: %dddd %dd.%MM.%yyyy г.
3/22/2010 П, 22.03.2010 г. Пн, 22.03.2010 г. Понедельник, 22.03.2010 г.
3/23/2010 В, 23.03.2010 г. Вт, 23.03.2010 г. Вторник, 23.03.2010 г.
3/24/2010 С, 24.03.2010 г. Ср, 24.03.2010 г. Среда, 24.03.2010 г.
3/25/2010 Ч, 25.03.2010 г. Чт, 25.03.2010 г. Четверг, 25.03.2010 г.
3/26/2010 П, 26.03.2010 г. Пт, 26.03.2010 г. Пятница, 26.03.2010 г.
3/27/2010 С, 27.03.2010 г. Сб, 27.03.2010 г. Суббота, 27.03.2010 г.
3/28/2010 В, 28.03.2010 г. Вс, 28.03.2010 г. Воскресенье, 28.03.2010 г.

Learn more about date time formatting in:

to top

Thirds of Month Names

Here is the list of tokens that show the thirds of months as text along with nodes that are used to localize these texts:

For each of the tokens in the localization nodes you should list thirds names from first to third, separating them with the comma. It is strongly recommended to put names in <![CDATA[]]>. If you need to use comma in names themselves - you need to escape it with backslash: "\,".

Defaults are:

XML/JSON Syntax
Plain code
02   <date_time>
03     <thirds_of_month>
04       <names><![CDATA[Beginning,Middle,End]]></names>
05       <short_names><![CDATA[Beg,Mid,End]]></short_names>
06       <shortest_names><![CDATA[B,M,E]]></shortest_names>
07     </thirds_of_month>
08   </date_time>
01{
02  dateTime: {
03    thirdsOfMonth: {
04      names: "Beginning,Middle,End",
05      shortNames: "Beg,Mid,End",
06      shortestNames: "B,M,E"
07    }
08  }
09}

Sample localization according to Russian standards:

XML/JSON Syntax
Plain code
02   <date_time>
03     <thirds_of_month>
04       <names><![CDATA[Начало,Середина,Конец]]></names>
05       <short_names><![CDATA[Нач.,Сер.,Кон.]]></short_names>
06       <shortest_names><![CDATA[Н,С,К]]></shortest_names>
07     </thirds_of_month>
08   </date_time>
01{
02  dateTime: {
03    thirdsOfMonth: {
04      names: "Начало,Середина,Конец",
05      shortNames: "Нач.,Сер.,Кон.",
06      shortestNames: "Н,С,К"
07    }
08  }
09}

to top

Quarters Names

Here is the list of tokens that show quarters as text along with nodes that are used to localize these texts:

For each of the tokens in the localization nodes you should list quarters names from first to fourth, separating them with the comma. It is strongly recommended to put names in <![CDATA[]]>. If you need to use comma in names themselves - you need to escape it with backslash: "\,".

Defaults are:

XML/JSON Syntax
Plain code
02   <date_time>
03     <quarters>
04       <names><![CDATA[1st Quarter,2nd Quarter,3rd Quarter,4th Quarter]]></names>
05       <short_names><![CDATA[Qtr 1,Qtr 2,Qtr 3,Qtr 4]]></short_names>
06       <shortest_names><![CDATA[Q1,Q2,Q3,Q4]]></shortest_names>
07     </quarters>
08   </date_time>
01{
02  dateTime: {
03    quarters: {
04      names: "1st Quarter,2nd Quarter,3rd Quarter,4th Quarter",
05      shortNames: "Qtr 1,Qtr 2,Qtr 3,Qtr 4",
06      shortestNames: "Q1,Q2,Q3,Q4"
07    }
08  }
09}

Sample localization according to Russian standards:

XML/JSON Syntax
Plain code
02   <date_time>
03     <quarters>
04       <names><![CDATA[1-й Квартал,2-й Квартал,3-й Квартал,4-й Квартал]]></names>
05       <short_names><![CDATA[Квт. 1,Квт. 2,Квт. 3,Квт. 4]]></short_names>
06       <shortest_names><![CDATA[I,II,III,IV]]></shortest_names>
07     </quarters>
08   </date_time>
01{
02  dateTime: {
03    quarters: {
04      names: "1-й Квартал,2-й Квартал,3-й Квартал,4-й Квартал",
05      shortNames: "Квт. 1,Квт. 2,Квт. 3,Квт. 4",
06      shortestNames: "I,II,III,IV"
07    }
08  }
09}

to top

Semesters Names

Here is the list of tokens that show semesters as text along with nodes that are used to localize these texts:

For each of the tokens in the localization nodes you should list semesters names, separating them with the comma. It is strongly recommended to put names in <![CDATA[]]>. If you need to use comma in names themselves - you need to escape it with backslash: "\,".

Defaults are:

XML/JSON Syntax
Plain code
02   <date_time>
03     <semesters>
04       <names><![CDATA[1st Half,2nd Half]]></names>
05       <short_names><![CDATA[Half 1,Half 2]]></short_names>
06       <shortest_names><![CDATA[H1,H2]]></shortest_names>
07     </semesters>
08   </date_time>
01{
02  dateTime: {
03    semesters: {
04      names: "1st Half,2nd Half",
05      shortNames: "Half 1,Half 2",
06      shortestNames: "H1,H2"
07    }
08  }
09}

Sample localization according to Russian standards:

XML/JSON Syntax
Plain code
02   <date_time>
03     <semesters>
04       <names><![CDATA[1-е Полугодие,2-е Полугодие]]></names>
05       <short_names><![CDATA[Сем. 1,Сем. 2]]></short_names>
06       <shortest_names><![CDATA[П1,П2]]></shortest_names>
07     </semesters>
08   </date_time>
01{
02  dateTime: {
03    semesters: {
04      names: "1-е Полугодие,2-е Полугодие",
05      shortNames: "Сем. 1,Сем. 2",
06      shortestNames: "П1,П2"
07    }
08  }
09}

to top

AM/PM Designators

There are two tokens used for showing the AM/PM designators:

To change the designators use the am_string, pm_string, short_am_string and short_pm_string attributes in the <time> node.

The sample XML below shows how to set the designators for Korean:

XML/JSON Syntax
Plain code
02   <date_time>
03     <time am_string="오전" pm_string="오후" short_am_string="오전" short_pm_string="오후" />
04   </date_time>
01{
02  dateTime: {
03    time: {
04      amString: "오전",
05      pmString: "오후",
06      shortAmString: "오전",
07      shortPmString: "오후"
08    }
09  }
10}

to top

First Day of Week

Different countries have a different first day of week. In North America it's Sunday, in some European countries - Monday, in Arabian countries - Saturday, and in Afghanistan it's Friday.

It is necessary to configure what day is the week starter when using AnyChart Stock, as that is taken into account when data is grouped and approximated. When a set of points is grouped into a week - the new grouped point gets the date of the first day of the week.

By default, the first day of week is Sunday, but you can change it in the <date_time> node using the first_day_of_week attribute, which accepts these values:

The sample XML below shows how to set Monday as the first day of week:

XML/JSON Syntax
Plain code
02   <date_time first_day_of_week="Monday" />
01{
02  dateTime: {
03    firstDayOfWeek: "Monday"
04  }
05}

You can learn more about Data Grouping in:

to top

Week Rule

There are two tokens do display the number of the week in the year: %e and %ee. And you should note that different countries use different ways to calculate the number of the week.

To control the way how week number is calculated you should use week_rule attribute of <date_time> node, which can have the following values:

Value Description
FirstDay Indicates that the first week of the year starts on the first day of the year and ends before the following designated first day of the week. (Default value)
FirstFourDayWeek Indicates that the first week of the year is the first week with four or more days before the designated first day of the week.
FirstFullWeek Indicates that the first week of the year begins on the first occurrence of the designated first day of the week on or after the first day of the year.

Note: The calculation of the week number depends on the weekday, which is treated as the first day of the week in the given country. If you are changing the rule - make sure the first day of the week is set properly too: you can learn how to do that in First Day of Week section.

Table below shows how settings of week_rule attribute affects %e. First day of the week is set to Sunday:

Date FirstDay FirstFourDayWeek FirstFullWeek
Thu, 31 Dec 2009 Week: 53 (of 2009) Week: 52 (of 2009) Week: 52 (of 2009)
Fri, 1 Jan 2010 Week: 1 Week: 52 (of 2009) Week: 52 (of 2009)
Sat, 2 Jan 2010 Week: 1 Week: 52 (of 2009) Week: 52 (of 2009)
Sun, 3 Jan 2010 Week: 2 Week: 1 Week: 1
Mon, 4 Jan 2010 Week: 2 Week: 1 Week: 1
Tue, 5 Jan 2010 Week: 2 Week: 1 Week: 1
Wed, 6 Jan 2010 Week: 2 Week: 1 Week: 1
Thu, 7 Jan 2010 Week: 2 Week: 1 Week: 1
Fri, 8 Jan 2010 Week: 2 Week: 1 Week: 1
Sat, 9 Jan 2010 Week: 2 Week: 1 Week: 1
Sun, 10 Jan 2010 Week: 3 Week: 2 Week: 2
Mon, 11 Jan 2010 Week: 3 Week: 2 Week: 2
Tue, 12 Jan 2010 Week: 3 Week: 2 Week: 2

And now first day of the week is set to Monday. You can notice that in FirstFourDayWeek and FirstFullWeek columns differ from the previous table:

Date FirstDay FirstFourDayWeek FirstFullWeek
Thu, 31 Dec 2009 Week: 53 (of 2009) Week: 53 (of 2009) Week: 52 (of 2009)
Fri, 1 Jan 2010 Week: 1 Week: 53 (of 2009) Week: 52 (of 2009)
Sat, 2 Jan 2010 Week: 1 Week: 53 (of 2009) Week: 52 (of 2009)
Sun, 3 Jan 2010 Week: 1 Week: 53 (of 2009) Week: 52 (of 2009)
Mon, 4 Jan 2010 Week: 2 Week: 1 Week: 1
Tue, 5 Jan 2010 Week: 2 Week: 1 Week: 1
Wed, 6 Jan 2010 Week: 2 Week: 1 Week: 1
Thu, 7 Jan 2010 Week: 2 Week: 1 Week: 1
Fri, 8 Jan 2010 Week: 2 Week: 1 Week: 1
Sat, 9 Jan 2010 Week: 2 Week: 1 Week: 1
Sun, 10 Jan 2010 Week: 2 Week: 1 Week: 1
Mon, 11 Jan 2010 Week: 3 Week: 2 Week: 2
Tue, 12 Jan 2010 Week: 3 Week: 2 Week: 2

Sample XML below shows how to change rule of week number calculation according to German standards: week starts with Monday, rule - FirstFourDayWeek:

XML/JSON Syntax
Plain code
02   <date_time first_day_of_week="Monday" week_rule="FirstFourDayWeek" />
01{
02  dateTime: {
03    firstDayOfWeek: "Monday",
04    weekRule: "FirstFourDayWeek"
05  }
06}

to top

Number Format

In different countries numbers are written in different formats. Usually the difference is in the symbols that separate the integer and the fractional parts of a number, thousand separator symbol and, sometimes, in the way of designating negative numbers.

You can define the way how numbers are to be displayed and apply those settings to a specific number token or to all the number values displayed on the chart. Please learn more about number formatting and the applicable settings in:

to top

Date-Time Format

Another thing that varies greatly from one region to another is the date-time format itself. The same date and time appears as "1/27/2009 5:47 PM" in North America, and as "27.01.2009 17:47" in Europe.

To make the switching of the date-time format easier, AnyChart Stock allows switching the default date time formatting for all elements. You can learn how to do that in:

to top

Context Menu

By default, all the context menu items are made in English, but you can customize them. You can customize all AnyChart Stock-related context menu items (Print, Export, Save As). Learn more about localizing the context menu in:

to top

Localization Samples

This section demonstrates a couple of examples for localized charts

Russian Language

Live Sample:  Localization - Russian Language

to top

Chinese Language

Live Sample:  Localization - Chinese Language

to top

Localization and Date-Time Formatting Utility

To make the process of localization easier, we have created a special utility that allows obtaining all the settings available in AnyChart Stock for more than 130 languages and dialects with ease.

This application allows choosing the required language and the date-time format; these settings are instantly shown on the sample charts in the Preview panels.

You can adjust these settings any way you want. And when you are done with them, you can copy them from the XML or JSON Settings tabs.

This utility can be found at the AnyChart web site:

to top