Skip to content

Commit

Permalink
[feature] Added multilingual defaults for forms
Browse files Browse the repository at this point in the history
  • Loading branch information
wanhao23 committed Jan 17, 2025
1 parent 43ac859 commit 835afc0
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class MonitorEditComponent implements OnInit {
}
}
define.name = this.i18nSvc.fanyi(`monitor.app.${this.monitor.app}.param.${define.field}`);
define.placeholder = define.placeholder && this.i18nSvc.fanyi(`monitor.${define.field}.tip`);
if (define.hide) {
advancedParams.push(param);
advancedParamDefines.push(define);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@
<nz-form-item>
<nz-form-label nzSpan="7" [nzFor]="'labels'" [nzTooltipTitle]="'label.bind.tip' | i18n">{{ 'label.bind' | i18n }} </nz-form-label>
<nz-form-control nzSpan="8" [nzErrorTip]="'validation.required' | i18n">
<app-labels-input [(ngModel)]="monitor.labels" name="labels"></app-labels-input>
<app-labels-input
[(ngModel)]="monitor.labels"
name="labels"
[keyAlias]="'placeholder.key' | i18n"
[valueAlias]="'placeholder.value' | i18n"
></app-labels-input>
</nz-form-control>
</nz-form-item>

Expand All @@ -140,7 +145,12 @@
>{{ 'common.annotation.bind' | i18n }}
</nz-form-label>
<nz-form-control nzSpan="8" [nzErrorTip]="'validation.required' | i18n">
<app-labels-input [(ngModel)]="monitor.annotations" name="annotation"></app-labels-input>
<app-labels-input
[(ngModel)]="monitor.annotations"
name="annotation"
[keyAlias]="'placeholder.key' | i18n"
[valueAlias]="'placeholder.value' | i18n"
></app-labels-input>
</nz-form-control>
</nz-form-item>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class MonitorNewComponent implements OnInit {
}
}
define.name = this.i18nSvc.fanyi(`monitor.app.${this.monitor.app}.param.${define.field}`);
define.placeholder = define.placeholder && this.i18nSvc.fanyi(`monitor.${define.field}.tip`);
if (define.hide) {
advancedParams.push(param);
advancedParamDefines.push(define);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
[(value)]="value"
(valueChange)="onChange($event)"
[id]="item.field"
keyAlias="Header Name"
valueAlias="Header Value"
[keyAlias]="'monitor.headerName.tip' | i18n"
[valueAlias]="'monitor.headerValue.tip' | i18n"
/>

<app-metrics-field-input
Expand Down
15 changes: 15 additions & 0 deletions web-app/src/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,16 @@
"monitor.center.help": "Monitoring Center is the monitoring resource management portal. Displays the currently added monitors in the form of list, and supports label grouping, query filtering, and access to view monitoring details. <br> You can add, modify, delete, pause monitoring, import/export, batch management, and other operations on the monitors.",
"monitor.center.help.link": "https://hertzbeat.apache.org/docs/",
"monitor.center.search.placeholder": "Search monitor type to add: Linux, Redis",
"monitor.coilRegisterAddresses.tip": "Input RegisterAddress",
"monitor.collect.time": "Collect Time",
"monitor.collect.time.tip": "Last Collect Time",
"monitor.collector": "Collector",
"monitor.collector.status.offline": "Offline",
"monitor.collector.status.online": "Online",
"monitor.collector.system.default": "Default System Dispatch",
"monitor.collector.tip": "Choose which collector to dispatch this monitoring",
"monitor.content.tip": "3025020101040",
"monitor.contentType.tip": "Request Body Type",
"monitor.copy": "Copy Monitor",
"monitor.copy-monitor": "Copy Monitor",
"monitor.copy.failed": "Copy Monitor Failed",
Expand Down Expand Up @@ -660,6 +663,9 @@
"monitor.grafana.enabled.tip": "is enabled, the monitoring data will be displayed in Grafana",
"monitor.grafana.upload.label": "Upload Grafana Template",
"monitor.grafana.upload.tip": "Upload Grafana template file, support .json file",
"monitor.headerName.tip": "Header Name",
"monitor.headerValue.tip": "Header Value",
"monitor.holdingRegisterAddresses.tip": "Input RegisterAddress",
"monitor.host": "Target Host",
"monitor.host.tip": "The monitored peer ip or domain name",
"monitor.icon.bigdata": "dot-chart",
Expand All @@ -677,6 +683,7 @@
"monitor.import": "Import Monitor",
"monitor.intervals": "Intervals",
"monitor.intervals.tip": "Monitor the interval time of periodic collection of data, unit second",
"monitor.keyword.tip": "Enter keyword which occurrences need to be monitored",
"monitor.list": "Monitor List",
"monitor.name": "Task Name",
"monitor.name.tip": "Monitoring task name",
Expand All @@ -687,9 +694,13 @@
"monitor.new.notify.change-to-https": "HTTPS has been enabled, and the port number has been automatically changed to 443. Please take note.",
"monitor.new.success": "New Monitor Success",
"monitor.not-found": "This Monitor Not Found",
"monitor.path.tip": "Exporter Url Endpoint Path",
"monitor.payload.tip": "Available When POST PUT",
"monitor.privateKey.tip": "BEGIN RSA PRIVATE KEY",
"monitor.search.app": "Type Filter",
"monitor.search.placeholder": "Search Monitor",
"monitor.search.tag": "Tag Filter",
"monitor.sitemap.tip": "Web SITEMAP EG:/sitemap.xml",
"monitor.spinning-tip.detecting": "Available Detecting",
"monitor.status": "Task Status",
"monitor.status.all": "All Status",
Expand All @@ -698,6 +709,10 @@
"monitor.status.unreachable": "Unreachable",
"monitor.status.up": "Up",
"monitor.total": "Total",
"monitor.uri.tip": "Website uri path(no ip port) EG:/console",
"monitor.url.tip": "service:jmx:rmi:///jndi/rmi://host:port/jmxrmi",
"placeholder.key": "Key",
"placeholder.value": "Value",
"plugin.delete": "Delete Plugin",
"plugin.edit": "Edit plugin",
"plugin.help": "Plugin management is used for unified management of plugins, including upload and enable/disable operations, we can use the plugin mechanism to perform some other operations after the alarm except notification. <br>For example, you can use the plugin mechanism to execute specific scripts or SQL after the alarm occurs.",
Expand Down
15 changes: 15 additions & 0 deletions web-app/src/assets/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,16 @@
"monitor.center.help": "监控中心是监控资源管理入口,以列表的形式展示当前已添加的监控,同时支持标签分组,查询过滤,查看监控详情等。<br>您可以对监控资源进行新增,修改,删除,暂停监控,导入导出,批量管理等操作。",
"monitor.center.help.link": "https://hertzbeat.apache.org/zh-cn/docs/#%E7%9B%91%E6%8E%A7%E4%B8%AD%E5%BF%83",
"monitor.center.search.placeholder": "搜索待添加监控任务的类型: Linux, Redis",
"monitor.coilRegisterAddresses.tip": "输入寄存器地址",
"monitor.collect.time": "采集时间",
"monitor.collect.time.tip": "最近采集时间",
"monitor.collector": "采集器",
"monitor.collector.status.offline": "离线",
"monitor.collector.status.online": "在线",
"monitor.collector.system.default": "默认系统调度",
"monitor.collector.tip": "配置此监控使用哪台采集器调度采集",
"monitor.content.tip": "3025020101040",
"monitor.contentType.tip": "请求正文类型",
"monitor.copy": "复制监控",
"monitor.copy-monitor": "复制监控",
"monitor.copy.failed": "复制监控失败",
Expand Down Expand Up @@ -656,6 +659,9 @@
"monitor.grafana.enabled.tip": "是否启用Grafana",
"monitor.grafana.upload.label": "上传Grafana模板",
"monitor.grafana.upload.tip": "上传Grafana的JSON文件",
"monitor.headerName.tip": "标头名称",
"monitor.headerValue.tip": "标头值",
"monitor.holdingRegisterAddresses.tip": "输入寄存器地址",
"monitor.host": "目标Host",
"monitor.host.tip": "被监控的对端IP或域名",
"monitor.icon.bigdata": "dot-chart",
Expand All @@ -673,6 +679,7 @@
"monitor.import": "导入监控",
"monitor.intervals": "监控周期",
"monitor.intervals.tip": "周期性采集数据的时间间隔,单位秒",
"monitor.keyword.tip": "输入需要监控的关键字",
"monitor.list": "监控列表",
"monitor.name": "任务名称",
"monitor.name.tip": "标识监控任务的名称",
Expand All @@ -683,9 +690,13 @@
"monitor.new.notify.change-to-https": "已开启HTTPS,端口号自动更改为 443,请留意。",
"monitor.new.success": "新增监控成功",
"monitor.not-found": "查询异常,此监控不存在",
"monitor.path.tip": "导出器Url端点路径",
"monitor.payload.tip": "可用于 POST PUT",
"monitor.privateKey.tip": "启动RSA私钥",
"monitor.search.app": "类型筛选",
"monitor.search.placeholder": "搜索监控",
"monitor.search.tag": "标签筛选",
"monitor.sitemap.tip": "网站地图 EG:/sitemap.xml",
"monitor.spinning-tip.detecting": "测试连接可用性",
"monitor.status": "任务状态",
"monitor.status.all": "全部状态",
Expand All @@ -694,6 +705,10 @@
"monitor.status.unreachable": "不可达",
"monitor.status.up": "正常",
"monitor.total": "总量",
"monitor.uri.tip": "网站 uri 路径(无 ip 端口) EG:/console",
"monitor.url.tip": "服务:jmx:rmi:///jndi/rmi://host:port/jmxrmi",
"placeholder.key": "",
"placeholder.value": "",
"plugin.delete": "刪除插件",
"plugin.edit": "编辑插件",
"plugin.help": "插件管理用于对用户自定义插件的统一管理,包括上传和,启用禁用等。我们可以通过插件机制在告警后执行一些除通知以外的其他操作。<br>例如:您可以通过插件机制实现在告警出现后,执行特定的脚本或SQL等操作。",
Expand Down
15 changes: 15 additions & 0 deletions web-app/src/assets/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,14 @@
"monitor.category.server": "服務器監控",
"monitor.category.service": "應用服務",
"monitor.category.webserver": "Web伺服器",
"monitor.coilRegisterAddresses.tip": "輸入暫存器位址",
"monitor.collector": "採集器",
"monitor.collector.status.offline": "離線",
"monitor.collector.status.online": "在線",
"monitor.collector.system.default": "默認系統調度",
"monitor.collector.tip": "配置此監控使用哪台採集器調度採集",
"monitor.content.tip": "3025020101040",
"monitor.contentType.tip": "請求正文類型",
"monitor.copy": "复制监控",
"monitor.copy-monitor": "复制监控",
"monitor.copy.failed": "复制监控失败",
Expand All @@ -613,18 +616,30 @@
"monitor.grafana.enabled.tip": "是否啓用Grafana監控",
"monitor.grafana.upload.label": "上傳Grafana模板",
"monitor.grafana.upload.tip": "上傳Grafana模板文件",
"monitor.headerName.tip": "標頭名稱",
"monitor.headerValue.tip": "標頭值",
"monitor.holdingRegisterAddresses.tip": "輸入暫存器位址",
"monitor.host": "目標Host",
"monitor.host.tip": "被監控的對端IP或域名",
"monitor.intervals": "監控周期",
"monitor.intervals.tip": "周期性采集數據的時間間隔,單位秒",
"monitor.keyword.tip": "輸入需要監控的關鍵字",
"monitor.name": "任務名稱",
"monitor.name.tip": "標識監控任務的名稱",
"monitor.path.tip": "匯出器Url端點路徑",
"monitor.payload.tip": "可用於 POST PUT",
"monitor.privateKey.tip": "啟動RSA私鑰",
"monitor.sitemap.tip": "網站地圖 EG:/sitemap.xml",
"monitor.status": "任務狀態",
"monitor.status.all": "全部狀態",
"monitor.status.down": "宕機",
"monitor.status.paused": "暫停",
"monitor.status.unreachable": "不可達",
"monitor.status.up": "正常",
"monitor.uri.tip": "網站 uri 路徑(無 ip 連接埠) EG:/console",
"monitor.url.tip": "服務:jmx:rmi:///jndi/rmi://host:port/jmxrmi",
"placeholder.key": "",
"placeholder.value": "",
"plugin.delete": "刪除插件",
"plugin.edit": "編輯插件",
"plugin.help": "外掛程式管理用於對用户自定义外掛程式的統一管理,包括上傳和,啟用停用等。我們可以透過外掛機制在警告後執行一些除通知以外的其他操作。。<br>例如:您可以透過外掛機制實現在警告出現後,執行特定的腳本或SQL等操作。",
Expand Down

0 comments on commit 835afc0

Please sign in to comment.