Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add language detection based on user's browser #324

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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}>
Expand All @@ -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;
Expand Down
50 changes: 25 additions & 25 deletions client/src/i18n/cn/button.ts
Original file line number Diff line number Diff line change
@@ -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;
179 changes: 105 additions & 74 deletions client/src/i18n/cn/collection.ts
Original file line number Diff line number Diff line change
@@ -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;
Loading
Loading