Browse Source

add language detection based on user's browser (#324)

* support chinese

Signed-off-by: ryjiang <jiangruiyi@gmail.com>

* trans more texts

Signed-off-by: ryjiang <jiangruiyi@gmail.com>

---------

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
78bec3a944

+ 1 - 0
client/package.json

@@ -19,6 +19,7 @@
     "file-saver": "^2.0.5",
     "filesaver": "^0.0.13",
     "i18next": "^20.3.1",
+    "i18next-browser-languagedetector": "^7.2.0",
     "papaparse": "^5.4.1",
     "react": "^18.2.0",
     "react-dom": "^18.2.0",

+ 2 - 2
client/src/components/layout/Header.tsx

@@ -70,6 +70,7 @@ const Header: FC<HeaderType> = props => {
 
   const { t: commonTrans } = useTranslation();
   const statusTrans = commonTrans('status');
+  const { t: dbTrans } = useTranslation('database');
   const BackIcon = icons.back;
   const LogoutIcon = icons.logout;
 
@@ -91,7 +92,6 @@ const Header: FC<HeaderType> = props => {
   };
 
   const dbOptions = databases.map(d => ({ value: d, label: d }));
-
   return (
     <header className={classes.header}>
       <div className={classes.contentWrapper}>
@@ -104,7 +104,7 @@ const Header: FC<HeaderType> = props => {
           )}
           {navInfo.showDatabaseSelector ? (
             <CustomSelector
-              label="Database"
+              label={dbTrans('database')}
               value={database}
               onChange={async (e: { target: { value: unknown } }) => {
                 const database = e.target.value as string;

+ 25 - 25
client/src/i18n/cn/button.ts

@@ -1,29 +1,29 @@
 const btnTrans = {
-  cancel: 'Cancel',
-  save: 'Save',
-  create: 'Create',
-  reset: 'Reset',
-  update: 'Update',
-  search: 'Search',
-  confirm: 'Confirm',
-  connect: 'Connect',
-  import: 'Import',
-  delete: 'Delete',
-  drop: 'Drop',
-  release: 'Release',
-  load: 'Load',
-  insert: 'Import Data',
-  refresh: 'Refresh',
-  next: 'Next',
-  previous: 'Previous',
-  done: 'Done',
-  vectorSearch: 'Vector search',
-  query: 'Query',
-  importSampleData: 'Import Sample data',
-  loading: 'Loading...',
-  importing: 'Importing...',
-  example: 'Example',
-  rename: 'Rename',
+  cancel: '取消',
+  save: '保存',
+  create: '创建',
+  reset: '重置',
+  update: '更新',
+  search: '搜索',
+  confirm: '确认',
+  connect: '连接',
+  import: '导入',
+  delete: '删除',
+  drop: '放弃',
+  release: '发布',
+  load: '加载',
+  insert: '导入数据',
+  refresh: '刷新',
+  next: '下一步',
+  previous: '上一步',
+  done: '完成',
+  vectorSearch: '向量搜索',
+  query: '查询',
+  importSampleData: '导入样本数据',
+  loading: '加载中...',
+  importing: '导入中...',
+  example: '生成随机向量',
+  rename: '重命名',
 };
 
 export default btnTrans;

+ 105 - 74
client/src/i18n/cn/collection.ts

@@ -1,105 +1,136 @@
 const collectionTrans = {
-  noLoadData: 'No Loaded Collection',
-  noData: 'No Collection',
+  noLoadData: '没有加载的Collection',
+  noData: '没有Collection',
 
-  rowCount: 'Approx Entity Count',
+  rowCount: '大约的Entity数量',
+  count: 'Entity数量',
 
-  create: 'Collection',
-  delete: 'delete',
-  deleteTooltip: 'Please select at least one item to delete.',
-  rename: 'rename',
-  renameTooltip: 'Please select one item to rename.',
-  newColName: 'New Collection Name',
-  alias: 'Alias',
-  aliasTooltip: 'Please select one collection to create alias',
-  download: 'Download',
-  downloadTooltip: 'Export all query results to CSV file',
-  downloadDisabledTooltip: 'Please query data before exporting',
+  create: '创建Collection',
+  delete: '删除',
+  deleteTooltip: '请至少选择一个要删除的项目。',
+  rename: '重命名',
+  renameTooltip: '请选择一个要重命名的项目。',
+  newColName: '新的Collection名称',
+  alias: '别名',
+  aliasTooltip: '请选择一个Collection创建别名',
+  download: '下载',
+  downloadTooltip: '将所有查询结果导出到CSV文件',
+  downloadDisabledTooltip: '请在导出前查询数据',
 
   collection: 'Collection',
-  entities: 'entities',
+  entities: 'Entities',
 
   // table
   id: 'ID',
-  name: 'Name',
-  nameTip: 'Collection Name',
-  status: 'Status',
-  desc: 'Description',
-  createdTime: 'Created Time',
-  maxLength: 'Max Length',
+  name: '名称',
+  features: '特性',
+  nameTip: 'Collection名称',
+  status: '状态',
+  desc: '描述',
+  createdTime: '创建时间',
+  maxLength: '最大长度',
+  dynmaicSchema: '动态schema',
 
   // table tooltip
-  aliasInfo: 'Alias can be used as collection name in vector search.',
+  aliasInfo: '别名可以在向量搜索中用作Collection名称。',
   consistencyLevelInfo:
-    'Consistency refers to the property that ensures every node or replica has the same view of data when writing or reading data at a given time.',
-  entityCountInfo: 'Approximately entity count.',
+    '一致性是指确保每个节点或副本在给定时间写入或读取数据时具有相同数据视图的属性。',
+  entityCountInfo: '大约的Entity数量。',
 
   // create dialog
-  createTitle: 'Create Collection',
-  general: 'General information',
-  schema: 'Schema',
-  consistency: 'Consistency Level',
-  consistencyLevel: 'Consistency Level',
-  description: 'Description',
-  fieldType: 'Type',
-  vectorFieldType: 'Vector Field Type',
-  fieldName: 'Field',
-  idFieldName: 'Primary Key Field',
-  vectorFieldName: 'Vector Field',
-  autoId: 'Auto ID',
-  autoIdToggleTip:
-    'Whether the primary key is automatically generated by Milvus, only suppport INT64.',
-  vectorType: 'Type',
-  idType: 'Type',
-  dimension: 'Dimension',
-  dimensionTooltip: 'Only vector type has dimension',
-  dimensionMultipleWarning: 'Dimension should be 8 multiple',
-  dimensionPositiveWarning: 'Positive number only',
-  newBtn: 'add new field',
-  nameLengthWarning: 'Name length should be less than 256',
-  nameContentWarning: 'Only numbers, letters, and underscores are allowed.',
-  nameFirstLetterWarning:
-    'Name first character must be underscore or character(a~z, A~Z)',
-  partitionKey: 'Partition Key',
+  createTitle: '创建Collection',
+  general: '一般信息',
+  schema: '模式',
+  consistency: '一致性',
+  consistencyLevel: '一致性级别',
+  description: '描述',
+  fieldType: '类型',
+  elementType: '数组类型',
+  vectorFieldType: '向量字段类型',
+  fieldName: '字段',
+  idFieldName: '主键字段',
+  vectorFieldName: '向量字段',
+  autoId: '自动ID',
+  autoIdToggleTip: '主键是否由Milvus自动生成,仅支持INT64。',
+  vectorType: '类型',
+  idType: '类型',
+  dimension: '维度',
+  dimensionTooltip: '只有向量类型有维度',
+  dimensionMultipleWarning: '维度应为8的倍数',
+  dimensionPositiveWarning: '只能是正数',
+  newBtn: '添加新字段',
+  nameLengthWarning: '名称长度应小于256',
+  nameContentWarning: '只允许数字,字母和下划线。',
+  nameFirstLetterWarning: '名称的第一个字符必须是下划线或字符(a~z, A~Z)',
+  partitionKey: '分区键',
   partitionKeyTooltip:
-    ' Milvus will store entities in a partition according to the values in the partition key field. Only one Int64 or VarChar field is suppported.',
+    'Milvus将根据分区键字段中的值在分区中存储entities。只支持一个Int64或VarChar字段。',
+  enableDynamicSchema: '启用动态模式',
 
   // load dialog
-  loadTitle: 'Load Collection',
+  loadTitle: '加载Collection',
   loadContent:
-    'All search and query operations within Milvus are executed in memory, only loaded collection can be searched.',
-  loadConfirmLabel: 'Load',
-  replicaNum: 'Replica number',
-  replicaDes: `With in-memory replicas, Milvus can load the same segment on multiple query nodes. The replica number can not exceed query node count.`,
-  enableRepica: `Enable in-memory replica`,
+    'Milvus中的所有搜索和查询操作都在内存中执行,只有加载的Collection可以被搜索。',
+  loadConfirmLabel: '加载',
+  replicaNum: '副本数量',
+  replicaDes: `有了内存副本,Milvus可以在多个查询节点上加载相同的段。副本数量不能超过查询节点数量。`,
+  enableRepica: `启用内存副本`,
 
   // release dialog
-  releaseTitle: 'Release Collection',
+  releaseTitle: '释放Collection',
   releaseContent:
-    'You are trying to release a collection with data. Please be aware that the data will no longer be available for search.',
-  releaseConfirmLabel: 'Release',
+    '你正在试图释放一个带有数据的Collection。请注意,数据将不再可用于搜索。',
+  releaseConfirmLabel: '释放',
 
   // delete dialog
-  deleteWarning: `You are trying to delete a collection with data. This action cannot be undone.`,
-  deleteDataWarning: `You are trying to delete entities. This action cannot be undone.`,
-  deleteAliasWarning: `You are trying to drop an alias. This action cannot be undone.`,
+  deleteWarning: `你正在试图删除一个带有数据的Collection。此操作无法撤销。`,
+  deleteDataWarning: `你正在试图删除entities。此操作无法撤销。`,
+  deleteAliasWarning: `你正在试图删除一个别名。此操作无法撤销。`,
 
   // collection tabs
-  partitionTab: 'Partitions',
-  schemaTab: 'Schema',
-  queryTab: 'Data Query',
-  previewTab: 'Data Preview',
-  startTip: 'Start your data query',
-  dataQuerylimits:
-    ' Please note that the maximum number of results for your data query is 16384.',
-  exprPlaceHolder: 'Please enter your data query, for example id > 0',
+  partitionTab: '分区',
+  schemaTab: '模式',
+  queryTab: '数据查询',
+  previewTab: '数据预览',
+  segmentsTab: '数据段(Segments)',
+  startTip: '开始你的数据查询',
+  dataQuerylimits: '请注意,你的数据查询的结果数量最大为16384。',
+  exprPlaceHolder: '请输入你的数据查询,例如 id > 0',
 
   // alias dialog
-  aliasCreatePlaceholder: 'Alias name',
+  aliasCreatePlaceholder: '别名',
 
   // rename dialog
-  newColNamePlaceholder: 'New Collection Name',
-  newNameInfo: 'Only numbers, letters, and underscores are allowed.',
+  newColNamePlaceholder: '新的Collection名称',
+  newNameInfo: '只允许数字,字母和下划线。',
+
+  // segment
+  segments: '数据段',
+  segPState: '持久数据段状态',
+  partitionID: '分区ID',
+  segmentID: '数据段ID',
+  num_rows: '行数',
+  q_nodeIds: '查询节点IDs',
+  q_index_name: '索引名称',
+  q_indexID: '索引ID',
+  q_state: '查询数据段状态',
+  q_mem_size: '内存大小',
+  compact: '压缩',
+  compactDialogInfo:
+    "压缩是通过组织数据段来优化存储和查询性能的过程。 <a href='https://milvus.io/blog/2022-2-21-compact.md' target='blank'>了解更多</a><br /><br /> 请注意,这个操作可能需要一些时间来完成,特别是对于大型数据集。我们建议在系统活动较低的时期或在计划的维护期间运行压缩以最小化干扰。",
+
+  // column tooltip
+  autoIDTooltip: '主键列的值由Milvus自动生成。',
+  dynamicSchemaTooltip:
+    '动态模式使用户能够在不修改现有模式的情况下向Milvus collection插入带有新字段的entities。',
+  consistencyLevelTooltip:
+    '在分布式数据库中,一致性特指确保每个节点或副本在给定时间写入或读取数据时具有相同数据视图的属性。',
+  consistencyBoundedTooltip: '它允许在一定时间内数据不一致。',
+  consistencyStrongTooltip: '它确保用户可以读取数据的最新版本。',
+  consistencySessionTooltip:
+    '它确保在同一会话中所有数据写入可以立即在读取中感知。',
+  consistencyEventuallyTooltip:
+    '没有保证读写的顺序,副本最终会在没有进一步写操作的情况下收敛到相同的状态。',
 };
 
 export default collectionTrans;

+ 38 - 38
client/src/i18n/cn/common.ts

@@ -1,52 +1,52 @@
 const commonTrans = {
   attu: {
     admin: 'Attu',
-    address: 'Milvus Address',
-    unAuth: 'Username or password is not correct',
-    username: 'Username',
-    password: 'Password',
-    optional: '(optional)',
+    address: 'Milvus地址',
+    unAuth: '用户名或密码不正确',
+    username: '用户名',
+    password: '密码',
+    optional: '(可选)',
     prometheus: 'Prometheus',
-    prometheusAddress: 'Prometheus Address',
-    prometheusInstance: 'Prometheus Instance',
-    prometheusNamespace: 'Prometheus Namespace',
+    prometheusAddress: 'Prometheus地址',
+    prometheusInstance: 'Prometheus实例',
+    prometheusNamespace: 'Prometheus命名空间',
   },
   status: {
-    loaded: 'loaded',
-    unloaded: 'unloaded',
-    error: 'error',
-    running: 'running',
-    loading: 'is loaded',
+    loaded: '已加载',
+    unloaded: '未加载',
+    error: '错误',
+    running: '运行中',
+    loading: '正在加载',
   },
   grid: {
-    action: 'action',
-    noData: 'No Data',
-    rows: 'Rows',
-    results: 'results',
-    of: 'of',
-    nextLabel: 'next page',
-    prevLabel: 'prev page',
+    action: '操作',
+    noData: '无数据',
+    rows: '',
+    results: '结果',
+    of: '',
+    nextLabel: '下一页',
+    prevLabel: '上一页',
   },
   copy: {
-    copy: 'Copy',
-    copied: 'Copied!',
-    label: 'copy button',
+    copy: '复制',
+    copied: '已复制!',
+    label: '复制按钮',
   },
-  param: 'Parameter',
-  search: 'Search by name',
-  code: 'Code View',
-  view: 'View Code',
+  param: '参数',
+  search: '按名称搜索',
+  code: '代码视图',
+  view: '查看代码',
   js: 'Node.js',
   py: 'Python',
   java: 'Java',
   community: {
-    hi: 'Hi, there!',
-    growing: 'Our growing community is here!',
-    question: 'Have question about Milvus?',
-    qr: 'Scan WeChat QR code to get access',
-    more: 'More Channels to Explore',
-    join: 'Join our growing social community today',
-    get: 'Get insight, tips and share ideas',
+    hi: '嗨,你好!',
+    growing: '我们的社区正在发展中!',
+    question: '对Milvus有疑问吗?',
+    qr: '扫描微信二维码以获取访问权限',
+    more: '更多渠道探索',
+    join: '今天就加入我们不断发展的社区吧',
+    get: '获取洞察,技巧并分享想法',
   },
   capacity: {
     b: 'B',
@@ -57,10 +57,10 @@ const commonTrans = {
     pb: 'PB',
   },
 
-  size: 'Approximate size',
-  tip: 'Use 100k vectors and 1024 segment file size as example',
-  disk: 'Disk',
-  memory: 'Memory',
+  size: '大约大小',
+  tip: '以100k向量和1024段文件大小为例',
+  disk: '磁盘',
+  memory: '内存',
 };
 
 export default commonTrans;

+ 7 - 9
client/src/i18n/cn/database.ts

@@ -1,13 +1,11 @@
 const databaseTrans = {
-  createTitle: 'Create Database',
-  databases: 'Databases',
-  database: 'Database',
-  deleteWarning:
-    'You are trying to drop a database. This action cannot be undone.',
-  databaseName: 'Database Name',
-  confirmDatabase: 'Confirm Password',
-  deleteTip:
-  'Please select at least one item to drop and the default database can not be dropped.',
+  createTitle: '创建数据库',
+  databases: '数据库',
+  database: '数据库',
+  deleteWarning: '您正在尝试删除一个数据库。此操作无法撤销。',
+  databaseName: '数据库名称',
+  confirmDatabase: '确认密码',
+  deleteTip: '请至少选择一个要删除的项目,且默认数据库不能被删除。',
 };
 
 export default databaseTrans;

+ 11 - 10
client/src/i18n/cn/dialog.ts

@@ -1,16 +1,17 @@
 const dialogTrans = {
-  deleteTipAction: 'Type',
-  deleteTipPurpose: 'to confirm.',
-  deleteTitle: `Drop {{type}}`,
-  renameTitle: `Rename {{type}}`,
-  releaseTitle: `Release {{type}}`,
-  createAlias: `Create alias for {{type}}`,
-  loadTitle: `Load {{type}}`,
+  deleteTipAction: '类型',
+  deleteTipPurpose: '以确认。',
+  deleteTitle: `删除 {{type}}`,
+  renameTitle: `重命名 {{type}}`,
+  releaseTitle: `发布 {{type}}`,
+  createAlias: `为 {{type}} 创建别名`,
+  compact: `压缩Collection {{type}}`,
+  loadTitle: `加载 {{type}}`,
 
-  loadContent: `You are trying to load a {{type}} with data. Only loaded {{type}} can be searched.`,
-  releaseContent: `You are trying to release a {{type}} with data. Please be aware that the data will no longer be available for search.`,
+  loadContent: `您正在尝试加载带有数据的 {{type}}。只有已加载的 {{type}} 可以被搜索。`,
+  releaseContent: `您正在尝试发布带有数据的 {{type}}。请注意,数据将不再可用于搜索。`,
 
-  createTitle: `Create {{type}} on "{{name}}"`,
+  createTitle: `在 "{{name}}" 上创建 {{type}}`,
 };
 
 export default dialogTrans;

+ 9 - 10
client/src/i18n/cn/index.ts

@@ -1,17 +1,16 @@
 const indexTrans = {
-  type: 'Index Type',
-  param: 'Index Parameters',
+  type: '索引类型',
+  param: '索引参数',
 
-  create: 'Index',
-  index: 'Index',
-  desc: 'Description',
+  create: '创建索引',
+  index: '索引',
+  desc: '描述',
 
-  creating: 'Creating Index',
+  creating: '正在创建索引',
 
-  metric: 'Metric Type',
-  createSuccess: 'Start creating index',
-  deleteWarning:
-    'You are trying to delete an index. This action cannot be undone.',
+  metric: '度量类型',
+  createSuccess: '开始创建索引',
+  deleteWarning: '您正在尝试删除一个索引。此操作无法撤销。',
 };
 
 export default indexTrans;

+ 27 - 27
client/src/i18n/cn/insert.ts

@@ -1,37 +1,37 @@
 const insertTrans = {
-  import: 'Import Data',
-  targetTip: 'Where to put your data',
-  file: 'File',
-  uploaderLabel: 'Choose CSV File',
-  fileNamePlaceHolder: 'No file selected',
-  sample: 'CSV Sample',
-  noteTitle: 'Note',
+  import: '导入数据',
+  targetTip: '放置数据的位置',
+  file: '文件',
+  uploaderLabel: '选择CSV文件',
+  fileNamePlaceHolder: '未选择文件',
+  sample: 'CSV样本',
+  noteTitle: '注意',
   notes: [
-    `Make sure column names in the data are same as the field label names in Schema.`,
-    `Data size should be less than 150MB and the number of rows should be less than 100000, for the data to be imported properly.`,
-    `The "Import Data" option will only append new records. You cannot update existing records using this option.`,
+    `确保数据中的列名与Schema中的字段标签名相同。`,
+    `数据大小应小于150MB,行数应小于100000,以便正确导入数据。`,
+    `"导入数据"选项只会添加新记录。您不能使用此选项更新现有记录。`,
   ],
-  overSizeWarning: 'File data size should less than {{size}}MB',
-  isContainFieldNames: 'First row contains field names?',
+  overSizeWarning: '文件数据大小应小于{{size}}MB',
+  isContainFieldNames: '第一行包含字段名?',
 
-  uploadFileDisableTooltip: 'Please select collection before uploading',
-  uploadFieldNamesLenWarning:
-    'Uploaded data column count is not equal to schema count',
-  uploadAutoIdFieldWarning:
-    'AutoId field ({{fieldName}}) does not require data',
+  uploadFileDisableTooltip: '上传前请先选择Collection',
+  uploadFieldNamesLenWarning: '上传的数据列数与模式计数不相等',
+  uploadAutoIdFieldWarning: 'AutoId字段({{fieldName}})不需要数据',
 
-  previewTipData: 'Data Preview(Top 4 rows shown)',
-  previewTipAction: '*Change header cell selector value to edit field name',
-  requiredFieldName: 'Field Name*',
+  previewTipData: '数据预览(显示前4行)',
+  previewTipAction: '*更改标题单元格选择器值以编辑字段名',
+  requiredFieldName: '字段名*',
 
-  statusLoading: 'Your data is importing now...It may take few minutes',
-  statusLoadingTip: 'Please wait patiently, thank you',
-  statusSuccess: 'Import Data Successfully!',
-  statusError: 'Import Data Failed!',
+  statusLoading: '您的数据正在导入中...可能需要几分钟',
+  statusLoadingTip: '请耐心等待,谢谢',
+  statusSuccess: '数据导入成功!',
+  statusError: '数据导入失败!',
 
-  importSampleData: 'Import sample data into {{collection}}',
-  sampleDataSize: 'Choose sample data size',
-  importSampleDataDesc: `Import random data based on the collection's schema.`
+  importSampleData: '将样本数据导入到{{collection}}',
+  sampleDataSize: '选择样本数据大小',
+  importSampleDataDesc: `此功能导入与Collection模式匹配的随机生成的数据。对于测试和开发很有用。点击下载按钮获取数据。`,
+  downloadSampleDataCSV: `下载样本CSV数据`,
+  downloadSampleDataJSON: `下载样本JSON数据`,
 };
 
 export default insertTrans;

+ 5 - 5
client/src/i18n/cn/nav.ts

@@ -1,10 +1,10 @@
 const navTrans = {
-  overview: 'Overview',
+  overview: '概览',
   collection: 'Collection',
-  console: 'Search Console',
-  search: 'Vector Search',
-  system: 'System View',
-  user: 'User',
+  console: '搜索控制台',
+  search: '向量搜索',
+  system: '系统视图',
+  user: '用户',
 };
 
 export default navTrans;

+ 19 - 5
client/src/i18n/cn/overview.ts

@@ -1,9 +1,23 @@
 const overviewTrans = {
-  load: 'Loaded Collections',
-  all: 'All Collections',
-  data: 'Entities',
-  rows: '{{number}}',
-  loading: 'Loading Collections',
+  load: '已加载的Collection',
+  all: '所有Collection',
+  data: '大约的Entity数量',
+  rows: '{{number}}行',
+  loading: '正在加载Collection',
+  sysInfo: '系统信息',
+  database: '数据库',
+  milvusVersion: 'Milvus版本',
+  upTime: '运行时间',
+  deployMode: '部署模式',
+  databases: '数据库',
+  users: '用户',
+  roles: '角色',
+  days: '天',
+  hours: '小时',
+  minutes: '分钟',
+  dataNodes: '数据节点',
+  queryNodes: '查询节点',
+  indexNodes: '索引节点',
 };
 
 export default overviewTrans;

+ 12 - 13
client/src/i18n/cn/partition.ts

@@ -1,22 +1,21 @@
 const partitionTrans = {
-  create: 'Partition',
-  delete: 'Delete partition',
+  create: '创建分区',
+  delete: '删除分区',
 
-  partition: 'Partition',
+  partition: '分区',
 
   id: 'ID',
-  name: 'Name',
-  createdTime: 'Created Time',
-  status: 'Status',
-  rowCount: 'Approx Entity Count',
-  tooltip: 'Approximately entity count.',
+  name: '名称',
+  createdTime: '创建时间',
+  status: '状态',
+  rowCount: '大约Entity数量',
+  tooltip: '大约Entity数量。',
 
-  createTitle: 'Create Partition',
-  nameWarning: '_default is reserved, cannot be used as name',
+  createTitle: '创建分区',
+  nameWarning: '_default分区是保留的,不能用作名称',
 
-  deleteWarning:
-    'You are trying to delete partition. This action cannot be undone.',
-  deletePartitionError: 'default partition cannot be dropped',
+  deleteWarning: '您正在尝试删除分区。此操作无法撤销。',
+  deletePartitionError: '默认分区不能被删除',
 };
 
 export default partitionTrans;

+ 5 - 5
client/src/i18n/cn/prometheus.ts

@@ -1,10 +1,10 @@
 const prometheusTrans = {
-  ready: 'Prometheus is ready.',
-  invalid: 'Prometheus configuration is invalid.',
+  ready: 'Prometheus已准备好。',
+  invalid: 'Prometheus配置无效。',
 
-  totalCount: 'Total Count',
-  searchCount: 'Search Count',
-  searchLatency: 'Search Latency',
+  totalCount: '总数',
+  searchCount: '搜索次数',
+  searchLatency: '搜索延迟',
 };
 
 export default prometheusTrans;

+ 15 - 14
client/src/i18n/cn/search.ts

@@ -1,19 +1,20 @@
 const searchTrans = {
-  firstTip: '2. Enter search vector {{dimensionTip}}',
-  secondTip: '1. Choose collection and field',
-  thirdTip: '3. Set search parameters',
-  vectorPlaceholder: 'Please input your vector value here, e.g. [1, 2, 3, 4]',
-  collection: 'Choose loaded collection',
-  noCollection: 'No loaded collection',
-  field: 'Choose vector field',
-  startTip: 'Start your vector search',
-  empty: 'No result',
-  result: 'Search Results',
+  firstTip: '2. 输入搜索向量 {{dimensionTip}}',
+  secondTip: '1. 选择Collection和字段',
+  thirdTip: '3. 设置搜索参数',
+  vectorPlaceholder: '请在此输入您的向量值,例如 [1, 2, 3, 4]',
+  collection: '选择已加载的Collection',
+  noCollection: '没有已加载的Collection',
+  field: '选择向量字段',
+  startTip: '开始您的向量搜索',
+  empty: '无结果',
+  result: '搜索结果',
   topK: 'TopK {{number}}',
-  filter: 'Advanced Filter',
-  vectorValueWarning: 'Vector value should be an array of length {{dimension}}',
-  timeTravel: 'Time Travel',
-  timeTravelPrefix: 'Data before',
+  filter: '高级过滤',
+  vectorValueWarning: '向量值应为长度为{{dimension}}的数组',
+  timeTravel: '时间旅行',
+  timeTravelPrefix: '之前的数据',
+  dynamicFields: '动态字段',
 };
 
 export default searchTrans;

+ 7 - 7
client/src/i18n/cn/success.ts

@@ -1,11 +1,11 @@
 const successTrans = {
-  connect: 'Connection to milvus successful',
-  create: `{{name}} has been created.`,
-  load: `{{name}} is loading.`,
-  delete: `{{name}} successfully dropped.`,
-  release: `{{name}} has been released.`,
-  update: `{{name}} has been updated.`,
-  rename: `{{name}} has been renamed.`,
+  connect: '成功连接到milvus',
+  create: `{{name}}已被创建。`,
+  load: `{{name}}正在加载。`,
+  delete: `{{name}}已成功删除。`,
+  release: `{{name}}已被释放。`,
+  update: `{{name}}已被更新。`,
+  rename: `{{name}}已被重命名。`,
 };
 
 export default successTrans;

+ 18 - 18
client/src/i18n/cn/systemView.ts

@@ -1,22 +1,22 @@
 const systemViewTrans = {
-  diskTitle: 'disk',
-  memoryTitle: 'memory',
-  qpsTitle: 'qps',
-  latencyTitle: 'latency',
-  hardwareTitle: 'hardware',
-  configTitle: 'config',
-  valueTitle: 'value',
-  systemTitle: 'system',
-  thName: 'Node Name',
-  thIP: 'IP',
-  thCPUCount: 'CPU Core Count',
-  thCPUUsage: 'CPU Core Usage',
-  thDiskUsage: 'Disk Usage',
-  thMemUsage: 'Memory Usage',
-  thVersion: 'version',
-  thDeployMode: 'deploy mode',
-  thCreateTime: 'create time',
-  thUpdateTime: 'updated time',
+  diskTitle: '磁盘',
+  memoryTitle: '内存',
+  qpsTitle: '每秒查询率',
+  latencyTitle: '延迟',
+  hardwareTitle: '硬件',
+  configTitle: '配置',
+  valueTitle: '',
+  systemTitle: '系统',
+  thName: '节点名称',
+  thIP: 'IP地址',
+  thCPUCount: 'CPU核心数',
+  thCPUUsage: 'CPU使用率',
+  thDiskUsage: '磁盘使用率',
+  thMemUsage: '内存使用率',
+  thVersion: '版本',
+  thDeployMode: '部署模式',
+  thCreateTime: '创建时间',
+  thUpdateTime: '更新时间',
 };
 
 export default systemViewTrans;

+ 26 - 27
client/src/i18n/cn/user.ts

@@ -1,37 +1,36 @@
 const userTrans = {
-  createTitle: 'Create User',
-  updateTitle: 'Update Milvus User',
-  updateRoleTitle: 'Update User Roles',
-  user: 'User',
-  users: 'Users',
-  deleteWarning: 'You are trying to drop user. This action cannot be undone.',
-  oldPassword: 'Current Password',
-  newPassword: 'New Password',
-  confirmPassword: 'Confirm Password',
-  update: 'Update password',
-  isNotSame: 'Not same as new password',
-  deleteTip:
-    'Please select at least one item to drop and the root user can not be dropped.',
+  createTitle: '创建用户',
+  updateTitle: '更新Milvus用户',
+  updateRoleTitle: '更新用户角色',
+  user: '用户',
+  users: '用户们',
+  deleteWarning: '您正在尝试删除用户。此操作无法撤销。',
+  oldPassword: '当前密码',
+  newPassword: '新密码',
+  confirmPassword: '确认密码',
+  update: '更新密码',
+  isNotSame: '与新密码不同',
+  deleteTip: '请至少选择一个要删除的项目,不能删除root用户。',
 
   // role
-  deleteEditRoleTip: 'root role is not editable.',
-  disableEditRolePrivilegeTip: 'admin and public role are not editable.',
+  deleteEditRoleTip: 'root角色不可编辑。',
+  disableEditRolePrivilegeTip: 'admin和public角色不可编辑。',
 
-  role: 'Role',
-  editRole: 'Edit Role',
-  roles: 'Roles',
-  createRoleTitle: 'Create Role',
-  updateRolePrivilegeTitle: 'Update Role',
-  updateRoleSuccess: 'User Role',
-  type: 'Type',
+  role: '角色',
+  editRole: '编辑角色',
+  roles: '角色',
+  createRoleTitle: '创建角色',
+  updateRolePrivilegeTitle: '更新角色',
+  updateRoleSuccess: '用户角色',
+  type: '类型',
 
   // Privileges
-  privileges: 'Privileges',
-  objectCollection: 'Collection',
-  objectGlobal: 'Global',
-  objectUser: 'User',
+  privileges: '权限',
+  objectCollection: '集合',
+  objectGlobal: '全局',
+  objectUser: '用户',
 
-  forceDelLabel: 'Force delete, revoke all privileges.',
+  forceDelLabel: '强制删除,撤销所有权限。',
 };
 
 export default userTrans;

+ 8 - 8
client/src/i18n/cn/warning.ts

@@ -1,13 +1,13 @@
 const warningTrans = {
-  required: '{{name}} is required',
-  requiredOnly: 'Required',
-  positive: '{{name}} should be positive',
-  integer: '{{name}} should be integers',
-  range: 'Range is {{min}} ~ {{max}}',
+  required: '{{name}} 是必需的',
+  requiredOnly: '必需的',
+  positive: '{{name}} 应为正数',
+  integer: '{{name}} 应为整数',
+  range: '范围是 {{min}} ~ {{max}}',
   specValueOrRange:
-    '{{name}} should be {{specValue}}, or in range {{min}} ~ {{max}}',
+    '{{name}} 应为 {{specValue}},或在范围 {{min}} ~ {{max}} 内',
   noSupportIndexType:
-    'Attu has not supported {{type}} yet. Please change another field',
+    'Attu 还不支持 {{type}}。请更换其他字段',
 };
 
-export default warningTrans;
+export default warningTrans;

+ 3 - 3
client/src/i18n/index.ts

@@ -1,5 +1,6 @@
 import i18n from 'i18next';
 import { initReactI18next } from 'react-i18next';
+import LanguageDetector from 'i18next-browser-languagedetector';
 
 import commonCn from './cn/common';
 import commonEn from './en/common';
@@ -35,7 +36,7 @@ import prometheusTransEn from './en/prometheus';
 import prometheusTransCn from './cn/prometheus';
 
 export const resources = {
-  cn: {
+  'zh-CN': {
     translation: commonCn,
     btn: buttonCn,
     warning: warningCn,
@@ -79,10 +80,9 @@ export const resources = {
 i18n
   // detect user language
   // learn more: https://github.com/i18next/i18next-browser-languageDetector
-  // .use(LanguageDetector)
+  .use(LanguageDetector)
   .use(initReactI18next) // passes i18n down to react-i18next
   .init({
-    lng: 'en',
     fallbackLng: 'en',
     resources,
     keySeparator: false, // we do not use keys in form messages.welcome

+ 8 - 1
client/yarn.lock

@@ -328,7 +328,7 @@
   dependencies:
     regenerator-runtime "^0.13.10"
 
-"@babel/runtime@^7.22.5":
+"@babel/runtime@^7.22.5", "@babel/runtime@^7.23.2":
   version "7.23.4"
   resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.4.tgz#36fa1d2b36db873d25ec631dcc4923fdc1cf2e2e"
   integrity sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==
@@ -2681,6 +2681,13 @@ hyphenate-style-name@^1.0.3:
   resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
   integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==
 
+i18next-browser-languagedetector@^7.2.0:
+  version "7.2.0"
+  resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz#de0321cba6881be37d82e20e4d6f05aa75f6e37f"
+  integrity sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==
+  dependencies:
+    "@babel/runtime" "^7.23.2"
+
 i18next@^20.3.1:
   version "20.6.1"
   resolved "https://registry.yarnpkg.com/i18next/-/i18next-20.6.1.tgz#535e5f6e5baeb685c7d25df70db63bf3cc0aa345"