Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add test for i18n messages (#10850)

ecmadaobfe0b7b06277
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 33e5ecbdbc..90c02e6efa 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -3122,7 +3122,6 @@
"avg-rows-examined": "Avg rows examined",
"max-rows-sent": "Max rows sent",
"avg-rows-sent": "Avg rows sent",
- "rows-sent-avg": "Rows sent avg.",
"query-start-time": "Query start time",
"rows-examined": "Rows examined",
"rows-sent": "Rows sent",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 25dd780666..c0bd24804b 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -568,6 +568,7 @@
"scopes-description": "Una lista separada por espacios de ámbitos que se llevarán al acceder a la URL de autenticación",
"token-url-description": "La dirección API para obtener el token de acceso",
"user-info-url-description": "La dirección API para obtener la información del usuario mediante el token de acceso",
+ "security-protocol": "Protocolo de seguridad",
"connection-security": "Seguridad de la conexión",
"connection-security-skip-tls-verify": "Omitir verificación TLS para certificados autofirmados",
"user-information-mapping": "Mapeo de información del usuario",
@@ -1212,7 +1213,7 @@
"transfer-out-db-title": "Transferir la base de datos",
"request-export-permission": "Solicitar exportación",
"request-query-permission": "Solicitar consulta",
- "request-query-data": "Solicitar consulta"
+ "request-export-data": "Solicitar exportación"
},
"create-db": {
"new-database-name": "Nuevo nombre de la base de datos",
@@ -1743,7 +1744,7 @@
},
"recent": "Reciente",
"partitioned": "Particionado",
- "partition-tabled": "Tabla particionada",
+ "partition-tables": "Tablas de particiones",
"external-database-name": "Nombre de la base de datos externa",
"external-server-name": "Nombre del servidor externo",
"foreign-table-detail": "Detalle de la tabla externa"
@@ -2088,9 +2089,12 @@
"gitlab-self-host-application-id-label": "ID de aplicación para la aplicación OAuth de GitLab registrada en toda la instancia.",
"gitlab-com-application-id-label": "ID de aplicación para la aplicación OAuth de GitLab registrada.",
"view-in-gitlab": "Ver en GitLab",
+ "view-in-azure": "Ver en Azure",
"gitlab-self-host-secret-label": "Secreto para la aplicación OAuth de GitLab registrada en toda la instancia.",
"gitlab-com-secret-label": "Secreto para la aplicación OAuth de GitLab registrada.",
+ "azure-secret-label": "Secreto de cliente para la aplicación Azure OAuth registrada.",
"github-application-id-label": "ID de cliente para la aplicación OAuth de GitHub registrada en toda la organización.",
+ "azure-application-id-label": "Id. de cliente para la aplicación OAuth registrada en toda la organización de Azure.",
"secret-label-github": "Secreto de cliente para la aplicación OAuth de GitHub registrada en toda la organización.",
"delete-forbidden": "Para eliminar este proveedor, primero desenlaza todos los repositorios.",
"delete": "Eliminar este proveedor de Git",
@@ -2352,7 +2356,8 @@
"not-null": "No nulo",
"primary": "Primaria",
"foreign-key": "Clave foránea",
- "classification": "Clasificación"
+ "classification": "Clasificación",
+ "on-update": "En actualización"
},
"default": {
"no-default": "Sin valor predeterminado",
@@ -2935,7 +2940,6 @@
"select-or-create": "Seleccione o {crear} una conversación para comenzar.",
"exit-conversation-mode": "Salir del modo de chat",
"history-conversations": "Historial de conversaciones",
- "historial-de-conversaciones": "Ver historial de conversaciones",
"new-conversation": "Comenzar nueva conversación",
"no-message": "No hay mensajes en esta conversación",
"tips": {
@@ -3118,7 +3122,6 @@
"avg-rows-examined": "Promedio de filas examinadas",
"max-rows-sent": "Máximo de filas enviadas",
"avg-rows-sent": "Promedio de filas enviadas",
- "rows-sent-avg": "Prom. de filas enviadas",
"query-start-time": "Hora de inicio de la consulta",
"rows-examined": "Filas examinadas",
"rows-sent": "Filas enviadas",
@@ -3279,7 +3282,6 @@
"self": "Diseñador de esquemas",
"schema-design": "Esquema diseñar",
"schema-design-list": "Lista de Diseñar esquema",
- "existing-schema-design": "Diseño de esquema existente",
"new-schema-design": "Nuevo diseño de esquema",
"baseline-database": "Base de datos de referencia",
"schema-version": "Versión del esquema",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index e63a312226..2b950261ea 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1738,15 +1738,16 @@
"select-target-project": "ターゲットプロジェクトを選択してください"
},
"transfer-database-to": "データベースをソースプロジェクトからターゲットプロジェクトに転送する",
- "transfer-database-from-to": "分類",
+ "transfer-database-from-to": "データベースをソース プロジェクトからターゲット プロジェクトに転送する",
"classification": {
- "self": "最近"
- },
- "recent": "パーティション化",
- "partitioned": "パーティションテーブル",
- "partition-tables": "外部サーバー名",
- "external-server-name": "外部データベース名",
- "external-database-name": "外部テーブルの詳細"
+ "self": "分類"
+ },
+ "recent": "最近",
+ "partitioned": "パーティション",
+ "partition-tables": "パーティションテーブル",
+ "external-server-name": "外部サーバー名",
+ "external-database-name": "外部データベース名",
+ "foreign-table-detail": "外部テーブルの詳細"
},
"repository": {
"our-webhook-link": "Bytebaseによって作成されたWebhookは{webhookLink}で見つけることができます。",
@@ -2355,7 +2356,8 @@
"not-null": "非NULL",
"primary": "プライマリ",
"foreign-key": "外部キー",
- "classification": "分類"
+ "classification": "分類",
+ "on-update": "更新時"
},
"default": {
"no-default": "デフォルトなし",
@@ -3120,7 +3122,6 @@
"avg-rows-examined": "平均行数の検査",
"max-rows-sent": "最大行数の送信",
"avg-rows-sent": "平均行数の送信",
- "rows-sent-avg": "平均行数の送信",
"query-start-time": "クエリ開始時間",
"rows-examined": "行数の検査",
"rows-sent": "行数の送信",
diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.json
index e782efad85..c67472488a 100644
--- a/frontend/src/locales/sql-review/zh-CN.json
+++ b/frontend/src/locales/sql-review/zh-CN.json
@@ -20,7 +20,6 @@
"schema": "Schema",
"database": "数据库",
"index": "索引",
- "insert": "插入",
"system": "系统"
},
"template": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 5936f603b2..7f423c61fd 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -2356,7 +2356,8 @@
"not-null": "Có giá trị",
"primary": "Sơ đẳng",
"foreign-key": "Khóa ngoại",
- "classification": "Phân loại"
+ "classification": "Phân loại",
+ "on-update": "Đang cập nhật"
},
"default": {
"no-default": "Không có mặc định",
@@ -3121,7 +3122,6 @@
"avg-rows-examined": "Hàng trung bình được kiểm tra",
"max-rows-sent": "Số hàng tối đa đã được gửi",
"avg-rows-sent": "Đã gửi hàng trung bình",
- "rows-sent-avg": "Số hàng được gửi trung bình",
"query-start-time": "Thời gian bắt đầu truy vấn",
"rows-examined": "Hàng được kiểm tra",
"rows-sent": "Hàng đã gửi",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 1a2f111261..13d7d83560 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -801,6 +801,7 @@
},
"masking-level": {
"self": "脱敏程度",
+ "selet-level": "选择脱敏程度",
"masking_level_unspecified": "遵循全局",
"none": "明文",
"partial": "半脱敏",
@@ -1088,7 +1089,7 @@
"reopen": "重开",
"reopened": "重开",
"action-n-issues": "{action} {n} 个工单",
- "successfully-action-n-issues": "成功更新 {n} 个工单"
+ "successfully-updated-n-issues": "成功更新 {n} 个工单"
},
"sql-hint": {
"change-will-apply-to-all-tasks-in-tenant-mode": "改动将会应用到其他所有任务",
@@ -1691,7 +1692,8 @@
"more-version": "更多...",
"character-sets-diff-found": "Schema 之间的字符集不同",
"preview-issue": "预览工单",
- "schema-change": "Schema 变化"
+ "schema-change": "Schema 变化",
+ "generated-ddl-statement": "生成的 DDL 语句"
},
"sensitive": "敏感",
"access-denied": "您没有访问该数据库的权限",
@@ -1717,6 +1719,7 @@
"duplicated-name": "保密变量名称重复",
"name-pattern-mismatch": "秘密名称应该只由大写字母,数字和 _(下划线)组成",
"cannot-be-changed-later": "创建之后无法修改",
+ "name-is-required": "变量名必需",
"name-cannot-prefix-with-bytebase": "秘密名称不能以 'BYTEBASE_' 为前缀",
"name-cannot-start-with-number": "秘密名称不能以数字开头"
},
@@ -1741,7 +1744,7 @@
},
"recent": "最近访问",
"partitioned": "分区",
- "partition-tabled": "分区表",
+ "partition-tables": "分区表",
"external-server-name": "外部服务器名称",
"external-database-name": "外部数据库名称",
"foreign-table-detail": "外部表详情"
@@ -2318,7 +2321,6 @@
"create-table": "新建表",
"rename": "重命名",
"drop-table": "删除表",
- "drop": "删除",
"restore": "恢复",
"add-column": "添加列",
"add-from-template": "从模板添加",
@@ -2354,7 +2356,8 @@
"not-null": "不可为空",
"primary": "主键",
"foreign-key": "外键",
- "classification": "分类分级"
+ "classification": "分类分级",
+ "on-update": "更新时"
},
"default": {
"no-default": "无默认值",
@@ -2936,8 +2939,10 @@
"rename": "修改会话名称",
"select-or-create": "选择或{create}一个会话以开始。",
"exit-conversation-mode": "退出对话模式",
+ "history-conversations": "历史对话",
"view-history-conversations": "查看历史对话",
"new-conversation": "开启新对话",
+ "no-message": "无消息",
"tips": {
"suggest-prompt": "生成提示词...",
"more": "更多",
diff --git a/frontend/src/plugins/i18n-messages.ts b/frontend/src/plugins/i18n-messages.ts
new file mode 100644
index 0000000000..309508b039
--- /dev/null
+++ b/frontend/src/plugins/i18n-messages.ts
@@ -0,0 +1,28 @@
+import { merge } from "lodash-es";
+
+const localPathPrefix = "../locales/";
+
+// import i18n resources
+// https://vitejs.dev/guide/features.html#glob-import
+export const mergedLocalMessage = Object.entries(
+ import.meta.glob("../locales/**/*.json", { eager: true })
+).reduce((map, [key, value]) => {
+ const name = key.slice(localPathPrefix.length, -5);
+ const sections = name.split("/");
+ if (sections.length === 1) {
+ map[name] = merge((value as any).default, map[name] || {});
+ } else {
+ const file = sections.slice(-1)[0];
+ const sectionsName = sections[0];
+ const existed = map[file] || {};
+ map[file] = {
+ ...existed,
+ [sectionsName]: merge(
+ (value as any).default,
+ existed[sectionsName] || {}
+ ),
+ };
+ }
+
+ return map;
+}, {} as { [k: string]: any });
diff --git a/frontend/src/plugins/i18n.test.ts b/frontend/src/plugins/i18n.test.ts
new file mode 100644
index 0000000000..8b989e426b
--- /dev/null
+++ b/frontend/src/plugins/i18n.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, test } from "vitest";
+import { mergedLocalMessage } from "./i18n-messages";
+
+describe("Test i18n messages", () => {
+ for (const keyA of Object.keys(mergedLocalMessage)) {
+ for (const keyB of Object.keys(mergedLocalMessage)) {
+ if (keyA === keyB) {
+ continue;
+ }
+
+ test(`i18n message for ${keyA} and ${keyB}`, () => {
+ const missMatchKey = compareMessages(
+ mergedLocalMessage[keyA],
+ mergedLocalMessage[keyB]
+ );
+ let message = "";
+ if (missMatchKey !== "") {
+ message = `${missMatchKey} not match in ${keyA} and ${keyB}`;
+ console.error(message);
+ }
+ expect(missMatchKey).toBe("");
+ });
+ }
+ }
+});
+
+const compareMessages = (
+ localA: { [k: string]: any },
+ localB: { [k: string]: any }
+): string => {
+ for (const [key, val] of Object.entries(localA)) {
+ if (!localB[key]) {
+ return key;
+ }
+ if (typeof val === "object") {
+ if (typeof localB[key] !== "object") {
+ return key;
+ }
+ const missMatch = compareMessages(val, localB[key]);
+ if (missMatch) {
+ return `${key}.${missMatch}`;
+ }
+ }
+ }
+
+ return "";
+};
diff --git a/frontend/src/plugins/i18n.ts b/frontend/src/plugins/i18n.ts
index 27ddb12daf..0011fa9a78 100644
--- a/frontend/src/plugins/i18n.ts
+++ b/frontend/src/plugins/i18n.ts
@@ -1,8 +1,7 @@
import { useLocalStorage } from "@vueuse/core";
-import { merge } from "lodash-es";
import { createI18n } from "vue-i18n";
+import { mergedLocalMessage } from "./i18n-messages";
-const localPathPrefix = "../locales/";
const validLocaleList = ["en-US", "zh-CN", "es-ES", "ja-JP", "vi-VN"];
const getValidLocale = () => {
@@ -45,31 +44,6 @@ const getValidLocale = () => {
return "en-US";
};
-// import i18n resources
-// https://vitejs.dev/guide/features.html#glob-import
-const mergedLocalMessage = Object.entries(
- import.meta.glob("../locales/**/*.json", { eager: true })
-).reduce((map, [key, value]) => {
- const name = key.slice(localPathPrefix.length, -5);
- const sections = name.split("/");
- if (sections.length === 1) {
- map[name] = merge((value as any).default, map[name] || {});
- } else {
- const file = sections.slice(-1)[0];
- const sectionsName = sections[0];
- const existed = map[file] || {};
- map[file] = {
- ...existed,
- [sectionsName]: merge(
- (value as any).default,
- existed[sectionsName] || {}
- ),
- };
- }
-
- return map;
-}, {} as { [k: string]: any });
-
const i18n = createI18n({
legacy: false,
locale: getValidLocale(),