You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/11/04 10:10:57 UTC

[incubator-echarts-doc] branch next updated: add locale

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-doc.git


The following commit(s) were added to refs/heads/next by this push:
     new 9b743fc  add locale
9b743fc is described below

commit 9b743fcd0c9b455989e4bb96c74792f8a5559231
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Nov 4 18:10:44 2020 +0800

    add locale
---
 en/api/echarts.md | 33 ++++++++++++++++-----------------
 zh/api/echarts.md | 29 ++++++++++++++---------------
 2 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/en/api/echarts.md b/en/api/echarts.md
index 0d24039..93c47f7 100644
--- a/en/api/echarts.md
+++ b/en/api/echarts.md
@@ -9,7 +9,8 @@ Global echarts object, which can be accessed after including `echarts.js` in scr
     devicePixelRatio?: number,
     renderer?: string,
     width?: number|string,
-    height?: number|string
+    height?: number|string,
+    locale?: string
 }) => ECharts
 ```
 Creates an ECharts instance, and returns an [echartsInstance](~echartsInstance). You shall not initialize multiple ECharts instances on a single container.
@@ -31,22 +32,11 @@ Creates an ECharts instance, and returns an [echartsInstance](~echartsInstance).
 
     Optional chart configurations; which may contain:
 
-    + `devicePixelRatio`
-
-       Ratio of one physical pixel to the size of one device independent pixels. Browser's `window.devicePixelRatio` is used by default.
-
-    + `renderer`
-
-        Supports `'canvas'` or `'svg'`. See [Render by Canvas or SVG](tutorial.html#Render%20by%20Canvas%20or%20SVG).
-
-    + `width`
-
-        Specify width explicitly, in pixel. If setting to `null`/`undefined`/`'auto'`, width of `dom` (instance container) will be used.
-
-    + `height`
-
-        Specify height explicitly, in pixel. If setting to `null`/`undefined`/`'auto'`, height of `dom` (instance container) will be used.
-
+    + `devicePixelRatio` Ratio of one physical pixel to the size of one device independent pixels. Browser's `window.devicePixelRatio` is used by default.
+    + `renderer`  Supports `'canvas'` or `'svg'`. See [Render by Canvas or SVG](tutorial.html#Render%20by%20Canvas%20or%20SVG).
+    + `width`  Specify width explicitly, in pixel. If setting to `null`/`undefined`/`'auto'`, width of `dom` (instance container) will be used.
+    + `height`  Specify height explicitly, in pixel. If setting to `null`/`undefined`/`'auto'`, height of `dom` (instance container) will be used.
+    + `locale` Specify the locale. There are two builtins: `'ZH'` and `'EN'`. Or you can use [echarts.registerLocale](~echarts.registerLocale) to register a new locale. Or supported locales can be referenced in [src/i18n](https://github.com/apache/incubator-echarts/tree/release/src/i18n)
 
 ## connect(Function)
 ```js
@@ -165,6 +155,15 @@ Get a registered map in the following format:
 Registers a theme, should be specified when [initialize the chart instance](~echarts.init).
 
 
+## registerLocale(Function)
+
+```js
+(locale: string, localeCfg: Object)
+```
+
+Registers a locale, should be specified when [initialize the chart instance](~echarts.init). See the format in [src/i18n/langEN.ts](https://github.com/apache/incubator-echarts/blob/release/src/i18n/langEN.ts)
+
+
 {{ use: echarts-graphic }}
 
 
diff --git a/zh/api/echarts.md b/zh/api/echarts.md
index 209038b..8b4e9e2 100644
--- a/zh/api/echarts.md
+++ b/zh/api/echarts.md
@@ -9,7 +9,8 @@
     devicePixelRatio?: number,
     renderer?: string,
     width?: number|string,
-    height?: number|string
+    height?: number|string,
+    locale?: string
 }) => ECharts
 ```
 创建一个 ECharts 实例,返回 [echartsInstance](~echartsInstance),不能在单个容器上初始化多个 ECharts 实例。
@@ -31,21 +32,12 @@
 
     附加参数。有下面几个可选项:
 
-    + `devicePixelRatio`
+    + `devicePixelRatio` 设备像素比,默认取浏览器的值`window.devicePixelRatio`。
+    + `renderer` 渲染器,支持 `'canvas'` 或者 `'svg'`。参见 [使用 Canvas 或者 SVG 渲染](tutorial.html#%E4%BD%BF%E7%94%A8%20Canvas%20%E6%88%96%E8%80%85%20SVG%20%E6%B8%B2%E6%9F%93)。
+    + `width` 可显式指定实例宽度,单位为像素。如果传入值为 `null`/`undefined`/`'auto'`,则表示自动取 `dom`(实例容器)的宽度。
+    + `height` 可显式指定实例高度,单位为像素。如果传入值为 `null`/`undefined`/`'auto'`,则表示自动取 `dom`(实例容器)的高度。
+    + `locale` 使用的语言,内置 `'ZH'` 和 `'EN'` 两个语言,也可以使用 [echarts.registerLocale](~echarts.registerLocale) 方法注册新的语言包。目前支持的语言见 [src/i18n](https://github.com/apache/incubator-echarts/tree/release/src/i18n)
 
-        设备像素比,默认取浏览器的值`window.devicePixelRatio`。
-
-    + `renderer`
-
-        渲染器,支持 `'canvas'` 或者 `'svg'`。参见 [使用 Canvas 或者 SVG 渲染](tutorial.html#%E4%BD%BF%E7%94%A8%20Canvas%20%E6%88%96%E8%80%85%20SVG%20%E6%B8%B2%E6%9F%93)。
-
-    + `width`
-
-        可显式指定实例宽度,单位为像素。如果传入值为 `null`/`undefined`/`'auto'`,则表示自动取 `dom`(实例容器)的宽度。
-
-    + `height`
-
-        可显式指定实例高度,单位为像素。如果传入值为 `null`/`undefined`/`'auto'`,则表示自动取 `dom`(实例容器)的高度。
 
 ## connect(Function)
 ```js
@@ -162,6 +154,13 @@ echarts.registerMap('USA', usaJson, {
 
 注册主题,用于[初始化实例](~echarts.init)的时候指定。
 
+## registerLocale(Function)
+
+```js
+(locale: string, localeCfg: Object)
+```
+
+注册语言包,用于[初始化实例](~echarts.init)的时候指定。语言包格式见 [src/i18n/langEN.ts](https://github.com/apache/incubator-echarts/blob/release/src/i18n/langEN.ts)
 
 {{ use: echarts-graphic }}
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org