为文档添加i18n插件并新增繁体中文语言

This commit is contained in:
Super Manito
2025-06-22 12:32:19 +08:00
parent 5996b250a5
commit b169186c73
73 changed files with 2091 additions and 122 deletions

View File

@@ -3,7 +3,7 @@ const mirrorsTableData = [
{
name: '阿里云',
officialName: '阿里巴巴开源镜像站',
icon: 'aliyun.ico',
icon: 'alibabacloud.svg',
iconStyle: { verticalAlign: '-0.2em' },
url: 'https://mirrors.aliyun.com',
domain: 'mirrors.aliyun.com',
@@ -30,7 +30,7 @@ const mirrorsTableData = [
{
name: '腾讯云',
officialName: '腾讯软件源',
icon: 'tencent-cloud.ico',
icon: 'tencentcloud.ico',
iconStyle: { verticalAlign: '-0.25em' },
url: 'https://mirrors.tencent.com',
domain: 'mirrors.tencent.com',
@@ -111,7 +111,7 @@ const mirrorsTableData = [
{
name: '火山引擎',
officialName: '火山引擎开源软件镜像站',
icon: 'volcengine.png',
icon: 'volcengine.svg',
iconStyle: { verticalAlign: '-0.25em' },
url: 'https://developer.volcengine.com/mirror',
domain: 'mirrors.volces.com',
@@ -384,7 +384,7 @@ const mirrorsTableData = [
const mirrorsTableColumns = [
{
colKey: 'name',
title: '镜像站',
title: !window.location.pathname.includes('/zh-hant') ? '镜像站' : '鏡像站',
align: 'left',
width: '180',
fixed: 'left',
@@ -400,7 +400,7 @@ const mirrorsTableColumns = [
title: 'EPEL',
align: 'center',
width: '90',
tooltip: 'EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版',
tooltip: !window.location.pathname.includes('/zh-hant') ? 'EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版' : 'EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 組織維護的一個附加軟體包倉庫,它主要適用於除 Fedora 作業系統以外的紅帽系 Linux 發行版',
},
{
colKey: 'archlinux',

View File

@@ -1,5 +1,6 @@
// get search box config
function getOramaSearchBoxConfig() {
const isDefaultLang = window.location.pathname.includes('/zh-hant') ? false : true
return {
themeConfig: {
// colors: {
@@ -52,15 +53,18 @@ function getOramaSearchBoxConfig() {
description: 'content',
section: 'category',
},
searchPlaceholder: '请输入要搜索的内容...',
chatPlaceholder: '有什么可以帮你的吗',
suggestions: ['如何使用', '支持哪些系统'],
searchPlaceholder: isDefaultLang ? '请输入要搜索的内容...' : '請輸入要搜尋的內容...',
chatPlaceholder: isDefaultLang ? '有什么可以帮你的吗?' : '有什麼可以幫你的嗎',
suggestions: isDefaultLang ? ['如何使用', '支持哪些系统'] : ['如何使用', '支援哪些系統'],
}
}
// localization search box component
function localizationOramaSearchBox(searchBox) {
if (!searchBox) return
const isDefaultLang = window.location.pathname.includes('/zh-hant') ? false : true
const askAiText = isDefaultLang ? '询问 AI' : '詢問 AI'
const searchText = isDefaultLang ? '搜索' : '搜尋'
const observer = new MutationObserver((mutations, obs) => {
const shadowRoot = searchBox.shadowRoot
if (shadowRoot) {
@@ -68,8 +72,8 @@ function localizationOramaSearchBox(searchBox) {
const chatButton = shadowRoot.querySelector('.chat-button')
if (chatButton) {
const element = chatButton.querySelector('.button-label')
if (element && element.textContent !== '询问 AI') {
element.textContent = '询问 AI'
if (element && element.textContent !== askAiText) {
element.textContent = askAiText
}
}
// Hide "Orama can make mistakes. Please verify the information."
@@ -86,13 +90,13 @@ function localizationOramaSearchBox(searchBox) {
const toggler = navigationBar.querySelector('orama-toggler')
if (toggler) {
const searchSpan = toggler.querySelector('span:nth-child(1)')
if (searchSpan && searchSpan.textContent !== '搜索') {
searchSpan.textContent = '搜索'
if (searchSpan && searchSpan.textContent !== searchText) {
searchSpan.textContent = searchText
searchSpan.style = 'max-height: fit-content;'
}
const askAISpan = toggler.querySelector('span:nth-child(2)')
if (askAISpan && askAISpan.textContent !== '询问 AI') {
askAISpan.textContent = '询问 AI'
if (askAISpan && askAISpan.textContent !== askAiText) {
askAISpan.textContent = askAiText
askAISpan.style = 'max-height: fit-content;'
}
}