You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/11/02 06:24:12 UTC
[echarts-doc] 01/01: fix(calendar): improve the calendar `nameMap`
document. (apache/echarts#15935)
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch calendar-i18n
in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
commit c0b247ffae0effc1ae04e5bad97eb367b1dfdf37
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Tue Nov 2 14:20:43 2021 +0800
fix(calendar): improve the calendar `nameMap` document. (apache/echarts#15935)
---
en/option/component/calendar.md | 91 +++++++++++++++++++++++-----------------
zh/option/component/calendar.md | 92 +++++++++++++++++++++++++----------------
2 files changed, 110 insertions(+), 73 deletions(-)
diff --git a/en/option/component/calendar.md b/en/option/component/calendar.md
index 14b3239..ff14849 100644
--- a/en/option/component/calendar.md
+++ b/en/option/component/calendar.md
@@ -228,29 +228,40 @@ Options:
+ 'start'
+ 'end'
-### nameMap(string|Array) = 'en'
+### nameMap(string|Array)
-<ExampleUIControlEnum options="en,cn" default="en" />
+<ExampleUIControlEnum options="EN,ZH" default="EN" />
-Week text content, defaults to 'en';
-It supports Chinese, English, and custom;
-index 0 always means Sunday;
+Week text content, defaults to 'en'. Since `v5.2.2`, it defaults to the specified `locale` name when [initializing charts](api.html#echarts.init). If not specified, it defaults to the auto-detected locale by the browser language.
+
+It supports Chinese(`cn`), English(`en`), and customized array. Since `v5.2.2`, it also supports any built-in(`EN`/`ZH`) or other registered locale names (case-sensitive).
+
+The index `0` always means `Sunday`.
Examples:
```js
+// Before v5.2.2
+
// shortcut to English ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
-nameMap: 'en'
+nameMap: 'en',
+// shortcut to Chinese ['日', '一', '二', '三', '四', '五', '六']
+nameMap: 'cn',
+// Since v5.2.2
+
+// shortcut to English ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
+nameMap: 'EN',
// shortcut to Chinese ['日', '一', '二', '三', '四', '五', '六']
-nameMap: 'cn'
+nameMap: 'ZH',
-// Custom settings: mixed in English and Chinese or not displayed
+// Customized: mixed in English and Chinese or not displayed
nameMap: ['S', '一', 'T', '三', '', '五', 'S'],
calendar: [{
dayLabel: {
- nameMap: 'en'
+ // nameMap: 'en' // Before v5.2.2
+ nameMap: 'EN' // Since v5.2.2
}
}]
```
@@ -296,45 +307,49 @@ Options:
+ 'start'
+ 'end'
-### nameMap(string|Array) = 'en'
+### nameMap(string|Array)
+
+<ExampleUIControlEnum options="EN,ZH" default="EN" />
-<ExampleUIControlEnum options="en,cn" default="en" />
+Month text content, defaults to 'en'. Since `v5.2.2`, it defaults to the specified `locale` name when [initializing charts](api.html#echarts.init). If not specified, it defaults to the auto-detected locale by the browser language.
-Month text content, defaults to 'en';
-It supports Chinese, English, and custom;
-Index 0 always means Jan;
+It supports Chinese(`cn`), English(`en`), and customized array. Since `v5.2.2`, it also supports any built-in(`EN`/`ZH`) or other registered locale names (case-sensitive).
+The index `0` always means `Jan`.
Examples:
```js
-// Shortcut to English [
- 'Jan', 'Feb', 'Mar',
- 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'
- ],
-nameMap: 'en'
-
-// Shortcut to Chinese [
- '一月', '二月', '三月',
- '四月', '五月', '六月',
- '七月', '八月', '九月',
- '十月', '十一月', '十二月'
- ]
-nameMap: 'cn'
-
-// Custom settings: mixed in English and Chinese or not displayed
-nameMap: [
- '一月', 'Feb', '三月',
- '四月', 'May', '六月',
- '七月', '八月', '',
- '十月', 'Nov', '十二月'
- ],
+// Before v5.2.2
+
+// Shortcut to English
+// ['Jan', 'Feb', 'Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+nameMap: 'en',
+// Shortcut to Chinese
+// ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
+nameMap: 'cn',
+
+// Since v5.2.2
+
+// Shortcut to English
+// ['Jan', 'Feb', 'Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+nameMap: 'EN',
+// Shortcut to Chinese
+// ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
+nameMap: 'ZH',
+
+// Customized settings: mixed in English, Chinese, Russian or not displayed
+nameMap: [
+ '一月', 'Feb', '三月',
+ '四月', 'May', '六月',
+ 'Июль', '八月', '',
+ '十月', 'Nov', '十二月'
+],
calendar: [{
monthLabel: {
- nameMap: 'en'
+ // nameMap: 'en' // Before v5.2.2
+ nameMap: 'EN' // Since v5.2.2
}
}]
```
diff --git a/zh/option/component/calendar.md b/zh/option/component/calendar.md
index 37ef663..c6b7db8 100644
--- a/zh/option/component/calendar.md
+++ b/zh/option/component/calendar.md
@@ -278,26 +278,40 @@ calendar: [{
+ 'start'
+ 'end'
-### nameMap(string|Array) = 'en'
+### nameMap(string|Array)
-<ExampleUIControlEnum options="en,cn" default="en" />
+<ExampleUIControlEnum options="EN,ZH" default="EN" />
-星期显示的效果,默认为'en'
-可设置中英文以及自定义
-下标0为对应星期天的文字显示
+星期显示的效果,默认为'en'。从 `v5.2.2` 起,默认为[初始化图表](api.html#echarts.init) 时指定的语言 `locale`,如未指定则根据浏览器语言自动侦测。
+
+可设置中英文以及自定义。从 `v5.2.2` 起,还可以是任意内置(`ZH` / `EN`)或其他[已注册的语言包](api.html#echarts.registerLocale)名称(区分大小写)。
+
+下标 `0` 为对应 `星期日` 的文字显示
使用示例:
```js
-// 快捷设置英文 ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
-nameMap: 'en'
+
+// v5.2.2 以前版本
+
+// 快捷设置英文 ['S', 'M', 'T', 'W', 'T', 'F', 'S']
+nameMap: 'en',
// 快捷设置中文 ['日', '一', '二', '三', '四', '五', '六']
-nameMap: 'cn'
+nameMap: 'cn',
+
+// v5.2.2 及以后版本
+
+// 快捷设置英文 ['S', 'M', 'T', 'W', 'T', 'F', 'S']
+nameMap: 'EN',
+// 快捷设置中文 ['日', '一', '二', '三', '四', '五', '六']
+nameMap: 'ZH',
+
// 自定义设置: 中英文混杂 或者不显示
nameMap: ['S', '一', 'T', '三', '', '五', 'S'],
calendar: [{
dayLabel: {
- nameMap: 'en'
+ // nameMap: 'en' // v5.2.2 以前版本
+ nameMap: 'EN' // v5.2.2 及以后版本
}
}]
```
@@ -343,41 +357,49 @@ calendar: [{
+ 'start'
+ 'end'
-### nameMap(string|Array) = 'en'
+### nameMap(string|Array)
-<ExampleUIControlEnum options="en,cn" default="en" />
+<ExampleUIControlEnum options="EN,ZH" default="EN" />
-月份显示的效果,默认为'en'
-可设置中英文以及自定义
-下标0为对应一月的文字显示
+月份显示的效果,默认为'en'。从 `v5.2.2` 起,默认为[初始化图表](api.html#echarts.init) 时指定的语言 `locale`,如未指定则根据浏览器语言自动侦测。
+
+可设置中英文以及自定义。从 `v5.2.2` 起,还可以是任意内置(`ZH` / `EN`)或其他[已注册的语言包](api.html#echarts.registerLocale)名称(区分大小写)。
+
+下标 `0` 为对应 `1月` 的文字显示。
使用示例:
```js
-// 快捷设置英文 [
- 'Jan', 'Feb', 'Mar',
- 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'
- ],
-nameMap: 'en'
-// 快捷设置中文 [
- '一月', '二月', '三月',
- '四月', '五月', '六月',
- '七月', '八月', '九月',
- '十月', '十一月', '十二月'
- ]
-nameMap: 'cn'
-// 自定义设置: 中英文混杂 或者不显示
+
+// v5.2.2 以前版本
+
+// 快捷设置英文
+// ['Jan', 'Feb', 'Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+nameMap: 'en',
+// 快捷设置中文
+// ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
+nameMap: 'cn',
+
+// v5.2.2 及以后版本
+
+// 快捷设置英文
+// ['Jan', 'Feb', 'Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+nameMap: 'EN',
+// 快捷设置中文
+// ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
+nameMap: 'ZH',
+
+// 自定义设置:中英俄混杂 或者不显示
nameMap: [
- '一月', 'Feb', '三月',
- '四月', 'May', '六月',
- '七月', '八月', '',
- '十月', 'Nov', '十二月'
- ],
+ '一月', 'Feb', '三月',
+ '四月', 'May', '六月',
+ 'Июль', '八月', '',
+ '十月', 'Nov', '十二月'
+],
calendar: [{
monthLabel: {
- nameMap: 'en'
+ // nameMap: 'en' // v5.2.2 以前版本
+ nameMap: 'EN' // v5.2.2 及以后版本
}
}]
```
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org