From 21e5f00a533430a9e8dd0e5168224ec545aedeff Mon Sep 17 00:00:00 2001
From: euvre <93761161+euvre@users.noreply.github.com>
Date: Wed, 22 Jul 2026 16:13:20 +0800
Subject: [PATCH] fix: i18n for data source internal configuration fields
(#17217)
---
web/src/locales/en.ts | 227 +++++++++
web/src/locales/zh.ts | 221 +++++++++
.../data-source/add-datasource-modal.tsx | 8 +-
.../constant/bitbucket-constant.tsx | 29 +-
.../constant/confluence-constant.tsx | 40 +-
.../data-source/constant/index.tsx | 449 +++++++++---------
.../data-source/constant/jira-constant.tsx | 62 ++-
.../data-source/constant/s3-constant.tsx | 62 ++-
.../data-source/constant/seafile-constant.tsx | 45 +-
.../data-source-detail-page/index.tsx | 27 +-
10 files changed, 849 insertions(+), 321 deletions(-)
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index dbf2526f87..21debc71cc 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -18,6 +18,8 @@ export default {
rename: 'Rename',
name: 'Name',
save: 'Save',
+ stop: 'Stop',
+ resume: 'Resume',
namePlaceholder: 'Please input name',
descriptionPlaceholder: 'Enter description',
next: 'Next',
@@ -1268,6 +1270,231 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
configureModelTitle: 'Configure model',
connectorNameTip: 'A descriptive name for the connector',
syncDeletedFiles: 'Sync deleted files',
+ // Data source form field labels
+ dataSourceFieldName: 'Name',
+ dataSourceFieldSource: 'Source',
+ dataSourceFieldTenantId: 'Tenant ID',
+ dataSourceFieldClientId: 'Client ID',
+ dataSourceFieldClientSecret: 'Client Secret',
+ dataSourceFieldFolderPathOptional: 'Folder Path (optional)',
+ dataSourceFieldBatchSize: 'Batch Size',
+ dataSourceFieldMailFolder: 'Mail Folder',
+ dataSourceFieldMailboxUserIds: 'Mailbox User IDs (optional)',
+ dataSourceFieldInstanceUrl: 'Instance URL',
+ dataSourceFieldObjects: 'Objects',
+ dataSourceFieldApiVersion: 'API Version',
+ dataSourceFieldAuthMode: 'Auth Mode',
+ dataSourceFieldAccountName: 'Account Name',
+ dataSourceFieldAccountKey: 'Account Key',
+ dataSourceFieldConnectionString: 'Connection String',
+ dataSourceFieldContainerUrl: 'Container URL',
+ dataSourceFieldSasToken: 'SAS Token',
+ dataSourceFieldContainerName: 'Container Name',
+ dataSourceFieldPrefixOptional: 'Prefix (optional)',
+ dataSourceFieldFeedUrl: 'Feed URL',
+ dataSourceFieldGcsAccessKeyId: 'GCS Access Key ID',
+ dataSourceFieldGcsSecretAccessKey: 'GCS Secret Access Key',
+ dataSourceFieldBucketName: 'Bucket Name',
+ dataSourceFieldOciNamespace: 'OCI Namespace',
+ dataSourceFieldOciRegion: 'OCI Region',
+ dataSourceFieldOciAccessKeyId: 'OCI Access Key ID',
+ dataSourceFieldOciSecretAccessKey: 'OCI Secret Access Key',
+ dataSourceFieldR2AccountId: 'R2 Account ID',
+ dataSourceFieldR2AccessKeyId: 'R2 Access Key ID',
+ dataSourceFieldR2SecretAccessKey: 'R2 Secret Access Key',
+ dataSourceFieldNotionIntegrationToken: 'Notion Integration Token',
+ dataSourceFieldRootPageId: 'Root Page Id',
+ dataSourceFieldDiscordBotToken: 'Discord Bot Token',
+ dataSourceFieldServerIds: 'Server IDs',
+ dataSourceFieldChannels: 'Channels',
+ dataSourceFieldPrimaryAdminEmail: 'Primary Admin Email',
+ dataSourceFieldOauthTokenJson: 'OAuth Token JSON',
+ dataSourceFieldMyDriveEmails: 'My Drive Emails',
+ dataSourceFieldSharedFolderUrls: 'Shared Folder URLs',
+ dataSourceFieldMoodleUrl: 'Moodle URL',
+ dataSourceFieldApiToken: 'API Token',
+ dataSourceFieldSlackBotToken: 'Slack Bot Token',
+ dataSourceFieldSiteUrl: 'Site URL',
+ dataSourceFieldWebdavServerUrl: 'WebDAV Server URL',
+ dataSourceFieldUsername: 'Username',
+ dataSourceFieldPassword: 'Password',
+ dataSourceFieldRemotePath: 'Remote Path',
+ dataSourceFieldAccessToken: 'Access Token',
+ dataSourceFieldBoxOauthConfiguration: 'Box OAuth Configuration',
+ dataSourceFieldFolderId: 'Folder ID',
+ dataSourceFieldBaseId: 'Base ID',
+ dataSourceFieldTableNameOrId: 'Table Name OR ID',
+ dataSourceFieldOperatorId: 'Operator ID',
+ dataSourceFieldProjectOwner: 'Project Owner',
+ dataSourceFieldProjectName: 'Project Name',
+ dataSourceFieldGitlabPersonalAccessToken: 'GitLab Personal Access Token',
+ dataSourceFieldGitlabUrl: 'GitLab URL',
+ dataSourceFieldIncludeIssues: 'Include Issues',
+ dataSourceFieldWorkspaceId: 'Workspace ID',
+ dataSourceFieldProjectIds: 'Project IDs',
+ dataSourceFieldTeamId: 'Team ID',
+ dataSourceFieldRepositoryOwner: 'Repository Owner',
+ dataSourceFieldRepositoryName: 'Repository Name',
+ dataSourceFieldGithubAccessToken: 'GitHub Access Token',
+ dataSourceFieldHost: 'Host',
+ dataSourceFieldPort: 'Port',
+ dataSourceFieldMailboxes: 'Mailboxes',
+ dataSourceFieldPollRange: 'Poll Range',
+ dataSourceFieldZendeskDomain: 'Zendesk Domain',
+ dataSourceFieldZendeskEmail: 'Zendesk Email',
+ dataSourceFieldZendeskToken: 'Zendesk Token',
+ dataSourceFieldContent: 'Content',
+ dataSourceFieldDatabase: 'Database',
+ dataSourceFieldSqlQuery: 'SQL Query',
+ dataSourceFieldContentColumns: 'Content Columns',
+ dataSourceFieldMetadataColumns: 'Metadata Columns',
+ dataSourceFieldIdColumn: 'ID Column',
+ dataSourceFieldTimestampColumn: 'Timestamp Column',
+ dataSourceFieldProjectId: 'Project ID',
+ dataSourceFieldLocation: 'Location',
+ dataSourceFieldServiceAccountJson: 'Service Account JSON',
+ dataSourceFieldDatasetId: 'Dataset ID',
+ dataSourceFieldTableId: 'Table ID',
+ dataSourceFieldMaxBytesBilled: 'Max Bytes Billed',
+ dataSourceFieldJobTimeout: 'Job Timeout (ms)',
+ dataSourceFieldPageSize: 'Page Size',
+ dataSourceFieldUseQueryCache: 'Use Query Cache',
+ dataSourceFieldBaseUrl: 'Base URL',
+ dataSourceFieldHttpMethod: 'HTTP Method',
+ dataSourceFieldQueryParameters: 'Query Parameters',
+ dataSourceFieldItemsPath: 'Items Path',
+ dataSourceFieldIdField: 'ID Field',
+ dataSourceFieldAuthType: 'Auth Type',
+ dataSourceFieldApiKeyHeaderName: 'API Key Header Name',
+ dataSourceFieldApiKeyValue: 'API Key Value',
+ dataSourceFieldBearerToken: 'Bearer Token',
+ dataSourceFieldContentFields: 'Content Fields',
+ dataSourceFieldMetadataFields: 'Metadata Fields',
+ dataSourceFieldPaginationType: 'Pagination Type',
+ dataSourceFieldStartPage: 'Start Page',
+ dataSourceFieldOffsetParam: 'Offset Param',
+ dataSourceFieldStartOffset: 'Start Offset',
+ dataSourceFieldCursorParam: 'Cursor Param',
+ dataSourceFieldNextCursorJsonpath: 'Next Cursor JSONPath',
+ dataSourceFieldAdvancedSettings: 'Advanced Settings',
+ dataSourceFieldCustomHeaders: 'Custom Headers (JSON)',
+ dataSourceFieldLimitParam: 'Limit Param',
+ dataSourceFieldInitialCursor: 'Initial Cursor',
+ dataSourceFieldMaxPages: 'Max Pages',
+ dataSourceFieldRequestDelay: 'Request Delay (seconds)',
+ dataSourceFieldPollTimestampField: 'Poll Timestamp Field',
+ dataSourceFieldRequestBody: 'Request Body (POST) JSON',
+ dataSourceFieldConfluenceUsername: 'Confluence Username',
+ dataSourceFieldConfluenceAccessToken: 'Confluence Access Token',
+ dataSourceFieldWikiBaseUrl: 'Wiki Base URL',
+ dataSourceFieldIsCloud: 'Is Cloud',
+ dataSourceFieldIndexMode: 'Index Mode',
+ dataSourceFieldPageId: 'Page ID',
+ dataSourceFieldSpaceKey: 'Space Key',
+ dataSourceFieldIndexRecursively: 'Index Recursively',
+ dataSourceFieldJiraUserEmail: 'Jira User Email',
+ dataSourceFieldJiraUsername: 'Jira Username',
+ dataSourceFieldJiraBaseUrl: 'Jira Base URL',
+ dataSourceFieldProjectKey: 'Project Key',
+ dataSourceFieldCustomJql: 'Custom JQL',
+ dataSourceFieldAttachmentSizeLimit: 'Attachment Size Limit (bytes)',
+ dataSourceFieldLabelsToSkip: 'Labels to Skip',
+ dataSourceFieldCommentEmailBlacklist: 'Comment Email Blacklist',
+ dataSourceFieldIncludeComments: 'Include Comments',
+ dataSourceFieldIncludeAttachments: 'Include Attachments',
+ dataSourceFieldMode: 'Mode',
+ dataSourceFieldJiraApiToken: 'Jira API Token',
+ dataSourceFieldJiraPassword: 'Jira Password',
+ dataSourceFieldUseScopedToken: 'Use Scoped Token',
+ dataSourceFieldRegion: 'Region',
+ dataSourceFieldPrefix: 'Prefix',
+ dataSourceFieldAuthentication: 'Authentication',
+ dataSourceFieldAwsAccessKeyId: 'AWS Access Key ID',
+ dataSourceFieldAwsSecretAccessKey: 'AWS Secret Access Key',
+ dataSourceFieldRoleArn: 'Role ARN',
+ dataSourceFieldAddressingStyle: 'Addressing Style',
+ dataSourceFieldEndpointUrl: 'Endpoint URL',
+ dataSourceFieldSeafileServerUrl: 'SeaFile Server URL',
+ dataSourceFieldSyncScope: 'Sync Scope',
+ dataSourceFieldAccountApiToken: 'Account API Token',
+ dataSourceFieldIncludeSharedLibraries: 'Include Shared Libraries',
+ dataSourceFieldLibraryToken: 'Library Token',
+ dataSourceFieldLibraryId: 'Library ID',
+ dataSourceFieldDirectoryPath: 'Directory Path',
+ dataSourceFieldBitbucketAccountEmail: 'Bitbucket Account Email',
+ dataSourceFieldBitbucketApiToken: 'Bitbucket API Token',
+ dataSourceFieldWorkspace: 'Workspace',
+ dataSourceFieldRepositorySlugs: 'Repository Slugs',
+ dataSourceFieldProjects: 'Projects',
+ dataSourceIncludePullRequests: 'Include Pull Requests',
+ dataSourceIncludeMergeRequests: 'Include Merge Requests',
+ dataSourceIncludeIssues: 'Include Issues',
+ dataSourceIncludeCodeFiles: 'Include Code Files',
+ // Data source form options
+ dataSourceOptionAccountKey: 'Account Key',
+ dataSourceOptionConnectionString: 'Connection String',
+ dataSourceOptionSasToken: 'SAS Token',
+ dataSourceOptionArticles: 'Articles',
+ dataSourceOptionTickets: 'Tickets',
+ dataSourceOptionNone: 'None',
+ dataSourceOptionApiKeyHeader: 'API Key (Header)',
+ dataSourceOptionBearerToken: 'Bearer Token',
+ dataSourceOptionBasicAuth: 'Basic Auth',
+ dataSourceOptionPage: 'Page',
+ dataSourceOptionOffset: 'Offset',
+ dataSourceOptionCursor: 'Cursor',
+ dataSourceOptionEverything: 'Everything',
+ dataSourceOptionSpace: 'Space',
+ dataSourceOptionCloud: 'Cloud',
+ dataSourceOptionServer: 'Server',
+ dataSourceOptionS3Compatible: 'S3 Compatible',
+ dataSourceOptionAccessKey: 'Access Key',
+ dataSourceOptionIamRole: 'IAM Role',
+ dataSourceOptionAssumeRole: 'Assume Role',
+ dataSourceOptionVirtualHostedStyle: 'Virtual Hosted Style',
+ dataSourceOptionPathStyle: 'Path Style',
+ dataSourceOptionEntireAccount: 'Entire Account',
+ dataSourceOptionSingleLibrary: 'Single Library',
+ dataSourceOptionSpecificDirectory: 'Specific Directory',
+ dataSourceOptionRepositories: 'Repositories',
+ dataSourceOptionProjects: 'Projects',
+ dataSourceOptionWorkspace: 'Workspace',
+ // Data source validation messages
+ dataSourceValidationFieldRequired: '{{label}} is required',
+ dataSourceValidationMinOne: '{{label}} must be at least 1',
+ dataSourceConfluenceEverythingTip:
+ 'This choice will index all pages the provided credentials have access to.',
+ dataSourceS3AssumeRoleTip:
+ 'No credentials required. Uses the default environment role.',
+ dataSourceS3RoleArnTip:
+ 'The role will be assumed by the runtime environment.',
+ dataSourceS3RegionRequired: 'Region is required when using access key',
+ dataSourceAzureAccountNameRequired:
+ 'Account name is required for account key auth',
+ dataSourceAzureAccountKeyRequired:
+ 'Account key is required for account key auth',
+ dataSourceAzureConnectionStringRequired:
+ 'Connection string is required for connection string auth',
+ dataSourceAzureContainerUrlRequired:
+ 'Container URL is required for SAS token auth',
+ dataSourceAzureSasTokenRequired:
+ 'SAS token is required for SAS token auth',
+ dataSourceAzureContainerNameRequired:
+ 'Container name is required for this auth mode',
+ dataSourceBigqueryDatasetIdRequired:
+ 'Dataset ID is required when not using a custom SQL Query',
+ dataSourceBigqueryTableIdRequired:
+ 'Table ID is required when not using a custom SQL Query',
+ dataSourceBigqueryQueryRequired:
+ 'Provide a SQL Query, or both Dataset ID and Table ID',
+ dataSourceSalesforceInstanceUrlInvalid:
+ 'Must be a valid Salesforce domain (https://...salesforce.com)',
+ dataSourceSalesforceApiVersionInvalid:
+ 'API version must match format like v59.0',
+ // Data source detail page labels
+ dataSourcePruneFreq: 'Prune Freq',
+ dataSourceRefreshFreq: 'Refresh Freq',
+ dataSourceTimeoutSecs: 'Timeout Secs',
confluenceIsCloudTip:
'Check if this is a Confluence Cloud instance, uncheck for Confluence Server/Data Center',
confluenceWikiBaseUrlTip:
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index f4563e558f..cd5e1cb0fb 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -18,6 +18,8 @@ export default {
rename: '重命名',
name: '名称',
save: '保存',
+ stop: '停止',
+ resume: '恢复',
namePlaceholder: '请输入名称',
descriptionPlaceholder: '请输入描述',
next: '下一步',
@@ -1259,6 +1261,225 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系
'用英文逗号分隔的仓库 slug,例如:repo-one,repo-two',
connectorNameTip: '为连接器命名',
syncDeletedFiles: '同步删除文件',
+ // Data source form field labels
+ dataSourceFieldName: '名称',
+ dataSourceFieldSource: '数据源',
+ dataSourceFieldTenantId: '租户 ID',
+ dataSourceFieldClientId: '客户端 ID',
+ dataSourceFieldClientSecret: '客户端密钥',
+ dataSourceFieldFolderPathOptional: '文件夹路径(可选)',
+ dataSourceFieldBatchSize: '批量大小',
+ dataSourceFieldMailFolder: '邮件文件夹',
+ dataSourceFieldMailboxUserIds: '邮箱用户 ID(可选)',
+ dataSourceFieldInstanceUrl: '实例 URL',
+ dataSourceFieldObjects: '对象',
+ dataSourceFieldApiVersion: 'API 版本',
+ dataSourceFieldAuthMode: '认证模式',
+ dataSourceFieldAccountName: '账户名称',
+ dataSourceFieldAccountKey: '账户密钥',
+ dataSourceFieldConnectionString: '连接字符串',
+ dataSourceFieldContainerUrl: '容器 URL',
+ dataSourceFieldSasToken: 'SAS 令牌',
+ dataSourceFieldContainerName: '容器名称',
+ dataSourceFieldPrefixOptional: '前缀(可选)',
+ dataSourceFieldFeedUrl: '订阅源 URL',
+ dataSourceFieldGcsAccessKeyId: 'GCS 访问密钥 ID',
+ dataSourceFieldGcsSecretAccessKey: 'GCS 访问密钥',
+ dataSourceFieldBucketName: '存储桶名称',
+ dataSourceFieldOciNamespace: 'OCI 命名空间',
+ dataSourceFieldOciRegion: 'OCI 区域',
+ dataSourceFieldOciAccessKeyId: 'OCI 访问密钥 ID',
+ dataSourceFieldOciSecretAccessKey: 'OCI 访问密钥',
+ dataSourceFieldR2AccountId: 'R2 账户 ID',
+ dataSourceFieldR2AccessKeyId: 'R2 访问密钥 ID',
+ dataSourceFieldR2SecretAccessKey: 'R2 访问密钥',
+ dataSourceFieldNotionIntegrationToken: 'Notion 集成令牌',
+ dataSourceFieldRootPageId: '根页面 ID',
+ dataSourceFieldDiscordBotToken: 'Discord 机器人令牌',
+ dataSourceFieldServerIds: '服务器 ID',
+ dataSourceFieldChannels: '频道',
+ dataSourceFieldPrimaryAdminEmail: '主管理员邮箱',
+ dataSourceFieldOauthTokenJson: 'OAuth 令牌 JSON',
+ dataSourceFieldMyDriveEmails: '我的云端硬盘邮箱',
+ dataSourceFieldSharedFolderUrls: '共享文件夹 URL',
+ dataSourceFieldMoodleUrl: 'Moodle URL',
+ dataSourceFieldApiToken: 'API 令牌',
+ dataSourceFieldSlackBotToken: 'Slack 机器人令牌',
+ dataSourceFieldSiteUrl: '站点 URL',
+ dataSourceFieldWebdavServerUrl: 'WebDAV 服务器 URL',
+ dataSourceFieldUsername: '用户名',
+ dataSourceFieldPassword: '密码',
+ dataSourceFieldRemotePath: '远程路径',
+ dataSourceFieldAccessToken: '访问令牌',
+ dataSourceFieldBoxOauthConfiguration: 'Box OAuth 配置',
+ dataSourceFieldFolderId: '文件夹 ID',
+ dataSourceFieldBaseId: 'Base ID',
+ dataSourceFieldTableNameOrId: '表名称或 ID',
+ dataSourceFieldOperatorId: '操作员 ID',
+ dataSourceFieldProjectOwner: '项目所有者',
+ dataSourceFieldProjectName: '项目名称',
+ dataSourceFieldGitlabPersonalAccessToken: 'GitLab 个人访问令牌',
+ dataSourceFieldGitlabUrl: 'GitLab URL',
+ dataSourceFieldIncludeIssues: '包含 Issues',
+ dataSourceFieldWorkspaceId: '工作区 ID',
+ dataSourceFieldProjectIds: '项目 ID',
+ dataSourceFieldTeamId: '团队 ID',
+ dataSourceFieldRepositoryOwner: '仓库所有者',
+ dataSourceFieldRepositoryName: '仓库名称',
+ dataSourceFieldGithubAccessToken: 'GitHub 访问令牌',
+ dataSourceFieldHost: '主机',
+ dataSourceFieldPort: '端口',
+ dataSourceFieldMailboxes: '邮箱',
+ dataSourceFieldPollRange: '轮询范围',
+ dataSourceFieldZendeskDomain: 'Zendesk 域名',
+ dataSourceFieldZendeskEmail: 'Zendesk 邮箱',
+ dataSourceFieldZendeskToken: 'Zendesk 令牌',
+ dataSourceFieldContent: '内容',
+ dataSourceFieldDatabase: '数据库',
+ dataSourceFieldSqlQuery: 'SQL 查询',
+ dataSourceFieldContentColumns: '内容列',
+ dataSourceFieldMetadataColumns: '元数据列',
+ dataSourceFieldIdColumn: 'ID 列',
+ dataSourceFieldTimestampColumn: '时间戳列',
+ dataSourceFieldProjectId: '项目 ID',
+ dataSourceFieldLocation: '位置',
+ dataSourceFieldServiceAccountJson: '服务账号 JSON',
+ dataSourceFieldDatasetId: '数据集 ID',
+ dataSourceFieldTableId: '表 ID',
+ dataSourceFieldMaxBytesBilled: '最大计费字节数',
+ dataSourceFieldJobTimeout: '作业超时时间(毫秒)',
+ dataSourceFieldPageSize: '每页大小',
+ dataSourceFieldUseQueryCache: '使用查询缓存',
+ dataSourceFieldBaseUrl: '基础 URL',
+ dataSourceFieldHttpMethod: 'HTTP 方法',
+ dataSourceFieldQueryParameters: '查询参数',
+ dataSourceFieldItemsPath: '数据项路径',
+ dataSourceFieldIdField: 'ID 字段',
+ dataSourceFieldAuthType: '认证类型',
+ dataSourceFieldApiKeyHeaderName: 'API Key 请求头名称',
+ dataSourceFieldApiKeyValue: 'API Key 值',
+ dataSourceFieldBearerToken: 'Bearer 令牌',
+ dataSourceFieldContentFields: '内容字段',
+ dataSourceFieldMetadataFields: '元数据字段',
+ dataSourceFieldPaginationType: '分页类型',
+ dataSourceFieldStartPage: '起始页',
+ dataSourceFieldOffsetParam: 'Offset 参数',
+ dataSourceFieldStartOffset: '起始偏移量',
+ dataSourceFieldCursorParam: '游标参数',
+ dataSourceFieldNextCursorJsonpath: '下一游标 JSONPath',
+ dataSourceFieldAdvancedSettings: '高级设置',
+ dataSourceFieldCustomHeaders: '自定义请求头(JSON)',
+ dataSourceFieldLimitParam: 'Limit 参数',
+ dataSourceFieldInitialCursor: '初始游标',
+ dataSourceFieldMaxPages: '最大页数',
+ dataSourceFieldRequestDelay: '请求延迟(秒)',
+ dataSourceFieldPollTimestampField: '轮询时间戳字段',
+ dataSourceFieldRequestBody: '请求体(POST)JSON',
+ dataSourceFieldConfluenceUsername: 'Confluence 用户名',
+ dataSourceFieldConfluenceAccessToken: 'Confluence 访问令牌',
+ dataSourceFieldWikiBaseUrl: 'Wiki 基础 URL',
+ dataSourceFieldIsCloud: '是否为云版本',
+ dataSourceFieldIndexMode: '索引模式',
+ dataSourceFieldPageId: '页面 ID',
+ dataSourceFieldSpaceKey: '空间标识(Space Key)',
+ dataSourceFieldIndexRecursively: '递归索引',
+ dataSourceFieldJiraUserEmail: 'Jira 用户邮箱',
+ dataSourceFieldJiraUsername: 'Jira 用户名',
+ dataSourceFieldJiraBaseUrl: 'Jira 基础 URL',
+ dataSourceFieldProjectKey: '项目标识(Project Key)',
+ dataSourceFieldCustomJql: '自定义 JQL',
+ dataSourceFieldAttachmentSizeLimit: '附件大小限制(字节)',
+ dataSourceFieldLabelsToSkip: '跳过的标签',
+ dataSourceFieldCommentEmailBlacklist: '评论邮箱黑名单',
+ dataSourceFieldIncludeComments: '包含评论',
+ dataSourceFieldIncludeAttachments: '包含附件',
+ dataSourceFieldMode: '模式',
+ dataSourceFieldJiraApiToken: 'Jira API 令牌',
+ dataSourceFieldJiraPassword: 'Jira 密码',
+ dataSourceFieldUseScopedToken: '使用受限令牌(Scoped Token)',
+ dataSourceFieldRegion: '区域',
+ dataSourceFieldPrefix: '前缀',
+ dataSourceFieldAuthentication: '认证方式',
+ dataSourceFieldAwsAccessKeyId: 'AWS Access Key ID',
+ dataSourceFieldAwsSecretAccessKey: 'AWS Secret Access Key',
+ dataSourceFieldRoleArn: 'Role ARN',
+ dataSourceFieldAddressingStyle: '寻址方式',
+ dataSourceFieldEndpointUrl: 'Endpoint URL',
+ dataSourceFieldSeafileServerUrl: 'SeaFile 服务器 URL',
+ dataSourceFieldSyncScope: '同步范围',
+ dataSourceFieldAccountApiToken: '账户 API 令牌',
+ dataSourceFieldIncludeSharedLibraries: '包含共享资料库',
+ dataSourceFieldLibraryToken: '资料库令牌',
+ dataSourceFieldLibraryId: '资料库 ID',
+ dataSourceFieldDirectoryPath: '目录路径',
+ dataSourceFieldBitbucketAccountEmail: 'Bitbucket 账户邮箱',
+ dataSourceFieldBitbucketApiToken: 'Bitbucket API 令牌',
+ dataSourceFieldWorkspace: '工作区',
+ dataSourceFieldRepositorySlugs: '仓库 Slugs',
+ dataSourceFieldProjects: '项目',
+ dataSourceIncludePullRequests: '包含 Pull Requests',
+ dataSourceIncludeMergeRequests: '包含合并请求(MR)',
+ dataSourceIncludeIssues: '包含 Issues',
+ dataSourceIncludeCodeFiles: '包含代码文件',
+ // Data source form options
+ dataSourceOptionAccountKey: '账户密钥',
+ dataSourceOptionConnectionString: '连接字符串',
+ dataSourceOptionSasToken: 'SAS 令牌',
+ dataSourceOptionArticles: '文章',
+ dataSourceOptionTickets: '工单',
+ dataSourceOptionNone: '无',
+ dataSourceOptionApiKeyHeader: 'API Key(请求头)',
+ dataSourceOptionBearerToken: 'Bearer 令牌',
+ dataSourceOptionBasicAuth: 'Basic 认证',
+ dataSourceOptionPage: '页码',
+ dataSourceOptionOffset: '偏移量',
+ dataSourceOptionCursor: '游标',
+ dataSourceOptionEverything: '全部',
+ dataSourceOptionSpace: '空间',
+ dataSourceOptionCloud: '云版本',
+ dataSourceOptionServer: '服务器版',
+ dataSourceOptionS3Compatible: 'S3 兼容',
+ dataSourceOptionAccessKey: '访问密钥',
+ dataSourceOptionIamRole: 'IAM 角色',
+ dataSourceOptionAssumeRole: 'Assume Role',
+ dataSourceOptionVirtualHostedStyle: '虚拟主机方式',
+ dataSourceOptionPathStyle: '路径方式',
+ dataSourceOptionEntireAccount: '整个账户',
+ dataSourceOptionSingleLibrary: '单个资料库',
+ dataSourceOptionSpecificDirectory: '指定目录',
+ dataSourceOptionRepositories: '仓库',
+ dataSourceOptionProjects: '项目',
+ dataSourceOptionWorkspace: '工作区',
+ // Data source validation messages
+ dataSourceValidationFieldRequired: '{{label}}为必填项',
+ dataSourceValidationMinOne: '{{label}}至少为 1',
+ dataSourceConfluenceEverythingTip:
+ '该选项将索引所提供凭据有权访问的所有页面。',
+ dataSourceS3AssumeRoleTip: '无需提供凭据,将使用运行环境的默认角色。',
+ dataSourceS3RoleArnTip: '该角色将由运行环境扮演。',
+ dataSourceS3RegionRequired: '使用访问密钥时区域为必填项',
+ dataSourceAzureAccountNameRequired:
+ '使用账户密钥认证时,账户名称为必填项',
+ dataSourceAzureAccountKeyRequired: '使用账户密钥认证时,账户密钥为必填项',
+ dataSourceAzureConnectionStringRequired:
+ '使用连接字符串认证时,连接字符串为必填项',
+ dataSourceAzureContainerUrlRequired:
+ '使用 SAS 令牌认证时,容器 URL 为必填项',
+ dataSourceAzureSasTokenRequired: '使用 SAS 令牌认证时,SAS 令牌为必填项',
+ dataSourceAzureContainerNameRequired: '在此认证模式下,容器名称为必填项',
+ dataSourceBigqueryDatasetIdRequired:
+ '未使用自定义 SQL 查询时,数据集 ID 为必填项',
+ dataSourceBigqueryTableIdRequired:
+ '未使用自定义 SQL 查询时,表 ID 为必填项',
+ dataSourceBigqueryQueryRequired:
+ '请提供 SQL 查询,或同时提供数据集 ID 和表 ID',
+ dataSourceSalesforceInstanceUrlInvalid:
+ '必须为合法的 Salesforce 域名 (https://...salesforce.com)',
+ dataSourceSalesforceApiVersionInvalid: 'API 版本格式必须如 v59.0',
+ // Data source detail page labels
+ dataSourcePruneFreq: '清理间隔',
+ dataSourceRefreshFreq: '刷新间隔',
+ dataSourceTimeoutSecs: '超时时间(秒)',
githubDescription:
'连接 GitHub,可同步 Pull Request 与 Issue 内容用于检索。',
airtableDescription: '连接 Airtable,同步指定工作区下指定表格中的文件。',
diff --git a/web/src/pages/user-setting/data-source/add-datasource-modal.tsx b/web/src/pages/user-setting/data-source/add-datasource-modal.tsx
index 16d4eff89e..38b9efff3f 100644
--- a/web/src/pages/user-setting/data-source/add-datasource-modal.tsx
+++ b/web/src/pages/user-setting/data-source/add-datasource-modal.tsx
@@ -5,9 +5,9 @@ import { useEffect, useState } from 'react';
import { FieldValues } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import {
- DataSourceFormBaseFields,
DataSourceFormDefaultValues,
getCommonExtraDefaultValues,
+ getDataSourceFormBaseFields,
getDataSourceFieldsWithExtras,
mergeDataSourceFormValues,
} from './constant';
@@ -26,11 +26,11 @@ const AddDataSourceModal = ({
useEffect(() => {
if (sourceData) {
setFields([
- ...DataSourceFormBaseFields,
- ...getDataSourceFieldsWithExtras(sourceData.id as any),
+ ...getDataSourceFormBaseFields(t),
+ ...getDataSourceFieldsWithExtras(t, sourceData.id as any),
] as FormFieldConfig[]);
}
- }, [sourceData]);
+ }, [sourceData, t]);
const handleOk = async (values?: FieldValues) => {
await onOk?.(values);
diff --git a/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx b/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx
index 83f33c07fd..ee72515089 100644
--- a/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx
+++ b/web/src/pages/user-setting/data-source/constant/bitbucket-constant.tsx
@@ -3,42 +3,47 @@ import { TFunction } from 'i18next';
export const bitbucketConstant = (t: TFunction) => [
{
- label: 'Bitbucket Account Email',
+ label: t('setting.dataSourceFieldBitbucketAccountEmail'),
name: 'config.credentials.bitbucket_account_email',
type: FormFieldType.Email,
required: true,
},
{
- label: 'Bitbucket API Token',
+ label: t('setting.dataSourceFieldBitbucketApiToken'),
name: 'config.credentials.bitbucket_api_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Workspace',
+ label: t('setting.dataSourceFieldWorkspace'),
name: 'config.workspace',
type: FormFieldType.Text,
required: true,
tooltip: t('setting.bitbucketTopWorkspaceTip'),
},
{
- label: 'Index Mode',
+ label: t('setting.dataSourceFieldIndexMode'),
name: 'config.index_mode',
type: FormFieldType.Segmented,
options: [
- { label: 'Repositories', value: 'repositories' },
- { label: 'Project(s)', value: 'projects' },
- { label: 'Workspace', value: 'workspace' },
+ {
+ label: t('setting.dataSourceOptionRepositories'),
+ value: 'repositories',
+ },
+ { label: t('setting.dataSourceOptionProjects'), value: 'projects' },
+ { label: t('setting.dataSourceOptionWorkspace'), value: 'workspace' },
],
},
{
- label: 'Repository Slugs',
+ label: t('setting.dataSourceFieldRepositorySlugs'),
name: 'config.repository_slugs',
type: FormFieldType.Text,
customValidate: (val: string, formValues: any) => {
const index_mode = formValues?.config?.index_mode;
if (!val && index_mode === 'repositories') {
- return 'Repository Slugs is required';
+ return t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldRepositorySlugs'),
+ });
}
return true;
},
@@ -49,13 +54,15 @@ export const bitbucketConstant = (t: TFunction) => [
tooltip: t('setting.bitbucketRepositorySlugsTip'),
},
{
- label: 'Projects',
+ label: t('setting.dataSourceFieldProjects'),
name: 'config.projects',
type: FormFieldType.Text,
customValidate: (val: string, formValues: any) => {
const index_mode = formValues?.config?.index_mode;
if (!val && index_mode === 'projects') {
- return 'Projects is required';
+ return t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldProjects'),
+ });
}
return true;
},
diff --git a/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx b/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx
index 4aa70494e7..ef7fd01913 100644
--- a/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx
+++ b/web/src/pages/user-setting/data-source/constant/confluence-constant.tsx
@@ -3,50 +3,52 @@ import { TFunction } from 'i18next';
export const confluenceConstant = (t: TFunction) => [
{
- label: 'Confluence Username',
+ label: t('setting.dataSourceFieldConfluenceUsername'),
name: 'config.credentials.confluence_username',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Confluence Access Token',
+ label: t('setting.dataSourceFieldConfluenceAccessToken'),
name: 'config.credentials.confluence_access_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Wiki Base URL',
+ label: t('setting.dataSourceFieldWikiBaseUrl'),
name: 'config.wiki_base',
type: FormFieldType.Text,
required: false,
tooltip: t('setting.confluenceWikiBaseUrlTip'),
},
{
- label: 'Is Cloud',
+ label: t('setting.dataSourceFieldIsCloud'),
name: 'config.is_cloud',
type: FormFieldType.Checkbox,
required: false,
tooltip: t('setting.confluenceIsCloudTip'),
},
{
- label: 'Index Mode',
+ label: t('setting.dataSourceFieldIndexMode'),
name: 'config.index_mode',
type: FormFieldType.Segmented,
options: [
- { label: 'Everything', value: 'everything' },
- { label: 'Space', value: 'space' },
- { label: 'Page', value: 'page' },
+ { label: t('setting.dataSourceOptionEverything'), value: 'everything' },
+ { label: t('setting.dataSourceOptionSpace'), value: 'space' },
+ { label: t('setting.dataSourceOptionPage'), value: 'page' },
],
},
{
name: 'config.page_id',
- label: 'Page ID',
+ label: t('setting.dataSourceFieldPageId'),
type: FormFieldType.Text,
customValidate: (val: string, formValues: any) => {
const index_mode = formValues?.config?.index_mode;
console.log('index_mode', index_mode, val);
if (!val && index_mode === 'page') {
- return 'Page ID is required';
+ return t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldPageId'),
+ });
}
return true;
},
@@ -57,12 +59,14 @@ export const confluenceConstant = (t: TFunction) => [
},
{
name: 'config.space',
- label: 'Space Key',
+ label: t('setting.dataSourceFieldSpaceKey'),
type: FormFieldType.Text,
customValidate: (val: string, formValues: any) => {
const index_mode = formValues?.config?.index_mode;
if (!val && index_mode === 'space') {
- return 'Space Key is required';
+ return t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldSpaceKey'),
+ });
}
return true;
},
@@ -73,7 +77,7 @@ export const confluenceConstant = (t: TFunction) => [
},
{
name: 'config.index_recursively',
- label: 'Index Recursively',
+ label: t('setting.dataSourceFieldIndexRecursively'),
type: FormFieldType.Checkbox,
shouldRender: (formValues: any) => {
const index_mode = formValues?.config?.index_mode;
@@ -90,28 +94,26 @@ export const confluenceConstant = (t: TFunction) => [
},
render: () => (
- {
- 'This choice will index all pages the provided credentials have access to.'
- }
+ {t('setting.dataSourceConfluenceEverythingTip')}
),
},
{
- label: 'Space Key',
+ label: t('setting.dataSourceFieldSpaceKey'),
name: 'config.space',
type: FormFieldType.Text,
required: false,
hidden: true,
},
{
- label: 'Page ID',
+ label: t('setting.dataSourceFieldPageId'),
name: 'config.page_id',
type: FormFieldType.Text,
required: false,
hidden: true,
},
{
- label: 'Index Recursively',
+ label: t('setting.dataSourceFieldIndexRecursively'),
name: 'config.index_recursively',
type: FormFieldType.Checkbox,
required: false,
diff --git a/web/src/pages/user-setting/data-source/constant/index.tsx b/web/src/pages/user-setting/data-source/constant/index.tsx
index c542ded061..8e35295662 100644
--- a/web/src/pages/user-setting/data-source/constant/index.tsx
+++ b/web/src/pages/user-setting/data-source/constant/index.tsx
@@ -1,7 +1,7 @@
-import { FormFieldConfig, FormFieldType } from '@/components/dynamic-form';
+import { FormFieldType } from '@/components/dynamic-form';
import { IconFontFill } from '@/components/icon-font';
import SvgIcon from '@/components/svg-icon';
-import { t, TFunction } from 'i18next';
+import { TFunction } from 'i18next';
import { Mail, Rss } from 'lucide-react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -400,7 +400,7 @@ export const mergeDataSourceFormValues = (
return next;
}, {});
-export const DataSourceFormBaseFields = [
+export const getDataSourceFormBaseFields = (t: TFunction) => [
{
id: 'Id',
name: 'id',
@@ -409,14 +409,14 @@ export const DataSourceFormBaseFields = [
hidden: true,
},
{
- label: 'Name',
+ label: t('setting.dataSourceFieldName'),
name: 'name',
type: FormFieldType.Text,
required: true,
tooltip: t('setting.connectorNameTip'),
},
{
- label: 'Source',
+ label: t('setting.dataSourceFieldSource'),
name: 'source',
type: FormFieldType.Select,
required: true,
@@ -428,9 +428,7 @@ export const DataSourceFormBaseFields = [
},
];
-export const getCommonExtraFields = (
- source?: DataSourceKey,
-): FormFieldConfig[] => [
+export const getCommonExtraFields = (t: TFunction, source?: DataSourceKey) => [
{
label: t('setting.syncDeletedFiles'),
name: 'config.sync_deleted_files',
@@ -447,10 +445,10 @@ export const getCommonExtraDefaultValues = () => ({
},
});
-export const DataSourceFormFields = {
+const generateDataSourceFormFields = (t: TFunction) => ({
[DataSourceKey.ONEDRIVE]: [
{
- label: 'Tenant ID',
+ label: t('setting.dataSourceFieldTenantId'),
name: 'config.credentials.tenant_id',
type: FormFieldType.Text,
required: true,
@@ -458,7 +456,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.onedriveTenantIdTip'),
},
{
- label: 'Client ID',
+ label: t('setting.dataSourceFieldClientId'),
name: 'config.credentials.client_id',
type: FormFieldType.Text,
required: true,
@@ -466,14 +464,14 @@ export const DataSourceFormFields = {
tooltip: t('setting.onedriveClientIdTip'),
},
{
- label: 'Client Secret',
+ label: t('setting.dataSourceFieldClientSecret'),
name: 'config.credentials.client_secret',
type: FormFieldType.Password,
required: true,
tooltip: t('setting.onedriveClientSecretTip'),
},
{
- label: 'Folder Path (optional)',
+ label: t('setting.dataSourceFieldFolderPathOptional'),
name: 'config.folder_path',
type: FormFieldType.Text,
required: false,
@@ -481,19 +479,21 @@ export const DataSourceFormFields = {
tooltip: t('setting.onedriveFolderPathTip'),
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
],
[DataSourceKey.OUTLOOK]: [
{
- label: 'Tenant ID',
+ label: t('setting.dataSourceFieldTenantId'),
name: 'config.credentials.tenant_id',
type: FormFieldType.Text,
required: true,
@@ -501,7 +501,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.outlookTenantIdTip'),
},
{
- label: 'Client ID',
+ label: t('setting.dataSourceFieldClientId'),
name: 'config.credentials.client_id',
type: FormFieldType.Text,
required: true,
@@ -509,14 +509,14 @@ export const DataSourceFormFields = {
tooltip: t('setting.outlookClientIdTip'),
},
{
- label: 'Client Secret',
+ label: t('setting.dataSourceFieldClientSecret'),
name: 'config.credentials.client_secret',
type: FormFieldType.Password,
required: true,
tooltip: t('setting.outlookClientSecretTip'),
},
{
- label: 'Mail Folder',
+ label: t('setting.dataSourceFieldMailFolder'),
name: 'config.folder',
type: FormFieldType.Text,
required: false,
@@ -524,7 +524,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.outlookFolderTip'),
},
{
- label: 'Mailbox User IDs (optional)',
+ label: t('setting.dataSourceFieldMailboxUserIds'),
name: 'config.user_ids',
type: FormFieldType.Text,
required: false,
@@ -532,19 +532,21 @@ export const DataSourceFormFields = {
tooltip: t('setting.outlookUserIdsTip'),
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
],
[DataSourceKey.SALESFORCE]: [
{
- label: 'Instance URL',
+ label: t('setting.dataSourceFieldInstanceUrl'),
name: 'config.credentials.instance_url',
type: FormFieldType.Text,
required: true,
@@ -552,26 +554,25 @@ export const DataSourceFormFields = {
tooltip: t('setting.salesforceInstanceUrlTip'),
validation: {
pattern: /^https:\/\/[a-zA-Z0-9.-]+\.salesforce\.com$/,
- message:
- 'Must be a valid Salesforce domain (https://...salesforce.com)',
+ message: t('setting.dataSourceSalesforceInstanceUrlInvalid'),
},
},
{
- label: 'Client ID',
+ label: t('setting.dataSourceFieldClientId'),
name: 'config.credentials.client_id',
type: FormFieldType.Text,
required: true,
tooltip: t('setting.salesforceClientIdTip'),
},
{
- label: 'Client Secret',
+ label: t('setting.dataSourceFieldClientSecret'),
name: 'config.credentials.client_secret',
type: FormFieldType.Password,
required: true,
tooltip: t('setting.salesforceClientSecretTip'),
},
{
- label: 'Objects',
+ label: t('setting.dataSourceFieldObjects'),
name: 'config.objects',
type: FormFieldType.Text,
required: false,
@@ -579,7 +580,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.salesforceObjectsTip'),
},
{
- label: 'API Version',
+ label: t('setting.dataSourceFieldApiVersion'),
name: 'config.api_version',
type: FormFieldType.Text,
required: false,
@@ -587,35 +588,43 @@ export const DataSourceFormFields = {
tooltip: t('setting.salesforceApiVersionTip'),
validation: {
pattern: /^v\d+\.\d+$/,
- message: 'API version must match format like v59.0',
+ message: t('setting.dataSourceSalesforceApiVersionInvalid'),
},
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
],
[DataSourceKey.AZURE_BLOB]: [
{
- label: 'Auth Mode',
+ label: t('setting.dataSourceFieldAuthMode'),
name: 'config.auth_mode',
type: FormFieldType.Select,
required: true,
options: [
- { label: 'Account Key', value: 'account_key' },
- { label: 'Connection String', value: 'connection_string' },
- { label: 'SAS Token', value: 'sas_token' },
+ {
+ label: t('setting.dataSourceOptionAccountKey'),
+ value: 'account_key',
+ },
+ {
+ label: t('setting.dataSourceOptionConnectionString'),
+ value: 'connection_string',
+ },
+ { label: t('setting.dataSourceOptionSasToken'), value: 'sas_token' },
],
tooltip: t('setting.azureBlobAuthModeTip'),
},
{
- label: 'Account Name',
+ label: t('setting.dataSourceFieldAccountName'),
name: 'config.credentials.account_name',
type: FormFieldType.Text,
required: false,
@@ -625,11 +634,11 @@ export const DataSourceFormFields = {
values?.config?.auth_mode === 'account_key',
customValidate: (val: string, values: any) =>
values?.config?.auth_mode === 'account_key' && !(val ?? '').trim()
- ? 'Account name is required for account key auth'
+ ? t('setting.dataSourceAzureAccountNameRequired')
: true,
},
{
- label: 'Account Key',
+ label: t('setting.dataSourceFieldAccountKey'),
name: 'config.credentials.account_key',
type: FormFieldType.Password,
required: false,
@@ -638,11 +647,11 @@ export const DataSourceFormFields = {
values?.config?.auth_mode === 'account_key',
customValidate: (val: string, values: any) =>
values?.config?.auth_mode === 'account_key' && !val
- ? 'Account key is required for account key auth'
+ ? t('setting.dataSourceAzureAccountKeyRequired')
: true,
},
{
- label: 'Connection String',
+ label: t('setting.dataSourceFieldConnectionString'),
name: 'config.credentials.connection_string',
type: FormFieldType.Password,
required: false,
@@ -651,11 +660,11 @@ export const DataSourceFormFields = {
values?.config?.auth_mode === 'connection_string',
customValidate: (val: string, values: any) =>
values?.config?.auth_mode === 'connection_string' && !val
- ? 'Connection string is required for connection string auth'
+ ? t('setting.dataSourceAzureConnectionStringRequired')
: true,
},
{
- label: 'Container URL',
+ label: t('setting.dataSourceFieldContainerUrl'),
name: 'config.credentials.container_url',
type: FormFieldType.Text,
required: false,
@@ -664,11 +673,11 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => values?.config?.auth_mode === 'sas_token',
customValidate: (val: string, values: any) =>
values?.config?.auth_mode === 'sas_token' && !(val ?? '').trim()
- ? 'Container URL is required for SAS token auth'
+ ? t('setting.dataSourceAzureContainerUrlRequired')
: true,
},
{
- label: 'SAS Token',
+ label: t('setting.dataSourceFieldSasToken'),
name: 'config.credentials.sas_token',
type: FormFieldType.Password,
required: false,
@@ -676,11 +685,11 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => values?.config?.auth_mode === 'sas_token',
customValidate: (val: string, values: any) =>
values?.config?.auth_mode === 'sas_token' && !val
- ? 'SAS token is required for SAS token auth'
+ ? t('setting.dataSourceAzureSasTokenRequired')
: true,
},
{
- label: 'Container Name',
+ label: t('setting.dataSourceFieldContainerName'),
name: 'config.credentials.container_name',
type: FormFieldType.Text,
required: false,
@@ -695,13 +704,13 @@ export const DataSourceFormFields = {
(mode === 'account_key' || mode === 'connection_string') &&
!(val ?? '').trim()
) {
- return 'Container name is required for this auth mode';
+ return t('setting.dataSourceAzureContainerNameRequired');
}
return true;
},
},
{
- label: 'Prefix (optional)',
+ label: t('setting.dataSourceFieldPrefixOptional'),
name: 'config.prefix',
type: FormFieldType.Text,
required: false,
@@ -709,50 +718,54 @@ export const DataSourceFormFields = {
tooltip: t('setting.azureBlobPrefixTip'),
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
],
[DataSourceKey.RSS]: [
{
- label: 'Feed URL',
+ label: t('setting.dataSourceFieldFeedUrl'),
name: 'config.feed_url',
type: FormFieldType.Text,
required: true,
placeholder: 'https://example.com/feed.xml',
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
],
[DataSourceKey.GOOGLE_CLOUD_STORAGE]: [
{
- label: 'GCS Access Key ID',
+ label: t('setting.dataSourceFieldGcsAccessKeyId'),
name: 'config.credentials.access_key_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'GCS Secret Access Key',
+ label: t('setting.dataSourceFieldGcsSecretAccessKey'),
name: 'config.credentials.secret_access_key',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Bucket Name',
+ label: t('setting.dataSourceFieldBucketName'),
name: 'config.bucket_name',
type: FormFieldType.Text,
required: true,
@@ -760,31 +773,31 @@ export const DataSourceFormFields = {
],
[DataSourceKey.OCI_STORAGE]: [
{
- label: 'OCI Namespace',
+ label: t('setting.dataSourceFieldOciNamespace'),
name: 'config.credentials.namespace',
type: FormFieldType.Text,
required: true,
},
{
- label: 'OCI Region',
+ label: t('setting.dataSourceFieldOciRegion'),
name: 'config.credentials.region',
type: FormFieldType.Text,
required: true,
},
{
- label: 'OCI Access Key ID',
+ label: t('setting.dataSourceFieldOciAccessKeyId'),
name: 'config.credentials.access_key_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'OCI Secret Access Key',
+ label: t('setting.dataSourceFieldOciSecretAccessKey'),
name: 'config.credentials.secret_access_key',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Bucket Name',
+ label: t('setting.dataSourceFieldBucketName'),
name: 'config.bucket_name',
type: FormFieldType.Text,
required: true,
@@ -792,25 +805,25 @@ export const DataSourceFormFields = {
],
[DataSourceKey.R2]: [
{
- label: 'R2 Account ID',
+ label: t('setting.dataSourceFieldR2AccountId'),
name: 'config.credentials.account_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'R2 Access Key ID',
+ label: t('setting.dataSourceFieldR2AccessKeyId'),
name: 'config.credentials.r2_access_key_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'R2 Secret Access Key',
+ label: t('setting.dataSourceFieldR2SecretAccessKey'),
name: 'config.credentials.r2_secret_access_key',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Bucket Name',
+ label: t('setting.dataSourceFieldBucketName'),
name: 'config.bucket_name',
type: FormFieldType.Text,
required: true,
@@ -819,13 +832,13 @@ export const DataSourceFormFields = {
[DataSourceKey.S3]: S3Constant(t),
[DataSourceKey.NOTION]: [
{
- label: 'Notion Integration Token',
+ label: t('setting.dataSourceFieldNotionIntegrationToken'),
name: 'config.credentials.notion_integration_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Root Page Id',
+ label: t('setting.dataSourceFieldRootPageId'),
name: 'config.root_page_id',
type: FormFieldType.Text,
required: false,
@@ -833,19 +846,19 @@ export const DataSourceFormFields = {
],
[DataSourceKey.DISCORD]: [
{
- label: 'Discord Bot Token',
+ label: t('setting.dataSourceFieldDiscordBotToken'),
name: 'config.credentials.discord_bot_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Server IDs',
+ label: t('setting.dataSourceFieldServerIds'),
name: 'config.server_ids',
type: FormFieldType.Tag,
required: false,
},
{
- label: 'Channels',
+ label: t('setting.dataSourceFieldChannels'),
name: 'config.channels',
type: FormFieldType.Tag,
required: false,
@@ -855,7 +868,7 @@ export const DataSourceFormFields = {
[DataSourceKey.CONFLUENCE]: confluenceConstant(t),
[DataSourceKey.GOOGLE_DRIVE]: [
{
- label: 'Primary Admin Email',
+ label: t('setting.dataSourceFieldPrimaryAdminEmail'),
name: 'config.credentials.google_primary_admin',
type: FormFieldType.Text,
required: true,
@@ -863,7 +876,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.google_drivePrimaryAdminTip'),
},
{
- label: 'OAuth Token JSON',
+ label: t('setting.dataSourceFieldOauthTokenJson'),
name: 'config.credentials.google_tokens',
type: FormFieldType.Textarea,
required: true,
@@ -876,7 +889,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.google_driveTokenTip'),
},
{
- label: 'My Drive Emails',
+ label: t('setting.dataSourceFieldMyDriveEmails'),
name: 'config.my_drive_emails',
type: FormFieldType.Text,
required: true,
@@ -884,7 +897,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.google_driveMyDriveEmailsTip'),
},
{
- label: 'Shared Folder URLs',
+ label: t('setting.dataSourceFieldSharedFolderUrls'),
name: 'config.shared_folder_urls',
type: FormFieldType.Textarea,
required: true,
@@ -949,7 +962,7 @@ export const DataSourceFormFields = {
],
[DataSourceKey.GMAIL]: [
{
- label: 'Primary Admin Email',
+ label: t('setting.dataSourceFieldPrimaryAdminEmail'),
name: 'config.credentials.google_primary_admin',
type: FormFieldType.Text,
required: true,
@@ -957,7 +970,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.gmailPrimaryAdminTip'),
},
{
- label: 'OAuth Token JSON',
+ label: t('setting.dataSourceFieldOauthTokenJson'),
name: 'config.credentials.google_tokens',
type: FormFieldType.Textarea,
required: true,
@@ -980,14 +993,14 @@ export const DataSourceFormFields = {
],
[DataSourceKey.MOODLE]: [
{
- label: 'Moodle URL',
+ label: t('setting.dataSourceFieldMoodleUrl'),
name: 'config.moodle_url',
type: FormFieldType.Text,
required: true,
placeholder: 'https://moodle.example.com',
},
{
- label: 'API Token',
+ label: t('setting.dataSourceFieldApiToken'),
name: 'config.credentials.moodle_token',
type: FormFieldType.Password,
required: true,
@@ -995,20 +1008,20 @@ export const DataSourceFormFields = {
],
[DataSourceKey.TEAMS]: [
{
- label: 'Tenant ID',
+ label: t('setting.dataSourceFieldTenantId'),
name: 'config.credentials.tenant_id',
type: FormFieldType.Text,
required: true,
tooltip: t('setting.teamsTenantIdTip'),
},
{
- label: 'Client ID',
+ label: t('setting.dataSourceFieldClientId'),
name: 'config.credentials.client_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Client Secret',
+ label: t('setting.dataSourceFieldClientSecret'),
name: 'config.credentials.client_secret',
type: FormFieldType.Password,
required: true,
@@ -1016,14 +1029,14 @@ export const DataSourceFormFields = {
],
[DataSourceKey.SLACK]: [
{
- label: 'Slack Bot Token',
+ label: t('setting.dataSourceFieldSlackBotToken'),
name: 'config.credentials.slack_bot_token',
type: FormFieldType.Password,
required: true,
tooltip: t('setting.slackBotTokenTip'),
},
{
- label: 'Channels',
+ label: t('setting.dataSourceFieldChannels'),
name: 'config.channels',
type: FormFieldType.Tag,
required: false,
@@ -1032,7 +1045,7 @@ export const DataSourceFormFields = {
],
[DataSourceKey.SHAREPOINT]: [
{
- label: 'Site URL',
+ label: t('setting.dataSourceFieldSiteUrl'),
name: 'config.credentials.site_url',
type: FormFieldType.Text,
required: true,
@@ -1040,19 +1053,19 @@ export const DataSourceFormFields = {
tooltip: t('setting.sharepointSiteUrlTip'),
},
{
- label: 'Tenant ID',
+ label: t('setting.dataSourceFieldTenantId'),
name: 'config.credentials.tenant_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Client ID',
+ label: t('setting.dataSourceFieldClientId'),
name: 'config.credentials.client_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Client Secret',
+ label: t('setting.dataSourceFieldClientSecret'),
name: 'config.credentials.client_secret',
type: FormFieldType.Password,
required: true,
@@ -1061,26 +1074,26 @@ export const DataSourceFormFields = {
[DataSourceKey.JIRA]: jiraConstant(t),
[DataSourceKey.WEBDAV]: [
{
- label: 'WebDAV Server URL',
+ label: t('setting.dataSourceFieldWebdavServerUrl'),
name: 'config.base_url',
type: FormFieldType.Text,
required: true,
placeholder: 'https://webdav.example.com',
},
{
- label: 'Username',
+ label: t('setting.dataSourceFieldUsername'),
name: 'config.credentials.username',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Password',
+ label: t('setting.dataSourceFieldPassword'),
name: 'config.credentials.password',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Remote Path',
+ label: t('setting.dataSourceFieldRemotePath'),
name: 'config.remote_path',
type: FormFieldType.Text,
required: false,
@@ -1090,14 +1103,14 @@ export const DataSourceFormFields = {
],
[DataSourceKey.DROPBOX]: [
{
- label: 'Access Token',
+ label: t('setting.dataSourceFieldAccessToken'),
name: 'config.credentials.dropbox_access_token',
type: FormFieldType.Password,
required: true,
tooltip: t('setting.dropboxAccessTokenTip'),
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
@@ -1106,7 +1119,7 @@ export const DataSourceFormFields = {
],
[DataSourceKey.BOX]: [
{
- label: 'Box OAuth Configuration',
+ label: t('setting.dataSourceFieldBoxOauthConfiguration'),
name: 'config.credentials.box_tokens',
type: FormFieldType.Textarea,
required: true,
@@ -1119,7 +1132,7 @@ export const DataSourceFormFields = {
),
},
{
- label: 'Folder ID',
+ label: t('setting.dataSourceFieldFolderId'),
name: 'config.folder_id',
type: FormFieldType.Text,
required: false,
@@ -1128,19 +1141,19 @@ export const DataSourceFormFields = {
],
[DataSourceKey.AIRTABLE]: [
{
- label: 'Access Token',
+ label: t('setting.dataSourceFieldAccessToken'),
name: 'config.credentials.airtable_access_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Base ID',
+ label: t('setting.dataSourceFieldBaseId'),
name: 'config.base_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Table Name OR ID',
+ label: t('setting.dataSourceFieldTableNameOrId'),
name: 'config.table_name_or_id',
type: FormFieldType.Text,
required: true,
@@ -1148,19 +1161,19 @@ export const DataSourceFormFields = {
],
[DataSourceKey.DINGTALK_AI_TABLE]: [
{
- label: 'Access Token',
+ label: t('setting.dataSourceFieldAccessToken'),
name: 'config.credentials.access_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Base ID',
+ label: t('setting.dataSourceFieldBaseId'),
name: 'config.table_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Operator ID',
+ label: t('setting.dataSourceFieldOperatorId'),
name: 'config.operator_id',
type: FormFieldType.Text,
required: true,
@@ -1168,46 +1181,46 @@ export const DataSourceFormFields = {
],
[DataSourceKey.GITLAB]: [
{
- label: 'Project Owner',
+ label: t('setting.dataSourceFieldProjectOwner'),
name: 'config.project_owner',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Project Name',
+ label: t('setting.dataSourceFieldProjectName'),
name: 'config.project_name',
type: FormFieldType.Text,
required: true,
},
{
- label: 'GitLab Personal Access Token',
+ label: t('setting.dataSourceFieldGitlabPersonalAccessToken'),
name: 'config.credentials.gitlab_access_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'GitLab URL',
+ label: t('setting.dataSourceFieldGitlabUrl'),
name: 'config.gitlab_url',
type: FormFieldType.Text,
required: true,
placeholder: 'https://gitlab.com',
},
{
- label: 'include Merge Requests',
+ label: t('setting.dataSourceIncludeMergeRequests'),
name: 'config.include_mrs',
type: FormFieldType.Checkbox,
required: false,
defaultValue: true,
},
{
- label: 'include Issues',
+ label: t('setting.dataSourceIncludeIssues'),
name: 'config.include_issues',
type: FormFieldType.Checkbox,
required: false,
defaultValue: true,
},
{
- label: 'include Code Files',
+ label: t('setting.dataSourceIncludeCodeFiles'),
name: 'config.include_code_files',
type: FormFieldType.Checkbox,
required: false,
@@ -1216,25 +1229,25 @@ export const DataSourceFormFields = {
],
[DataSourceKey.ASANA]: [
{
- label: 'API Token',
+ label: t('setting.dataSourceFieldApiToken'),
name: 'config.credentials.asana_api_token_secret',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Workspace ID',
+ label: t('setting.dataSourceFieldWorkspaceId'),
name: 'config.asana_workspace_id',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Project IDs',
+ label: t('setting.dataSourceFieldProjectIds'),
name: 'config.asana_project_ids',
type: FormFieldType.Text,
required: false,
},
{
- label: 'Team ID',
+ label: t('setting.dataSourceFieldTeamId'),
name: 'config.asana_team_id',
type: FormFieldType.Text,
required: false,
@@ -1242,32 +1255,32 @@ export const DataSourceFormFields = {
],
[DataSourceKey.GITHUB]: [
{
- label: 'Repository Owner',
+ label: t('setting.dataSourceFieldRepositoryOwner'),
name: 'config.repository_owner',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Repository Name',
+ label: t('setting.dataSourceFieldRepositoryName'),
name: 'config.repository_name',
type: FormFieldType.Text,
required: true,
},
{
- label: 'GitHub Access Token',
+ label: t('setting.dataSourceFieldGithubAccessToken'),
name: 'config.credentials.github_access_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Include Pull Requests',
+ label: t('setting.dataSourceIncludePullRequests'),
name: 'config.include_pull_requests',
type: FormFieldType.Checkbox,
required: false,
defaultValue: true,
},
{
- label: 'Include Issues',
+ label: t('setting.dataSourceFieldIncludeIssues'),
name: 'config.include_issues',
type: FormFieldType.Checkbox,
required: false,
@@ -1276,37 +1289,37 @@ export const DataSourceFormFields = {
],
[DataSourceKey.IMAP]: [
{
- label: 'Username',
+ label: t('setting.dataSourceFieldUsername'),
name: 'config.credentials.imap_username',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Password',
+ label: t('setting.dataSourceFieldPassword'),
name: 'config.credentials.imap_password',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Host',
+ label: t('setting.dataSourceFieldHost'),
name: 'config.imap_host',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Port',
+ label: t('setting.dataSourceFieldPort'),
name: 'config.imap_port',
type: FormFieldType.Number,
required: true,
},
{
- label: 'Mailboxes',
+ label: t('setting.dataSourceFieldMailboxes'),
name: 'config.imap_mailbox',
type: FormFieldType.Tag,
required: false,
},
{
- label: 'Poll Range',
+ label: t('setting.dataSourceFieldPollRange'),
name: 'config.poll_range',
type: FormFieldType.Number,
required: false,
@@ -1315,70 +1328,70 @@ export const DataSourceFormFields = {
[DataSourceKey.BITBUCKET]: bitbucketConstant(t),
[DataSourceKey.ZENDESK]: [
{
- label: 'Zendesk Domain',
+ label: t('setting.dataSourceFieldZendeskDomain'),
name: 'config.credentials.zendesk_subdomain',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Zendesk Email',
+ label: t('setting.dataSourceFieldZendeskEmail'),
name: 'config.credentials.zendesk_email',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Zendesk Token',
+ label: t('setting.dataSourceFieldZendeskToken'),
name: 'config.credentials.zendesk_token',
type: FormFieldType.Password,
required: true,
},
{
- label: 'Content',
+ label: t('setting.dataSourceFieldContent'),
name: 'config.zendesk_content_type',
type: FormFieldType.Segmented,
required: true,
options: [
- { label: 'Articles', value: 'articles' },
- { label: 'Tickets', value: 'tickets' },
+ { label: t('setting.dataSourceOptionArticles'), value: 'articles' },
+ { label: t('setting.dataSourceOptionTickets'), value: 'tickets' },
],
},
],
[DataSourceKey.SEAFILE]: seafileConstant(t),
[DataSourceKey.MYSQL]: [
{
- label: 'Host',
+ label: t('setting.dataSourceFieldHost'),
name: 'config.host',
type: FormFieldType.Text,
required: true,
placeholder: 'localhost',
},
{
- label: 'Port',
+ label: t('setting.dataSourceFieldPort'),
name: 'config.port',
type: FormFieldType.Number,
required: true,
placeholder: '3306',
},
{
- label: 'Database',
+ label: t('setting.dataSourceFieldDatabase'),
name: 'config.database',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Username',
+ label: t('setting.dataSourceFieldUsername'),
name: 'config.credentials.username',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Password',
+ label: t('setting.dataSourceFieldPassword'),
name: 'config.credentials.password',
type: FormFieldType.Password,
required: true,
},
{
- label: 'SQL Query',
+ label: t('setting.dataSourceFieldSqlQuery'),
name: 'config.query',
type: FormFieldType.Textarea,
required: false,
@@ -1386,7 +1399,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.mysqlQueryTip'),
},
{
- label: 'Content Columns',
+ label: t('setting.dataSourceFieldContentColumns'),
name: 'config.content_columns',
type: FormFieldType.Text,
required: false,
@@ -1394,7 +1407,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.mysqlContentColumnsTip'),
},
{
- label: 'Metadata Columns',
+ label: t('setting.dataSourceFieldMetadataColumns'),
name: 'config.metadata_columns',
type: FormFieldType.Text,
required: false,
@@ -1402,7 +1415,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.mysqlMetadataColumnsTip'),
},
{
- label: 'ID Column',
+ label: t('setting.dataSourceFieldIdColumn'),
name: 'config.id_column',
type: FormFieldType.Text,
required: false,
@@ -1410,7 +1423,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.mysqlIdColumnTip'),
},
{
- label: 'Timestamp Column',
+ label: t('setting.dataSourceFieldTimestampColumn'),
name: 'config.timestamp_column',
type: FormFieldType.Text,
required: false,
@@ -1420,39 +1433,39 @@ export const DataSourceFormFields = {
],
[DataSourceKey.POSTGRESQL]: [
{
- label: 'Host',
+ label: t('setting.dataSourceFieldHost'),
name: 'config.host',
type: FormFieldType.Text,
required: true,
placeholder: 'localhost',
},
{
- label: 'Port',
+ label: t('setting.dataSourceFieldPort'),
name: 'config.port',
type: FormFieldType.Number,
required: true,
placeholder: '5432',
},
{
- label: 'Database',
+ label: t('setting.dataSourceFieldDatabase'),
name: 'config.database',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Username',
+ label: t('setting.dataSourceFieldUsername'),
name: 'config.credentials.username',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Password',
+ label: t('setting.dataSourceFieldPassword'),
name: 'config.credentials.password',
type: FormFieldType.Password,
required: true,
},
{
- label: 'SQL Query',
+ label: t('setting.dataSourceFieldSqlQuery'),
name: 'config.query',
type: FormFieldType.Textarea,
required: false,
@@ -1460,7 +1473,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.postgresqlQueryTip'),
},
{
- label: 'Content Columns',
+ label: t('setting.dataSourceFieldContentColumns'),
name: 'config.content_columns',
type: FormFieldType.Text,
required: false,
@@ -1468,7 +1481,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.postgresqlContentColumnsTip'),
},
{
- label: 'Metadata Columns',
+ label: t('setting.dataSourceFieldMetadataColumns'),
name: 'config.metadata_columns',
type: FormFieldType.Text,
required: false,
@@ -1476,7 +1489,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.postgresqlMetadataColumnsTip'),
},
{
- label: 'ID Column',
+ label: t('setting.dataSourceFieldIdColumn'),
name: 'config.id_column',
type: FormFieldType.Text,
required: false,
@@ -1484,7 +1497,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.postgresqlIdColumnTip'),
},
{
- label: 'Timestamp Column',
+ label: t('setting.dataSourceFieldTimestampColumn'),
name: 'config.timestamp_column',
type: FormFieldType.Text,
required: false,
@@ -1494,7 +1507,7 @@ export const DataSourceFormFields = {
],
[DataSourceKey.BIGQUERY]: [
{
- label: 'Project ID',
+ label: t('setting.dataSourceFieldProjectId'),
name: 'config.project_id',
type: FormFieldType.Text,
required: true,
@@ -1502,7 +1515,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryProjectIdTip'),
},
{
- label: 'Location',
+ label: t('setting.dataSourceFieldLocation'),
name: 'config.location',
type: FormFieldType.Text,
required: false,
@@ -1510,7 +1523,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryLocationTip'),
},
{
- label: 'Service Account JSON',
+ label: t('setting.dataSourceFieldServiceAccountJson'),
name: 'config.credentials.service_account_json',
type: FormFieldType.Password,
required: true,
@@ -1518,7 +1531,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryServiceAccountJsonTip'),
},
{
- label: 'Dataset ID',
+ label: t('setting.dataSourceFieldDatasetId'),
name: 'config.dataset_id',
type: FormFieldType.Text,
required: false,
@@ -1528,13 +1541,13 @@ export const DataSourceFormFields = {
const hasQuery = !!(values?.config?.query ?? '').trim();
const hasTable = !!(values?.config?.table_id ?? '').trim();
if (!hasQuery && !((val ?? '').trim() && hasTable)) {
- return 'Dataset ID is required when not using a custom SQL Query';
+ return t('setting.dataSourceBigqueryDatasetIdRequired');
}
return true;
},
},
{
- label: 'Table ID',
+ label: t('setting.dataSourceFieldTableId'),
name: 'config.table_id',
type: FormFieldType.Text,
required: false,
@@ -1544,13 +1557,13 @@ export const DataSourceFormFields = {
const hasQuery = !!(values?.config?.query ?? '').trim();
const hasDataset = !!(values?.config?.dataset_id ?? '').trim();
if (!hasQuery && !(hasDataset && (val ?? '').trim())) {
- return 'Table ID is required when not using a custom SQL Query';
+ return t('setting.dataSourceBigqueryTableIdRequired');
}
return true;
},
},
{
- label: 'SQL Query',
+ label: t('setting.dataSourceFieldSqlQuery'),
name: 'config.query',
type: FormFieldType.Textarea,
required: false,
@@ -1561,13 +1574,13 @@ export const DataSourceFormFields = {
const hasDataset = !!(values?.config?.dataset_id ?? '').trim();
const hasTable = !!(values?.config?.table_id ?? '').trim();
if (!hasQuery && !(hasDataset && hasTable)) {
- return 'Provide a SQL Query, or both Dataset ID and Table ID';
+ return t('setting.dataSourceBigqueryQueryRequired');
}
return true;
},
},
{
- label: 'Content Columns',
+ label: t('setting.dataSourceFieldContentColumns'),
name: 'config.content_columns',
type: FormFieldType.Text,
required: true,
@@ -1575,7 +1588,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryContentColumnsTip'),
},
{
- label: 'Metadata Columns',
+ label: t('setting.dataSourceFieldMetadataColumns'),
name: 'config.metadata_columns',
type: FormFieldType.Text,
required: false,
@@ -1583,7 +1596,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryMetadataColumnsTip'),
},
{
- label: 'ID Column',
+ label: t('setting.dataSourceFieldIdColumn'),
name: 'config.id_column',
type: FormFieldType.Text,
required: false,
@@ -1591,7 +1604,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryIdColumnTip'),
},
{
- label: 'Timestamp Column',
+ label: t('setting.dataSourceFieldTimestampColumn'),
name: 'config.timestamp_column',
type: FormFieldType.Text,
required: false,
@@ -1599,7 +1612,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryTimestampColumnTip'),
},
{
- label: 'Max Bytes Billed',
+ label: t('setting.dataSourceFieldMaxBytesBilled'),
name: 'config.maximum_bytes_billed',
type: FormFieldType.Number,
required: false,
@@ -1607,11 +1620,13 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryMaximumBytesBilledTip'),
validation: {
min: 1,
- message: 'Max Bytes Billed must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldMaxBytesBilled'),
+ }),
},
},
{
- label: 'Job Timeout (ms)',
+ label: t('setting.dataSourceFieldJobTimeout'),
name: 'config.job_timeout_ms',
type: FormFieldType.Number,
required: false,
@@ -1619,33 +1634,39 @@ export const DataSourceFormFields = {
tooltip: t('setting.bigqueryJobTimeoutMsTip'),
validation: {
min: 1,
- message: 'Job Timeout must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldJobTimeout'),
+ }),
},
},
{
- label: 'Page Size',
+ label: t('setting.dataSourceFieldPageSize'),
name: 'config.page_size',
type: FormFieldType.Number,
required: false,
placeholder: '1000',
validation: {
min: 1,
- message: 'Page Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldPageSize'),
+ }),
},
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
placeholder: '100',
validation: {
min: 1,
- message: 'Batch Size must be at least 1',
+ message: t('setting.dataSourceValidationMinOne', {
+ label: t('setting.dataSourceFieldBatchSize'),
+ }),
},
},
{
- label: 'Use Query Cache',
+ label: t('setting.dataSourceFieldUseQueryCache'),
name: 'config.use_query_cache',
type: FormFieldType.Checkbox,
required: false,
@@ -1655,14 +1676,14 @@ export const DataSourceFormFields = {
[DataSourceKey.REST_API]: [
// ── Essential fields ──────────────────────────────────────────────
{
- label: 'Base URL',
+ label: t('setting.dataSourceFieldBaseUrl'),
name: 'config.url',
type: FormFieldType.Text,
required: true,
placeholder: 'https://api.example.com/v1/resources',
},
{
- label: 'HTTP Method',
+ label: t('setting.dataSourceFieldHttpMethod'),
name: 'config.method',
type: FormFieldType.Select,
required: true,
@@ -1673,7 +1694,7 @@ export const DataSourceFormFields = {
defaultValue: 'GET',
},
{
- label: 'Query Parameters',
+ label: t('setting.dataSourceFieldQueryParameters'),
name: 'config.query_params',
type: FormFieldType.Textarea,
required: false,
@@ -1681,7 +1702,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.restApiQueryParamsTip'),
},
{
- label: 'Items Path',
+ label: t('setting.dataSourceFieldItemsPath'),
name: 'config.items_path',
type: FormFieldType.Text,
required: false,
@@ -1689,7 +1710,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.restApiItemsPathTip'),
},
{
- label: 'ID Field',
+ label: t('setting.dataSourceFieldIdField'),
name: 'config.id_field',
type: FormFieldType.Text,
required: false,
@@ -1697,20 +1718,23 @@ export const DataSourceFormFields = {
tooltip: t('setting.restApiIdFieldTip'),
},
{
- label: 'Auth Type',
+ label: t('setting.dataSourceFieldAuthType'),
name: 'config.auth_type',
type: FormFieldType.Select,
required: true,
options: [
- { label: 'None', value: 'none' },
- { label: 'API Key (Header)', value: 'api_key_header' },
- { label: 'Bearer Token', value: 'bearer' },
- { label: 'Basic Auth', value: 'basic' },
+ { label: t('setting.dataSourceOptionNone'), value: 'none' },
+ {
+ label: t('setting.dataSourceOptionApiKeyHeader'),
+ value: 'api_key_header',
+ },
+ { label: t('setting.dataSourceOptionBearerToken'), value: 'bearer' },
+ { label: t('setting.dataSourceOptionBasicAuth'), value: 'basic' },
],
defaultValue: 'none',
},
{
- label: 'API Key Header Name',
+ label: t('setting.dataSourceFieldApiKeyHeaderName'),
name: 'config.auth_config.header_name',
type: FormFieldType.Text,
required: false,
@@ -1728,7 +1752,7 @@ export const DataSourceFormFields = {
},
},
{
- label: 'API Key Value',
+ label: t('setting.dataSourceFieldApiKeyValue'),
name: 'config.credentials.api_key',
type: FormFieldType.Password,
required: false,
@@ -1742,7 +1766,7 @@ export const DataSourceFormFields = {
},
},
{
- label: 'Bearer Token',
+ label: t('setting.dataSourceFieldBearerToken'),
name: 'config.credentials.token',
type: FormFieldType.Password,
required: false,
@@ -1755,7 +1779,7 @@ export const DataSourceFormFields = {
},
},
{
- label: 'Username',
+ label: t('setting.dataSourceFieldUsername'),
name: 'config.credentials.username',
type: FormFieldType.Text,
required: false,
@@ -1771,7 +1795,7 @@ export const DataSourceFormFields = {
},
},
{
- label: 'Password',
+ label: t('setting.dataSourceFieldPassword'),
name: 'config.credentials.password',
type: FormFieldType.Password,
required: false,
@@ -1784,7 +1808,7 @@ export const DataSourceFormFields = {
},
},
{
- label: 'Content Fields',
+ label: t('setting.dataSourceFieldContentFields'),
name: 'config.content_fields',
type: FormFieldType.Text,
required: true,
@@ -1792,7 +1816,7 @@ export const DataSourceFormFields = {
tooltip: t('setting.restApiContentFieldsTip'),
},
{
- label: 'Metadata Fields',
+ label: t('setting.dataSourceFieldMetadataFields'),
name: 'config.metadata_fields',
type: FormFieldType.Text,
required: false,
@@ -1800,20 +1824,20 @@ export const DataSourceFormFields = {
tooltip: t('setting.restApiMetadataFieldsTip'),
},
{
- label: 'Pagination Type',
+ label: t('setting.dataSourceFieldPaginationType'),
name: 'config.pagination_type',
type: FormFieldType.Select,
required: true,
options: [
- { label: 'None', value: 'none' },
- { label: 'Page', value: 'page' },
- { label: 'Offset', value: 'offset' },
- { label: 'Cursor', value: 'cursor' },
+ { label: t('setting.dataSourceOptionNone'), value: 'none' },
+ { label: t('setting.dataSourceOptionPage'), value: 'page' },
+ { label: t('setting.dataSourceOptionOffset'), value: 'offset' },
+ { label: t('setting.dataSourceOptionCursor'), value: 'cursor' },
],
defaultValue: 'none',
},
{
- label: 'Start Page',
+ label: t('setting.dataSourceFieldStartPage'),
name: 'config.pagination_config.start_page',
type: FormFieldType.Number,
required: false,
@@ -1821,7 +1845,7 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => values?.config?.pagination_type === 'page',
},
{
- label: 'Offset Param',
+ label: t('setting.dataSourceFieldOffsetParam'),
name: 'config.pagination_config.offset_param',
type: FormFieldType.Text,
required: false,
@@ -1830,7 +1854,7 @@ export const DataSourceFormFields = {
values?.config?.pagination_type === 'offset',
},
{
- label: 'Start Offset',
+ label: t('setting.dataSourceFieldStartOffset'),
name: 'config.pagination_config.start_offset',
type: FormFieldType.Number,
required: false,
@@ -1839,7 +1863,7 @@ export const DataSourceFormFields = {
values?.config?.pagination_type === 'offset',
},
{
- label: 'Cursor Param',
+ label: t('setting.dataSourceFieldCursorParam'),
name: 'config.pagination_config.cursor_param',
type: FormFieldType.Text,
required: false,
@@ -1848,7 +1872,7 @@ export const DataSourceFormFields = {
values?.config?.pagination_type === 'cursor',
},
{
- label: 'Next Cursor JSONPath',
+ label: t('setting.dataSourceFieldNextCursorJsonpath'),
name: 'config.pagination_config.next_cursor_path',
type: FormFieldType.Text,
required: false,
@@ -1859,7 +1883,7 @@ export const DataSourceFormFields = {
},
// ── Advanced settings toggle ──────────────────────────────────────
{
- label: 'Advanced Settings',
+ label: t('setting.dataSourceFieldAdvancedSettings'),
name: 'config.show_advanced',
type: FormFieldType.Switch,
required: false,
@@ -1867,7 +1891,7 @@ export const DataSourceFormFields = {
},
// ── Advanced fields (hidden until toggled) ────────────────────────
{
- label: 'Custom Headers (JSON)',
+ label: t('setting.dataSourceFieldCustomHeaders'),
name: 'config.headers',
type: FormFieldType.Textarea,
required: false,
@@ -1876,7 +1900,7 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => !!values?.config?.show_advanced,
},
{
- label: 'Limit Param',
+ label: t('setting.dataSourceFieldLimitParam'),
name: 'config.pagination_config.limit_param',
type: FormFieldType.Text,
required: false,
@@ -1886,7 +1910,7 @@ export const DataSourceFormFields = {
values?.config?.pagination_type === 'offset',
},
{
- label: 'Initial Cursor',
+ label: t('setting.dataSourceFieldInitialCursor'),
name: 'config.pagination_config.initial_cursor',
type: FormFieldType.Text,
required: false,
@@ -1895,7 +1919,7 @@ export const DataSourceFormFields = {
values?.config?.pagination_type === 'cursor',
},
{
- label: 'Max Pages',
+ label: t('setting.dataSourceFieldMaxPages'),
name: 'config.max_pages',
type: FormFieldType.Number,
required: false,
@@ -1903,7 +1927,7 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => !!values?.config?.show_advanced,
},
{
- label: 'Request Delay (seconds)',
+ label: t('setting.dataSourceFieldRequestDelay'),
name: 'config.request_delay',
type: FormFieldType.Number,
required: false,
@@ -1913,7 +1937,7 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => !!values?.config?.show_advanced,
},
{
- label: 'Poll Timestamp Field',
+ label: t('setting.dataSourceFieldPollTimestampField'),
name: 'config.poll_timestamp_field',
type: FormFieldType.Text,
required: false,
@@ -1922,7 +1946,7 @@ export const DataSourceFormFields = {
shouldRender: (values: any) => !!values?.config?.show_advanced,
},
{
- label: 'Request Body (POST) JSON',
+ label: t('setting.dataSourceFieldRequestBody'),
name: 'config.request_body',
type: FormFieldType.Textarea,
required: false,
@@ -1932,7 +1956,7 @@ export const DataSourceFormFields = {
!!values?.config?.show_advanced && values?.config?.method === 'POST',
},
],
-};
+});
export const DataSourceFormDefaultValues = {
[DataSourceKey.RSS]: {
@@ -2432,15 +2456,16 @@ export const DataSourceFormDefaultValues = {
};
export const getDataSourceFieldsWithExtras = (
+ t: TFunction,
source?: DataSourceKey,
-): FormFieldConfig[] => {
+) => {
if (!source) {
return [];
}
- const sourceFields =
- DataSourceFormFields[source as keyof typeof DataSourceFormFields] || [];
- const extraFields = getCommonExtraFields(source);
+ const formFields = generateDataSourceFormFields(t);
+ const sourceFields = formFields[source] || [];
+ const extraFields = getCommonExtraFields(t, source);
if (source !== DataSourceKey.JIRA) {
return [...sourceFields, ...extraFields];
diff --git a/web/src/pages/user-setting/data-source/constant/jira-constant.tsx b/web/src/pages/user-setting/data-source/constant/jira-constant.tsx
index 31af61c478..8c4224cb0a 100644
--- a/web/src/pages/user-setting/data-source/constant/jira-constant.tsx
+++ b/web/src/pages/user-setting/data-source/constant/jira-constant.tsx
@@ -3,7 +3,7 @@ import { TFunction } from 'i18next';
export const jiraConstant = (t: TFunction) => [
{
- label: 'Jira User Email',
+ label: t('setting.dataSourceFieldJiraUserEmail'),
name: 'config.credentials.jira_user_email',
type: FormFieldType.Text,
required: true,
@@ -12,13 +12,18 @@ export const jiraConstant = (t: TFunction) => [
shouldRender: (formValues: any) => formValues?.config?.is_cloud !== false,
customValidate: (val: string, formValues: any) => {
if (formValues?.config?.is_cloud !== false) {
- return Boolean(val) || 'Jira User Email is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldJiraUserEmail'),
+ })
+ );
}
return true;
},
},
{
- label: 'Jira Username',
+ label: t('setting.dataSourceFieldJiraUsername'),
name: 'config.credentials.jira_username',
type: FormFieldType.Text,
required: true,
@@ -26,13 +31,18 @@ export const jiraConstant = (t: TFunction) => [
shouldRender: (formValues: any) => formValues?.config?.is_cloud === false,
customValidate: (val: string, formValues: any) => {
if (formValues?.config?.is_cloud === false) {
- return Boolean(val) || 'Jira Username is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldJiraUsername'),
+ })
+ );
}
return true;
},
},
{
- label: 'Jira Base URL',
+ label: t('setting.dataSourceFieldJiraBaseUrl'),
name: 'config.base_url',
type: FormFieldType.Text,
required: true,
@@ -40,7 +50,7 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraBaseUrlTip'),
},
{
- label: 'Project Key',
+ label: t('setting.dataSourceFieldProjectKey'),
name: 'config.project_key',
type: FormFieldType.Text,
required: false,
@@ -48,7 +58,7 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraProjectKeyTip'),
},
{
- label: 'Custom JQL',
+ label: t('setting.dataSourceFieldCustomJql'),
name: 'config.jql_query',
type: FormFieldType.Textarea,
required: false,
@@ -56,14 +66,14 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraJqlTip'),
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
tooltip: t('setting.jiraBatchSizeTip'),
},
{
- label: 'Attachment Size Limit (bytes)',
+ label: t('setting.dataSourceFieldAttachmentSizeLimit'),
name: 'config.attachment_size_limit',
type: FormFieldType.Number,
required: false,
@@ -71,21 +81,21 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraAttachmentSizeTip'),
},
{
- label: 'Labels to Skip',
+ label: t('setting.dataSourceFieldLabelsToSkip'),
name: 'config.labels_to_skip',
type: FormFieldType.Tag,
required: false,
tooltip: t('setting.jiraLabelsTip'),
},
{
- label: 'Comment Email Blacklist',
+ label: t('setting.dataSourceFieldCommentEmailBlacklist'),
name: 'config.comment_email_blacklist',
type: FormFieldType.Tag,
required: false,
tooltip: t('setting.jiraBlacklistTip'),
},
{
- label: 'Include Comments',
+ label: t('setting.dataSourceFieldIncludeComments'),
name: 'config.include_comments',
type: FormFieldType.Checkbox,
required: false,
@@ -93,7 +103,7 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraCommentsTip'),
},
{
- label: 'Include Attachments',
+ label: t('setting.dataSourceFieldIncludeAttachments'),
name: 'config.include_attachments',
type: FormFieldType.Checkbox,
required: false,
@@ -101,17 +111,17 @@ export const jiraConstant = (t: TFunction) => [
tooltip: t('setting.jiraAttachmentsTip'),
},
{
- label: 'Mode',
+ label: t('setting.dataSourceFieldMode'),
name: 'config.is_cloud',
type: FormFieldType.Segmented,
options: [
- { label: 'Cloud', value: true },
- { label: 'Server', value: false },
+ { label: t('setting.dataSourceOptionCloud'), value: true },
+ { label: t('setting.dataSourceOptionServer'), value: false },
],
defaultValue: true,
},
{
- label: 'Jira API Token',
+ label: t('setting.dataSourceFieldJiraApiToken'),
name: 'config.credentials.jira_api_token',
type: FormFieldType.Password,
required: false,
@@ -119,13 +129,18 @@ export const jiraConstant = (t: TFunction) => [
shouldRender: (formValues: any) => formValues?.config?.is_cloud !== false,
customValidate: (val: string, formValues: any) => {
if (formValues?.config?.is_cloud !== false) {
- return Boolean(val) || 'Jira API Token is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldJiraApiToken'),
+ })
+ );
}
return true;
},
},
{
- label: 'Jira Password',
+ label: t('setting.dataSourceFieldJiraPassword'),
name: 'config.credentials.jira_password',
type: FormFieldType.Password,
required: false,
@@ -133,13 +148,18 @@ export const jiraConstant = (t: TFunction) => [
shouldRender: (formValues: any) => formValues?.config?.is_cloud === false,
customValidate: (val: string, formValues: any) => {
if (formValues?.config?.is_cloud === false) {
- return Boolean(val) || 'Jira Password is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldJiraPassword'),
+ })
+ );
}
return true;
},
},
{
- label: 'Use Scoped Token',
+ label: t('setting.dataSourceFieldUseScopedToken'),
name: 'config.scoped_token',
type: FormFieldType.Checkbox,
required: false,
diff --git a/web/src/pages/user-setting/data-source/constant/s3-constant.tsx b/web/src/pages/user-setting/data-source/constant/s3-constant.tsx
index da1cd347e9..d9c25f467b 100644
--- a/web/src/pages/user-setting/data-source/constant/s3-constant.tsx
+++ b/web/src/pages/user-setting/data-source/constant/s3-constant.tsx
@@ -8,13 +8,13 @@ const awsRegionOptions = BedrockRegionList.map((r) => ({
}));
export const S3Constant = (t: TFunction) => [
{
- label: 'Bucket Name',
+ label: t('setting.dataSourceFieldBucketName'),
name: 'config.bucket_name',
type: FormFieldType.Text,
required: true,
},
{
- label: 'Region',
+ label: t('setting.dataSourceFieldRegion'),
name: 'config.credentials.region',
type: FormFieldType.Select,
required: false,
@@ -27,13 +27,13 @@ export const S3Constant = (t: TFunction) => [
credentials.aws_access_key_id || credentials.aws_secret_access_key,
);
if (bucketType === 's3' && hasAccessKey) {
- return Boolean(val) || 'Region is required when using access key';
+ return Boolean(val) || t('setting.dataSourceS3RegionRequired');
}
return true;
},
},
{
- label: 'Prefix',
+ label: t('setting.dataSourceFieldPrefix'),
name: 'config.prefix',
type: FormFieldType.Text,
required: false,
@@ -41,22 +41,25 @@ export const S3Constant = (t: TFunction) => [
},
{
- label: 'Mode',
+ label: t('setting.dataSourceFieldMode'),
name: 'config.bucket_type',
type: FormFieldType.Segmented,
options: [
{ label: 'S3', value: 's3' },
- { label: 'S3 Compatible', value: 's3_compatible' },
+ {
+ label: t('setting.dataSourceOptionS3Compatible'),
+ value: 's3_compatible',
+ },
],
},
{
- label: 'Authentication',
+ label: t('setting.dataSourceFieldAuthentication'),
name: 'config.credentials.authentication_method',
type: FormFieldType.Segmented,
options: [
- { label: 'Access Key', value: 'access_key' },
- { label: 'IAM Role', value: 'iam_role' },
- { label: 'Assume Role', value: 'assume_role' },
+ { label: t('setting.dataSourceOptionAccessKey'), value: 'access_key' },
+ { label: t('setting.dataSourceOptionIamRole'), value: 'iam_role' },
+ { label: t('setting.dataSourceOptionAssumeRole'), value: 'assume_role' },
],
shouldRender: (formValues: any) => {
const bucketType = formValues?.config?.bucket_type;
@@ -65,7 +68,7 @@ export const S3Constant = (t: TFunction) => [
},
{
name: 'config.credentials.aws_access_key_id',
- label: 'AWS Access Key ID',
+ label: t('setting.dataSourceFieldAwsAccessKeyId'),
type: FormFieldType.Text,
customValidate: (val: string, formValues: any) => {
const authMode = formValues?.config?.credentials?.authentication_method;
@@ -75,7 +78,9 @@ export const S3Constant = (t: TFunction) => [
!val &&
(authMode === 'access_key' || bucketType === 's3_compatible')
) {
- return 'AWS Access Key ID is required';
+ return t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldAwsAccessKeyId'),
+ });
}
return true;
},
@@ -87,13 +92,18 @@ export const S3Constant = (t: TFunction) => [
},
{
name: 'config.credentials.aws_secret_access_key',
- label: 'AWS Secret Access Key',
+ label: t('setting.dataSourceFieldAwsSecretAccessKey'),
type: FormFieldType.Password,
customValidate: (val: string, formValues: any) => {
const authMode = formValues?.config?.credentials?.authentication_method;
const bucketType = formValues?.config?.bucket_type;
if (authMode === 'access_key' || bucketType === 's3_compatible') {
- return Boolean(val) || '"AWS Secret Access Key" is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldAwsSecretAccessKey'),
+ })
+ );
}
return true;
},
@@ -105,15 +115,20 @@ export const S3Constant = (t: TFunction) => [
},
{
name: 'config.credentials.aws_role_arn',
- label: 'Role ARN',
- tooltip: 'The role will be assumed by the runtime environment.',
+ label: t('setting.dataSourceFieldRoleArn'),
+ tooltip: t('setting.dataSourceS3RoleArnTip'),
type: FormFieldType.Text,
placeholder: 'arn:aws:iam::123456789012:role/YourRole',
customValidate: (val: string, formValues: any) => {
const authMode = formValues?.config?.credentials?.authentication_method;
const bucketType = formValues?.config?.bucket_type;
if (authMode === 'iam_role' || bucketType === 's3') {
- return Boolean(val) || '"AWS Secret Access Key" is required';
+ return (
+ Boolean(val) ||
+ t('setting.dataSourceValidationFieldRequired', {
+ label: t('setting.dataSourceFieldAwsSecretAccessKey'),
+ })
+ );
}
return true;
},
@@ -134,20 +149,23 @@ export const S3Constant = (t: TFunction) => [
},
render: () => (
- {'No credentials required. Uses the default environment role.'}
+ {t('setting.dataSourceS3AssumeRoleTip')}
),
},
{
name: 'config.credentials.addressing_style',
- label: 'Addressing Style',
+ label: t('setting.dataSourceFieldAddressingStyle'),
tooltip: t('setting.S3CompatibleAddressingStyleTip'),
required: false,
type: FormFieldType.Select,
defaultValue: 'virtual',
options: [
- { label: 'Virtual Hosted Style', value: 'virtual' },
- { label: 'Path Style', value: 'path' },
+ {
+ label: t('setting.dataSourceOptionVirtualHostedStyle'),
+ value: 'virtual',
+ },
+ { label: t('setting.dataSourceOptionPathStyle'), value: 'path' },
],
shouldRender: (formValues: any) => {
// const authMode = formValues?.config?.authMode;
@@ -157,7 +175,7 @@ export const S3Constant = (t: TFunction) => [
},
{
name: 'config.credentials.endpoint_url',
- label: 'Endpoint URL',
+ label: t('setting.dataSourceFieldEndpointUrl'),
tooltip: t('setting.S3CompatibleEndpointUrlTip'),
placeholder: 'https://fsn1.your-objectstorage.com',
required: false,
diff --git a/web/src/pages/user-setting/data-source/constant/seafile-constant.tsx b/web/src/pages/user-setting/data-source/constant/seafile-constant.tsx
index cc8a5b593c..1e62ec22bc 100644
--- a/web/src/pages/user-setting/data-source/constant/seafile-constant.tsx
+++ b/web/src/pages/user-setting/data-source/constant/seafile-constant.tsx
@@ -3,7 +3,7 @@ import { TFunction } from 'i18next';
export const seafileConstant = (t: TFunction) => [
{
- label: 'SeaFile Server URL',
+ label: t('setting.dataSourceFieldSeafileServerUrl'),
name: 'config.seafile_url',
type: FormFieldType.Text,
required: true,
@@ -11,13 +11,16 @@ export const seafileConstant = (t: TFunction) => [
tooltip: t('setting.seafileUrlTip'),
},
{
- label: 'Sync Scope',
+ label: t('setting.dataSourceFieldSyncScope'),
name: 'config.sync_scope',
type: FormFieldType.Segmented,
options: [
- { label: 'Entire Account', value: 'account' },
- { label: 'Single Library', value: 'library' },
- { label: 'Specific Directory', value: 'directory' },
+ { label: t('setting.dataSourceOptionEntireAccount'), value: 'account' },
+ { label: t('setting.dataSourceOptionSingleLibrary'), value: 'library' },
+ {
+ label: t('setting.dataSourceOptionSpecificDirectory'),
+ value: 'directory',
+ },
],
tooltip: t('setting.seafileSyncScopeTip'),
},
@@ -37,7 +40,7 @@ export const seafileConstant = (t: TFunction) => [
),
},
{
- label: 'Account API Token',
+ label: t('setting.dataSourceFieldAccountApiToken'),
name: 'config.credentials.seafile_token',
type: FormFieldType.Password,
required: false,
@@ -56,7 +59,7 @@ export const seafileConstant = (t: TFunction) => [
},
},
{
- label: 'Include Shared Libraries',
+ label: t('setting.dataSourceFieldIncludeSharedLibraries'),
name: 'config.include_shared',
type: FormFieldType.Checkbox,
required: false,
@@ -84,11 +87,15 @@ export const seafileConstant = (t: TFunction) => [
-
- Account API Token
+
+ {t('setting.dataSourceFieldAccountApiToken')}
+
{' ' + t('setting.seafileTokenPanelAccountBullet')}
-
- Library Token
+
+ {t('setting.dataSourceFieldLibraryToken')}
+
{' ' + t('setting.seafileTokenPanelLibraryBullet')}
@@ -96,7 +103,7 @@ export const seafileConstant = (t: TFunction) => [
),
},
{
- label: 'Account API Token',
+ label: t('setting.dataSourceFieldAccountApiToken'),
name: 'config.credentials.seafile_token',
type: FormFieldType.Password,
required: false,
@@ -107,7 +114,7 @@ export const seafileConstant = (t: TFunction) => [
},
},
{
- label: 'Library Token',
+ label: t('setting.dataSourceFieldLibraryToken'),
name: 'config.credentials.repo_token',
type: FormFieldType.Password,
required: false,
@@ -130,7 +137,7 @@ export const seafileConstant = (t: TFunction) => [
},
},
{
- label: 'Library ID',
+ label: t('setting.dataSourceFieldLibraryId'),
name: 'config.repo_id',
type: FormFieldType.Text,
required: false,
@@ -150,7 +157,7 @@ export const seafileConstant = (t: TFunction) => [
},
{
- label: 'Directory Path',
+ label: t('setting.dataSourceFieldDirectoryPath'),
name: 'config.sync_path',
type: FormFieldType.Text,
required: false,
@@ -168,7 +175,7 @@ export const seafileConstant = (t: TFunction) => [
},
{
- label: 'Batch Size',
+ label: t('setting.dataSourceFieldBatchSize'),
name: 'config.batch_size',
type: FormFieldType.Number,
required: false,
@@ -177,35 +184,35 @@ export const seafileConstant = (t: TFunction) => [
},
{
- label: 'Account API Token',
+ label: t('setting.dataSourceFieldAccountApiToken'),
name: 'config.credentials.seafile_token',
type: FormFieldType.Password,
required: false,
hidden: true,
},
{
- label: 'Library Token',
+ label: t('setting.dataSourceFieldLibraryToken'),
name: 'config.credentials.repo_token',
type: FormFieldType.Password,
required: false,
hidden: true,
},
{
- label: 'Library ID',
+ label: t('setting.dataSourceFieldLibraryId'),
name: 'config.repo_id',
type: FormFieldType.Text,
required: false,
hidden: true,
},
{
- label: 'Directory Path',
+ label: t('setting.dataSourceFieldDirectoryPath'),
name: 'config.sync_path',
type: FormFieldType.Text,
required: false,
hidden: true,
},
{
- label: 'Include Shared Libraries',
+ label: t('setting.dataSourceFieldIncludeSharedLibraries'),
name: 'config.include_shared',
type: FormFieldType.Checkbox,
required: false,
diff --git a/web/src/pages/user-setting/data-source/data-source-detail-page/index.tsx b/web/src/pages/user-setting/data-source/data-source-detail-page/index.tsx
index ae1f05c873..acf3bbbd1c 100644
--- a/web/src/pages/user-setting/data-source/data-source-detail-page/index.tsx
+++ b/web/src/pages/user-setting/data-source/data-source-detail-page/index.tsx
@@ -9,15 +9,15 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Separator } from '@/components/ui/separator';
import { RunningStatus, RunningStatusOld } from '@/constants/knowledge';
-import { t } from 'i18next';
import { isEqual } from 'lodash';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { FieldValues } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
import {
- DataSourceFormBaseFields,
DataSourceFormDefaultValues,
DataSourceKey,
getCommonExtraDefaultValues,
+ getDataSourceFormBaseFields,
getDataSourceFieldsWithExtras,
mergeDataSourceFormValues,
useDataSourceInfo,
@@ -31,6 +31,7 @@ import {
import { DataSourceLogsTable } from './log-table';
const SourceDetailPage = () => {
+ const { t } = useTranslation();
const formRef = useRef(null);
const { data: detail } = useFetchDataSourceDetail();
@@ -54,7 +55,7 @@ const SourceDetailPage = () => {
const customFields = useMemo(() => {
return [
{
- label: 'Prune Freq',
+ label: t('setting.dataSourcePruneFreq'),
name: 'prune_freq',
type: FormFieldType.Number,
required: false,
@@ -74,7 +75,7 @@ const SourceDetailPage = () => {
},
},
{
- label: 'Refresh Freq',
+ label: t('setting.dataSourceRefreshFreq'),
name: 'refresh_freq',
type: FormFieldType.Number,
required: false,
@@ -91,7 +92,7 @@ const SourceDetailPage = () => {
),
},
{
- label: 'Timeout Secs',
+ label: t('setting.dataSourceTimeoutSecs'),
name: 'timeout_secs',
type: FormFieldType.Number,
required: false,
@@ -112,7 +113,7 @@ const SourceDetailPage = () => {
),
},
];
- }, []);
+ }, [t]);
const { addLoading, handleAddOk } = useAddDataSource({ isEdit: true });
const { loading: testLoading, handleTest } = useTestDataSource();
@@ -164,13 +165,13 @@ const SourceDetailPage = () => {
}, [actionMode, onSubmit, updateStatus]);
const primaryActionLabel = useMemo(() => {
- if (actionMode === 'stop') return 'Stop';
- if (actionMode === 'resume') return 'Resume';
- return 'Save';
- }, [actionMode]);
+ if (actionMode === 'stop') return t('common.stop');
+ if (actionMode === 'resume') return t('common.resume');
+ return t('common.save');
+ }, [actionMode, t]);
useEffect(() => {
- const baseFields = DataSourceFormBaseFields.map((field) => {
+ const baseFields = getDataSourceFormBaseFields(t).map((field) => {
if (field.name === 'name') {
return {
...field,
@@ -185,7 +186,7 @@ const SourceDetailPage = () => {
if (detail) {
const fields = [
...baseFields,
- ...getDataSourceFieldsWithExtras(detail.source as any),
+ ...getDataSourceFieldsWithExtras(t, detail.source as any),
...customFields,
] as FormFieldConfig[];
@@ -210,7 +211,7 @@ const SourceDetailPage = () => {
setDefaultValues(defaultValueTemp);
setIsDirty(false);
}
- }, [detail, customFields, onSubmit]);
+ }, [detail, customFields, onSubmit, t]);
useEffect(() => {
const instance = formRef.current;