You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/06/11 09:18:34 UTC

[incubator-apisix-dashboard] 01/03: feat: added translation

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

juzhiyuan pushed a commit to branch feat-plugins
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit bfa0b9505db40653ae744968db2363a11bbd44aa
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu Jun 11 17:06:51 2020 +0800

    feat: added translation
---
 src/components/PluginForm/PluginForm.tsx   | 10 +++++++++-
 src/components/PluginForm/locales/en-US.ts | 13 +++++++++++++
 src/components/PluginForm/locales/zh-CN.ts | 15 +++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/components/PluginForm/PluginForm.tsx b/src/components/PluginForm/PluginForm.tsx
index ee3018f..5b69bec 100644
--- a/src/components/PluginForm/PluginForm.tsx
+++ b/src/components/PluginForm/PluginForm.tsx
@@ -108,6 +108,7 @@ const PluginForm: React.FC<PluginForm.Props> = ({
   initialData = {},
   onFinish,
 }) => {
+  const { formatMessage } = useIntl();
   const [schema, setSchema] = useState<PluginForm.PluginSchema>();
 
   useEffect(() => {
@@ -167,7 +168,14 @@ const PluginForm: React.FC<PluginForm.Props> = ({
 
         return (
           <Form.Item
-            label={propertyName}
+            label={formatMessage({
+              id: `PluginForm.plugin.${name}.property.${propertyName}`,
+              defaultMessage: propertyName,
+            })}
+            extra={formatMessage({
+              id: `PluginForm.plugin.${name}.property.${propertyName}.extra`,
+              defaultMessage: '',
+            })}
             name={propertyName}
             key={propertyName}
             rules={transformPropertyToRules(schema!, propertyName, propertyValue)}
diff --git a/src/components/PluginForm/locales/en-US.ts b/src/components/PluginForm/locales/en-US.ts
index fccd889..2c39349 100644
--- a/src/components/PluginForm/locales/en-US.ts
+++ b/src/components/PluginForm/locales/en-US.ts
@@ -17,8 +17,21 @@ export default {
     'kafka-logger is a plugin which works as a Kafka client driver for the ngx_lua nginx module.',
   'PluginForm.plugin.key-auth.desc':
     'key-auth is an authentication plugin, it should work with consumer together.',
+
+  // TODO:
   'PluginForm.plugin.limit-conn.desc':
     'Limiting request concurrency (or concurrent connections) plugin for Apisix.',
+  'PluginForm.plugin.limit-conn.property.burst': '',
+  'PluginForm.plugin.limit-conn.property.burst.extra': '',
+  'PluginForm.plugin.limit-conn.property.conn': '',
+  'PluginForm.plugin.limit-conn.property.conn.extra': '',
+  'PluginForm.plugin.limit-conn.property.default_conn_delay': '',
+  'PluginForm.plugin.limit-conn.property.default_conn_delay.extra': '',
+  'PluginForm.plugin.limit-conn.property.key': '',
+  'PluginForm.plugin.limit-conn.property.key.extra': '',
+  'PluginForm.plugin.limit-conn.property.rejected_code': '',
+  'PluginForm.plugin.limit-conn.property.rejected_code.extra': '',
+
   'PluginForm.plugin.limit-count.desc':
     'Limit request rate by a fixed number of requests in a given time window.',
   'PluginForm.plugin.limit-req.desc': 'limit request rate using the "leaky bucket" method.',
diff --git a/src/components/PluginForm/locales/zh-CN.ts b/src/components/PluginForm/locales/zh-CN.ts
index 95ebd87..306505a 100644
--- a/src/components/PluginForm/locales/zh-CN.ts
+++ b/src/components/PluginForm/locales/zh-CN.ts
@@ -17,7 +17,22 @@ export default {
     'kafka-logger 是一个插件,可用作ngx_lua nginx 模块的 Kafka 客户端驱动程序。',
   'PluginForm.plugin.key-auth.desc':
     'key-auth 是一个认证插件,它需要与 consumer 一起配合才能工作。',
+
   'PluginForm.plugin.limit-conn.desc': 'APISIX 的限制并发请求(或并发连接)插件。',
+  'PluginForm.plugin.limit-conn.property.burst': '最大并发请求数',
+  'PluginForm.plugin.limit-conn.property.burst.extra': '允许的最大并发请求数',
+  'PluginForm.plugin.limit-conn.property.conn': '可延迟并发请求数',
+  'PluginForm.plugin.limit-conn.property.conn.extra': '允许延迟的过多并发请求(或连接)的数量。',
+  'PluginForm.plugin.limit-conn.property.default_conn_delay': '默认请求延迟时间',
+  'PluginForm.plugin.limit-conn.property.default_conn_delay.extra':
+    '默认的典型连接(或请求)的处理延迟时间。',
+  'PluginForm.plugin.limit-conn.property.key': '关键字',
+  'PluginForm.plugin.limit-conn.property.key.extra':
+    '用户指定的限制并发级别的关键字,可以是客户端IP或服务端IP。',
+  'PluginForm.plugin.limit-conn.property.rejected_code': '返回状态码',
+  'PluginForm.plugin.limit-conn.property.rejected_code.extra':
+    '当请求超过阈值时返回的 HTTP 状态码, 默认值是503。',
+
   'PluginForm.plugin.limit-count.desc':
     '和 GitHub API 的限速类似, 在指定的时间范围内,限制总的请求个数。并且在 HTTP 响应头中返回剩余可以请求的个数。',
   'PluginForm.plugin.limit-req.desc': '限制请求速度的插件,使用的是漏桶算法。',