`;
-
+ @property({ type: Object })
+ t: Function = () => '';
@property({ type: String, notify: true })
selectedNode = '';
@@ -134,8 +135,8 @@ class Legend extends PolymerElement {
@property({ type: Array })
menuSideItem = [
- { label: '调试侧', value: 'npu' },
- { label: '标杆侧', value: 'bench' },
+ { label: this.t('debug'), value: 'npu' },
+ { label: this.t('bench'), value: 'bench' },
];
@observe('selectedSide')
@@ -146,6 +147,16 @@ class Legend extends PolymerElement {
this.set('selectedMenuNode', '');
}
}
+ @observe('t')
+ _observeT(): void {
+ if (this.t) {
+ this.set('menuSideItem', [
+ { label: this.t('debug'), value: 'npu' },
+ { label: this.t('bench'), value: 'bench' },
+ ]);
+ }
+ }
+
@observe('nodelist')
_observeMenu(): void {
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_main_controler/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_main_controler/index.ts
index 74131c7c7..abbe6a3cf 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_main_controler/index.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_main_controler/index.ts
@@ -157,7 +157,7 @@ class MainController extends PolymerElement {
_getTagChanged(event): void {
const detail = event.detail;
if (!detail?.rankId || detail?.rankId >= this.tags.length) {
- Notification.show(this.t('invalid rank id'), {
+ Notification.show(this.t('invalid_rank_id'), {
position: 'middle',
duration: 2000,
theme: 'warning',
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_manual_match/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_manual_match/index.ts
index d9211712a..5bd9bf1a9 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_manual_match/index.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_manual_match/index.ts
@@ -26,6 +26,7 @@ import { PolymerElement, html } from '@polymer/polymer';
import { customElement, property, observe } from '@polymer/decorators';
import { NPU_PREFIX, BENCH_PREFIX } from '../../../common/constant';
import useMatched from './useMatched';
+import i18next from '../../../common/i18n'
import type { UseMatchedType } from '../../type';
import '../tf_search_combox/index';
@@ -97,7 +98,7 @@ class Legend extends PolymerElement {
position: absolute;
font-size: 10px;
top: 14px;
- left: 122px;
+ left: var(--question-config-left, 120px);
}
.button-wrapper {
position: relative;
@@ -125,10 +126,10 @@ class Legend extends PolymerElement {
cursor: pointer;
}
-
+
@@ -146,14 +147,14 @@ class Legend extends PolymerElement {
未匹配节点
`;
+ @property({ type: Object })
+ t: Function = () => '';
+
@property({ type: Object })
unmatched: any = [];
@@ -299,6 +303,15 @@ class Legend extends PolymerElement {
npuMatchedNodeList = {};
benchMatchedNodeList = {};
+ @observe('t')
+ _observeT(): void {
+ if (this.t) {
+ this.updateStyles({
+ '--question-config-left': i18next.language === 'zh-CN' ? '120px' : '162px',
+ });
+ }
+ }
+
@observe('unmatched')
_observeUnmatchedNode(): void {
this.set('npuUnMatchedNodes', this.unmatched.npuNodeList || []);
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/index.ts
index fc6b7b866..f5d8ed4ee 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/index.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/index.ts
@@ -197,13 +197,15 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
Date: Thu, 7 Aug 2025 14:45:29 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=A6=84=20refactor:=20=E5=88=A0?=
=?UTF-8?q?=E9=99=A4=E6=97=A0=E5=85=B3=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tb_graph_ascend/fe/package-lock.json | 31 ++++++-------------
.../components/tf_color_select/index.ts | 2 --
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
index 7843d723c..e2e1469c7 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
@@ -42,6 +42,8 @@
"d3": "^7.9.0",
"dagre": "^0.8.5",
"form-data": "^4.0.4",
+ "i18next": "^25.3.2",
+ "i18next-browser-languagedetector": "^8.2.0",
"lodash": "^4.17.21",
"prettier": "^3.4.2",
"style-loader": "^4.0.0"
@@ -62,13 +64,13 @@
"typescript": "^5.4.5",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
- "webpack-dev-server": "4.15.1",
+ "webpack-dev-server": "4.15.1"
}
},
"node_modules/@babel/runtime": {
- "version": "7.27.6",
- "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.27.6.tgz",
- "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==",
+ "version": "7.28.2",
+ "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.28.2.tgz",
+ "integrity": "sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -86,7 +88,7 @@
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.12",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
+ "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
"integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
"license": "MIT",
"dependencies": {
@@ -1957,7 +1959,7 @@
},
"node_modules/brace-expansion": {
"version": "1.1.12",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
+ "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"license": "MIT",
"dependencies": {
@@ -3430,7 +3432,7 @@
},
"node_modules/form-data": {
"version": "4.0.4",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
+ "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.4.tgz",
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
"license": "MIT",
"dependencies": {
@@ -3476,21 +3478,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC"
},
- "node_modules/fsevents": {
- "version": "2.3.3",
- "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
- "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
- "dev": true,
- "hasInstallScript": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
- }
- },
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts
index 042b06431..07601d2c6 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts
@@ -25,9 +25,7 @@ import { NPU_PREFIX, UNMATCHED_COLOR, defaultColorSetting, defaultColorSelects }
import request from '../../../utils/request';
import { DarkModeMixin } from '../../../polymer/dark_mode_mixin';
import { LegacyElementMixin } from '../../../polymer/legacy_element_mixin';
-import { PRECISION_DESC } from '../../../common/constant';
import '../tf_filter_precision_error/index'
-const UNMATCHED_NODE_NAME = '无匹配节点';
@customElement('tf-color-select')
class Legend extends LegacyElementMixin(DarkModeMixin(PolymerElement)) {
// 定义模板
--
Gitee
From cc828e63d05f23eb4dcc01c147dc784e0d4132b9 Mon Sep 17 00:00:00 2001
From: sunchao <1299792067@qq.com>
Date: Thu, 7 Aug 2025 15:05:00 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8C=88=20style:=20=E5=8A=A0=E7=89=88?=
=?UTF-8?q?=E6=9D=83=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tb_graph_ascend/fe/package-lock.json | 28 +++++++------------
.../tb_graph_ascend/fe/package.json | 12 ++++----
.../tb_graph_ascend/fe/src/common/i18n.ts | 18 ++++++++++--
3 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
index e2e1469c7..79dcfed45 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json
@@ -42,8 +42,8 @@
"d3": "^7.9.0",
"dagre": "^0.8.5",
"form-data": "^4.0.4",
- "i18next": "^25.3.2",
- "i18next-browser-languagedetector": "^8.2.0",
+ "i18next": "^23.16.8",
+ "i18next-browser-languagedetector": "^7.2.2",
"lodash": "^4.17.21",
"prettier": "^3.4.2",
"style-loader": "^4.0.0"
@@ -3982,9 +3982,9 @@
}
},
"node_modules/i18next": {
- "version": "25.3.2",
- "resolved": "https://registry.npmmirror.com/i18next/-/i18next-25.3.2.tgz",
- "integrity": "sha512-JSnbZDxRVbphc5jiptxr3o2zocy5dEqpVm9qCGdJwRNO+9saUJS0/u4LnM/13C23fUEWxAylPqKU/NpMV/IjqA==",
+ "version": "23.16.8",
+ "resolved": "https://registry.npmmirror.com/i18next/-/i18next-23.16.8.tgz",
+ "integrity": "sha512-06r/TitrM88Mg5FdUXAKL96dJMzgqLE5dv3ryBAra4KCwD9mJ4ndOTS95ZuymIGoE+2hzfdaMak2X11/es7ZWg==",
"funding": [
{
"type": "individual",
@@ -4001,21 +4001,13 @@
],
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.27.6"
- },
- "peerDependencies": {
- "typescript": "^5"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
+ "@babel/runtime": "^7.23.2"
}
},
"node_modules/i18next-browser-languagedetector": {
- "version": "8.2.0",
- "resolved": "https://registry.npmmirror.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.2.0.tgz",
- "integrity": "sha512-P+3zEKLnOF0qmiesW383vsLdtQVyKtCNA9cjSoKCppTKPQVfKd2W8hbVo5ZhNJKDqeM7BOcvNoKJOjpHh4Js9g==",
+ "version": "7.2.2",
+ "resolved": "https://registry.npmmirror.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.2.tgz",
+ "integrity": "sha512-6b7r75uIJDWCcCflmbof+sJ94k9UQO4X0YR62oUfqGI/GjCLVzlCwu8TFdRZIqVLzWbzNcmkmhfqKEr4TLz4HQ==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.23.2"
@@ -6069,7 +6061,7 @@
"version": "5.8.2",
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.8.2.tgz",
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
- "devOptional": true,
+ "dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
index 018606838..3185e4db9 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
@@ -28,6 +28,7 @@
"webpack-dev-server": "4.15.1"
},
"dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.12",
"@polymer/decorators": "^3.0.0",
"@polymer/iron-collapse": "^3.0.1",
"@polymer/iron-icon": "^3.0.1",
@@ -54,18 +55,17 @@
"@vaadin/text-field": "24.6.5",
"@vaadin/tooltip": "24.6.5",
"axios": "^1.8.4",
+ "brace-expansion": "^1.1.12",
"clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"d3": "^7.9.0",
"dagre": "^0.8.5",
- "i18next": "^25.3.2",
- "i18next-browser-languagedetector": "^8.2.0",
+ "form-data": "^4.0.4",
+ "i18next": "^23.16.8",
+ "i18next-browser-languagedetector": "^7.2.2",
"lodash": "^4.17.21",
"prettier": "^3.4.2",
- "style-loader": "^4.0.0",
- "form-data": "^4.0.4",
- "brace-expansion": "^1.1.12",
- "@jridgewell/gen-mapping": "^0.3.12"
+ "style-loader": "^4.0.0"
}
}
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts
index 18036be0c..1f0e5ca5a 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts
@@ -1,4 +1,18 @@
-// i18n.js
+/* Copyright (c) 2025, Huawei Technologies.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
@@ -7,7 +21,7 @@ i18next
.init({
fallbackLng: 'zh-CN',
resources: {
- en: {
+ 'en': {
translation: {
fit: "Fit Screen",
settings: "Settings",
--
Gitee