Commit 90dbfcf5 by 杨明

补充国际化

1 parent 0c67f369
const translation = {
title: 'Annotations',
name: 'Annotation Reply',
editBy: 'Answer edited by {{author}}',
noData: {
title: 'No annotations',
description: 'You can edit annotations during app debugging or import annotations in bulk here for a high-quality response.',
},
table: {
header: {
question: 'question',
answer: 'answer',
createdAt: 'created at',
hits: 'hits',
actions: 'actions',
addAnnotation: 'Add Annotation',
bulkImport: 'Bulk Import',
bulkExport: 'Bulk Export',
clearAll: 'Clear All Annotation',
},
},
editModal: {
title: 'Edit Annotation Reply',
queryName: 'User Query',
answerName: 'Storyteller Bot',
yourAnswer: 'Your Answer',
answerPlaceholder: 'Type your answer here',
yourQuery: 'Your Query',
queryPlaceholder: 'Type your query here',
removeThisCache: 'Remove this Annotation',
createdAt: 'Created At',
},
addModal: {
title: 'Add Annotation Reply',
queryName: 'Question',
answerName: 'Answer',
answerPlaceholder: 'Type answer here',
queryPlaceholder: 'Type query here',
createNext: 'Add another annotated response',
},
batchModal: {
title: 'Bulk Import',
csvUploadTitle: 'Drag and drop your CSV file here, or ',
browse: 'browse',
tip: 'The CSV file must conform to the following structure:',
question: 'question',
answer: 'answer',
contentTitle: 'chunk content',
content: 'content',
template: 'Download the template here',
cancel: 'Cancel',
run: 'Run Batch',
runError: 'Run batch failed',
processing: 'In batch processing',
completed: 'Import completed',
error: 'Import Error',
ok: 'OK',
},
errorMessage: {
answerRequired: 'Answer is required',
queryRequired: 'Question is required',
},
viewModal: {
annotatedResponse: 'Annotation Reply',
hitHistory: 'Hit History',
hit: 'Hit',
hits: 'Hits',
noHitHistory: 'No hit history',
},
hitHistoryTable: {
query: 'Query',
match: 'Match',
response: 'Response',
source: 'Source',
score: 'Score',
time: 'Time',
},
initSetup: {
title: 'Annotation Reply Initial Setup',
configTitle: 'Annotation Reply Setup',
confirmBtn: 'Save & Enable',
configConfirmBtn: 'Save',
},
embeddingModelSwitchTip: 'Annotation text vectorization model, switching models will be re-embedded, resulting in additional costs.',
}
export default translation
'use client'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
/*
* @Author: yangming@didihu.com.cn yangming@didihu.com.cn
* @Date: 2025-04-22 09:29:21
* @LastEditors: yangming@didihu.com.cn yangming@didihu.com.cn
* @LastEditTime: 2025-05-09 12:16:15
* @FilePath: \glsk-ai-assistant\i18n\i18next-config.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
"use client";
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import { LanguagesSupported } from '@/i18n/language'
import { LanguagesSupported } from "@/i18n/language";
// const requireSilent = (lang: string) => {
// let res
......@@ -24,10 +32,10 @@ const loadLangResources = (lang: string) => ({
// register: require(`./${lang}/register`).default,
// app: require(`./${lang}/app`).default,
// appOverview: require(`./${lang}/app-overview`).default,
// appDebug: require(`./${lang}/app-debug`).default,
appDebug: require(`./${lang}/app-debug`).default,
// appApi: require(`./${lang}/app-api`).default,
// appLog: require(`./${lang}/app-log`).default,
// appAnnotation: require(`./${lang}/app-annotation`).default,
appAnnotation: require(`./${lang}/app-annotation`).default,
share: require(`./${lang}/share-app`).default,
// dataset: require(`./${lang}/dataset`).default,
// datasetDocuments: require(`./${lang}/dataset-documents`).default,
......@@ -45,21 +53,20 @@ const loadLangResources = (lang: string) => ({
time: require(`./${lang}/time`).default,
// education: requireSilent(lang),
},
})
});
type Resource = Record<string, ReturnType<typeof loadLangResources>>
type Resource = Record<string, ReturnType<typeof loadLangResources>>;
// Automatically generate the resources object
export const resources = LanguagesSupported.reduce<Resource>((acc, lang) => {
acc[lang] = loadLangResources(lang)
return acc
}, {})
acc[lang] = loadLangResources(lang);
return acc;
}, {});
i18n.use(initReactI18next)
.init({
lng: undefined,
fallbackLng: 'en-US',
resources,
})
i18n.use(initReactI18next).init({
lng: undefined,
fallbackLng: "en-US",
resources,
});
export const changeLanguage = i18n.changeLanguage
export default i18n
export const changeLanguage = i18n.changeLanguage;
export default i18n;
......@@ -5,7 +5,7 @@ import { LOCALE_COOKIE_NAME } from '@/config'
import { LanguagesSupported } from '@/i18n/language'
export const i18n = {
defaultLocale: 'en-US',
defaultLocale: 'zh-Hans',
locales: LanguagesSupported,
} as const
......@@ -18,5 +18,5 @@ export const setLocaleOnClient = (locale: Locale, reloadPage = true) => {
}
export const getLocaleOnClient = (): Locale => {
return Cookies.get(LOCALE_COOKIE_NAME) as Locale || i18n.defaultLocale
return i18n.defaultLocale
}
const translation = {
title: '标注',
name: '标注回复',
editBy: '{{author}}编辑的答案',
noData: {
title: '没有标注',
description: '你可以在应用会话调试中编辑标注,也可以在此批量导入标注用于高质量回复。',
},
table: {
header: {
question: '提问',
match: '匹配',
response: '回复',
answer: '答案',
createdAt: '创建时间',
hits: '命中次数',
actions: '操作',
addAnnotation: '添加标注',
bulkImport: '批量导入',
bulkExport: '批量导出',
clearAll: '删除所有标注',
},
},
editModal: {
title: '编辑标注回复',
queryName: '用户提问',
answerName: '机器回复',
yourAnswer: '您的回复',
answerPlaceholder: '在这里输入您的回复',
yourQuery: '您的提问',
queryPlaceholder: '在这里输入您的提问',
removeThisCache: '删除此标注',
createdAt: '创建于',
},
addModal: {
title: '添加标注回复',
queryName: '提问',
answerName: '回复',
answerPlaceholder: '输入回复',
queryPlaceholder: '输入提问',
createNext: '添加下一个标注回复',
},
batchModal: {
title: '批量导入',
csvUploadTitle: '将您的 CSV 文件拖放到此处,或',
browse: '选择文件',
tip: 'CSV 文件必须符合以下结构:',
question: '问题',
answer: '回答',
contentTitle: '分段内容',
content: '内容',
template: '下载模板',
cancel: '取消',
run: '导入',
runError: '批量导入失败',
processing: '批量处理中',
completed: '导入完成',
error: '导入出错',
ok: '确定',
},
errorMessage: {
answerRequired: '回复不能为空',
queryRequired: '提问不能为空',
},
viewModal: {
annotatedResponse: '标注回复',
hitHistory: '命中历史',
hit: '次命中',
hits: '次命中',
noHitHistory: '没有命中历史',
},
hitHistoryTable: {
question: '问题',
query: '提问',
match: '匹配',
response: '回复',
source: '来源',
score: '分数',
time: '时间',
},
initSetup: {
title: '标注回复初始设置',
configTitle: '标注回复设置',
confirmBtn: '保存并启用',
configConfirmBtn: '保存',
},
embeddingModelSwitchTip: '标注文本向量化模型,切换模型会重新嵌入,产生额外费用消耗',
}
export default translation
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!