Просмотр исходного кода

docs: add missing descriptions for license schema fields

Thales Macedo Garitezi 3 лет назад
Родитель
Сommit
900c6ec43e

+ 81 - 0
lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf

@@ -0,0 +1,81 @@
+emqx_license_schema {
+  license_root {
+    desc {
+      en: """
+      EMQX Enterprise license.
+      A license is either a `key` or a `file`.
+      When `key` and `file` are both configured, `key` is used.
+
+      EMQX by default starts with a trial license.  For a different license,
+      visit https://www.emqx.com/apply-licenses/emqx to apply.
+      """
+      zh: """
+      EMQX企业许可证。
+      许可证是一个`钥匙'或一个`文件'。
+      当 "key "和 "file "都被配置时,使用 "key"。
+
+      EMQX默认以一个试用许可证开始。 对于不同的许可证。
+      请访问https://www.emqx.com/apply-licenses/emqx 来申请。
+      """
+    }
+    label {
+      en: "License"
+      zh: "许可证"
+    }
+  }
+
+  license_type_field {
+    desc {
+      en: "License type"
+      zh: "许可证类型"
+    }
+    label {
+      en: "License type"
+      zh: "许可证类型"
+    }
+  }
+
+  key_field {
+    desc {
+      en: "License string"
+      zh: "许可证字符串"
+    }
+    label {
+      en: "License string"
+      zh: "许可证字符串"
+    }
+  }
+
+  file_field {
+    desc {
+      en: "Path to the license file"
+      zh: "许可证文件的路径"
+    }
+    label {
+      en: "Path to the license file"
+      zh: "许可证文件的路径"
+    }
+  }
+
+  connection_low_watermark_field {
+    desc {
+      en: "Low watermark limit below which license connection quota usage alarms are deactivated"
+      zh: "低水位限制,低于此水位的许可证连接配额使用警报被停用"
+    }
+    label {
+      en: "Connection low watermark"
+      zh: "连接低水印"
+    }
+  }
+
+  connection_high_watermark_field {
+    desc {
+      en: "High watermark limit above which license connection quota usage alarms are activated"
+      zh: "高水位限制,超过这个水位就会启动许可证连接配额使用警报"
+    }
+    label {
+      en: "Connection high watermark"
+      zh: "连接高水位"
+    }
+  }
+}

+ 14 - 15
lib-ee/emqx_license/src/emqx_license_schema.erl

@@ -5,6 +5,7 @@
 -module(emqx_license_schema).
 
 -include_lib("typerefl/include/types.hrl").
+-include_lib("hocon/include/hoconsc.hrl").
 
 %%------------------------------------------------------------------------------
 %% hocon_schema callbacks
@@ -26,13 +27,7 @@ roots() ->
             hoconsc:mk(
                 license_type(),
                 #{
-                    desc =>
-                        "EMQX Enterprise license.\n"
-                        "A license is either a `key` or a `file`.\n"
-                        "When `key` and `file` are both configured, `key` is used.\n"
-                        "\n"
-                        "EMQX by default starts with a trial license.  For a different license,\n"
-                        "visit https://www.emqx.com/apply-licenses/emqx to apply.\n"
+                    desc => ?DESC(license_root)
                 }
             )}
     ].
@@ -41,18 +36,20 @@ fields(key_license) ->
     [
         {type, #{
             type => key,
-            required => true
+            required => true,
+            desc => ?DESC(license_type_field)
         }},
         {key, #{
             type => string(),
             %% so it's not logged
             sensitive => true,
             required => true,
-            desc => "License string"
+            desc => ?DESC(key_field)
         }},
         {file, #{
             type => string(),
-            required => false
+            required => false,
+            desc => ?DESC(file_field)
         }}
         | common_fields()
     ];
@@ -60,17 +57,19 @@ fields(file_license) ->
     [
         {type, #{
             type => file,
-            required => true
+            required => true,
+            desc => ?DESC(license_type_field)
         }},
         {key, #{
             type => string(),
             %% so it's not logged
             sensitive => true,
-            required => false
+            required => false,
+            desc => ?DESC(key_field)
         }},
         {file, #{
             type => string(),
-            desc => "Path to the license file"
+            desc => ?DESC(file_field)
         }}
         | common_fields()
     ].
@@ -87,12 +86,12 @@ common_fields() ->
         {connection_low_watermark, #{
             type => emqx_schema:percent(),
             default => "75%",
-            desc => ""
+            desc => ?DESC(connection_low_watermark_field)
         }},
         {connection_high_watermark, #{
             type => emqx_schema:percent(),
             default => "80%",
-            desc => ""
+            desc => ?DESC(connection_high_watermark_field)
         }}
     ].