01 | { |
02 | genitiveNames: "Января,Февраля,Марта,Апреля,Мая,Июня,Июля,Августа,Сентября,Октября,Ноября,Декабря" , |
03 | genitiveShortNames: "Янв,Фев,Мар,Апр,Мая,Июн,Июл,Авг,Сен,Окт,Ноя,Дек" |
04 | } |
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.
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:
Note: it is recommended to use <![CDATA[]]> section, even there are no non-latin symbols.
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.
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:
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:
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:
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 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:
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:
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:
Sample localization according to Russian standards:
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:
Sample localization according to Russian standards:
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:
Sample localization according to Russian standards:
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:
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:
You can learn more about Data Grouping in:
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:
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:
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:
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:
This section demonstrates a couple of examples for localized charts
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: