更新文档

This commit is contained in:
Super Manito
2025-09-25 05:41:24 +08:00
parent 802b9383a6
commit e3d9cfab04
12 changed files with 169 additions and 80 deletions

View File

@@ -1,33 +1,78 @@
const OramaI18nData = {
'zh-Hans': {
searchPlaceholder: '请输入要搜索的内容...',
chatPlaceholder: '有什么可以帮你的吗?',
suggestions: ['如何使用', '支持哪些系统'],
askAiText: '询问 AI',
searchText: '搜索',
toSelectText: '选择',
toNavigateText: '导航',
toCloseText: '关闭',
dictionary: {
searchPlaceholder: '请输入要搜索的内容...',
chatPlaceholder: '有什么可以帮你的吗?',
noResultsFound: '未找到结果',
noResultsFoundFor: '未找到与该内容相关的结果',
suggestionsTitle: '建议',
seeAll: '查看全部',
addMore: '添加更多',
clearChat: '清空聊天',
errorMessage: '尝试搜索时发生错误。请重试。',
disclaimer: 'AI 可能会出错,请核实信息。',
startYourSearch: '开始搜索',
initErrorSearch: '无法初始化搜索服务',
initErrorChat: '无法初始化聊天服务',
chatButtonLabel: '询问 AI',
searchButtonLabel: '搜索',
},
},
'zh-Hant': {
searchPlaceholder: '請輸入要搜尋的內容...',
chatPlaceholder: '有什麼可以幫你的嗎?',
suggestions: ['如何使用', '支援哪些系統'],
askAiText: '詢問 AI',
searchText: '搜尋',
toSelectText: '選擇',
toNavigateText: '導航',
toCloseText: '關閉',
dictionary: {
searchPlaceholder: '請輸入要搜尋的內容...',
chatPlaceholder: '有什麼可以幫你的嗎?',
noResultsFound: '未找到結果',
noResultsFoundFor: '未找到與該內容相關的結果',
suggestionsTitle: '建議',
seeAll: '看全部',
addMore: '添加更多',
clearChat: '清空聊天',
errorMessage: '嘗試搜尋時發生錯誤。請重試。',
disclaimer: 'AI 可能會出錯,請核實資訊。',
startYourSearch: '開始搜尋',
initErrorSearch: '無法初始化搜尋服務',
initErrorChat: '無法初始化聊天服務',
chatButtonLabel: '詢問 AI',
searchButtonLabel: '搜尋',
},
},
en: {
searchPlaceholder: 'Please enter the content to search...',
chatPlaceholder: 'How can I help you?',
suggestions: ['How to use', 'What systems are supported'],
askAiText: 'Ask AI',
searchText: 'Search',
toSelectText: 'Select',
toNavigateText: 'Navigate',
toCloseText: 'Close',
dictionary: {
searchPlaceholder: 'Please enter the content to search...',
chatPlaceholder: 'How can I help you?',
noResultsFound: 'No results found',
noResultsFoundFor: 'No results found for',
suggestionsTitle: 'Suggestions',
seeAll: 'See all',
addMore: 'Add more',
clearChat: 'Clear chat',
errorMessage: 'An error occurred while trying to search. Please try again.',
disclaimer: 'AI can make mistakes. Please verify the information.',
startYourSearch: 'Start your search',
initErrorSearch: 'Unable to initialize search service',
initErrorChat: 'Unable to initialize chat service',
chatButtonLabel: 'Ask AI',
searchButtonLabel: 'Search',
},
},
}
@@ -86,9 +131,8 @@ function getOramaSearchBoxConfig() {
description: 'content',
section: 'category',
},
searchPlaceholder: OramaI18nData[currentLang].searchPlaceholder,
chatPlaceholder: OramaI18nData[currentLang].chatPlaceholder,
suggestions: OramaI18nData[currentLang].suggestions,
dictionary: OramaI18nData[currentLang].dictionary,
}
}
@@ -102,13 +146,13 @@ function localizationOramaSearchBox(searchBox) {
const shadowRoot = searchBox.shadowRoot
if (shadowRoot) {
// Get a summary (Only PC)
const chatButton = shadowRoot.querySelector('.chat-button')
if (chatButton) {
const element = chatButton.querySelector('.button-label')
if (element && element.textContent !== askAiText) {
element.textContent = askAiText
}
}
// const chatButton = shadowRoot.querySelector('.chat-button')
// if (chatButton) {
// const element = chatButton.querySelector('.button-label')
// if (element && element.textContent !== askAiText) {
// element.textContent = askAiText
// }
// }
const footer = shadowRoot.querySelector('orama-footer')
if (footer) {
@@ -141,13 +185,13 @@ function localizationOramaSearchBox(searchBox) {
}
// Hide "Orama can make mistakes. Please verify the information."
const chatFormWrapper = shadowRoot.querySelector('.chat-form-wrapper')
if (chatFormWrapper) {
const element = chatFormWrapper.querySelector('p.small.text-center')
if (element) {
element.style = 'display: none;'
}
}
// const chatFormWrapper = shadowRoot.querySelector('.chat-form-wrapper')
// if (chatFormWrapper) {
// const element = chatFormWrapper.querySelector('p.small.text-center')
// if (element) {
// element.style = 'display: none;'
// }
// }
// Navigation bar (Only Mobile)
const navigationBar = shadowRoot.querySelector('orama-navigation-bar')