Skip to content

Commit

Permalink
💾 Feat(Plume-Theme): Adapted to theme's localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Feb 7, 2025
1 parent d0f0a20 commit 611f861
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 14 deletions.
88 changes: 74 additions & 14 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path'
import { viteBundler } from '@vuepress/bundler-vite'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
Expand All @@ -6,11 +7,16 @@ import {
navbarEn,
sidebarZh,
sidebarEn,
searchBoxZh,
searchBoxEn,
} from './configs/index.js'

import { mdEnhancePlugin } from "vuepress-plugin-md-enhance"

export default defineUserConfig({
base: '/',
lang: 'zh-CN',

head: [
[
'link',
Expand All @@ -21,11 +27,11 @@ export default defineUserConfig({
locales: {
'/': {
lang: 'zh-CN',
title: 'KitX Docs',
title: 'KitX 文档站',
description: 'KitX 文档站点',
},
'/en/': {
lang: 'zh-CN',
lang: 'en-US',
title: 'KitX Docs',
description: 'KitX Docs Site',
}
Expand All @@ -36,32 +42,50 @@ export default defineUserConfig({
docsRepo: 'https://github.com/Crequency/KitX-Docs/',
docsBranch: 'main',
docsDir: 'docs',
hostname: 'kitx.docs.catrol.cn',
editLinkPattern: ':repo/edit/:branch/:path',
lastUpdated: { formatOptions: { dateStyle: 'short', timeStyle: 'short' } },
contributors: {
mode: 'block',
},
changelog: true,

blog: false,
social: [
{
icon: 'github',
link: 'https://github.com/Crequency/KitX/'
}
],

blog: false,
notes: false,

locales: {
'/': {
home: '/',
selectLanguageName: '简体中文',
sidebarMenuLabel: '目录',
// bulletin: {
// layout: 'bottom-right',
// border: true,
// // enablePage: (page) => page.frontmatter.bulletin !== false,
// // lifetime: 'session',
// title: '公告',
// contentFile: path.join(__dirname, 'site-components/_bulletin.md'),
// contentType: 'markdown'
// },
navbar: navbarZh,
sidebar: sidebarZh,
},
'/en/': {
home: '/en/',
selectLanguageName: 'English',
sidebarMenuLabel: 'Menu',
editLinkText: 'Edit this page on GitHub',
contributorsText: 'Contributors',
changelogText: 'Changelog',
changelogOnText: 'On',
changelogButtonText: 'View Full Changelog',
// bulletin: {
// layout: 'bottom-right',
// border: true,
// title: 'Bulletin',
// contentFile: path.join(__dirname, 'en/site-components/_bulletin.md'),
// contentType: 'markdown'
// },
navbar: navbarEn,
sidebar: sidebarEn,
}
Expand All @@ -75,11 +99,47 @@ export default defineUserConfig({

plugins: {
git: true,
search: {

},
search: {},
shiki: {
languages: ['shell', 'mermaid', 'csharp', 'java', 'json', 'javascript', 'typescript', 'c', 'c++', 'python', 'go', 'rust', 'yaml', 'xml']
languages: [
'csharp',
'c',
'c++',
'rust',
'dart',
'kotlin',
'java',
'python',
'html',
'css',
'javascript',
'typescript',
'php',
'zig',
'vb',
'lua',
'fortran-fixed-form',
'fortran-free-form',
'julia',
'powershell',
'shell',
'haskell',
'swift',
'go',
'ruby',
'perl',
'json',
'yaml',
'toml',
'xml',
'ini',
'make',
'makefile',
'cmake',
'mermaid',
'markdown',
'matlab',
]
}
}
}),
Expand Down
1 change: 1 addition & 0 deletions docs/.vuepress/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './navbar/index.js'
export * from './sidebar/index.js'
export * from './plugins/index.js'
1 change: 1 addition & 0 deletions docs/.vuepress/configs/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './search/index.js'
33 changes: 33 additions & 0 deletions docs/.vuepress/configs/plugins/search/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
interface SearchLocaleOptions {
placeholder: string;
buttonText: string;
resetButtonTitle: string;
backButtonTitle: string;
noResultsText: string;
footer: {
selectText: string;
selectKeyAriaLabel: string;
navigateText: string;
navigateUpKeyAriaLabel: string;
navigateDownKeyAriaLabel: string;
closeText: string;
closeKeyAriaLabel: string;
};
}
export const searchBoxEn: SearchLocaleOptions = {
placeholder: 'Search Docs',
buttonText: 'Search',
resetButtonTitle: 'Reset',
backButtonTitle: 'Back',
noResultsText: 'No Results',
footer: {
selectText: 'Select',
selectKeyAriaLabel: 'select',
navigateText: 'Navigate',
navigateUpKeyAriaLabel: 'Up',
navigateDownKeyAriaLabel: 'Down',
closeText: 'Close',
closeKeyAriaLabel: 'close',
}
};

2 changes: 2 additions & 0 deletions docs/.vuepress/configs/plugins/search/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './zh.ts'
export * from './en.ts'
33 changes: 33 additions & 0 deletions docs/.vuepress/configs/plugins/search/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
interface SearchLocaleOptions {
placeholder: string;
buttonText: string;
resetButtonTitle: string;
backButtonTitle: string;
noResultsText: string;
footer: {
selectText: string;
selectKeyAriaLabel: string;
navigateText: string;
navigateUpKeyAriaLabel: string;
navigateDownKeyAriaLabel: string;
closeText: string;
closeKeyAriaLabel: string;
};
}
export const searchBoxZh: SearchLocaleOptions = {
placeholder: '搜索文档',
buttonText: '搜索',
resetButtonTitle: '重置',
backButtonTitle: '返回',
noResultsText: '无结果',
footer: {
selectText: '选择',
selectKeyAriaLabel: 'select',
navigateText: '切换',
navigateUpKeyAriaLabel: 'navigate-to-up',
navigateDownKeyAriaLabel: 'navigate-to-down',
closeText: '关闭',
closeKeyAriaLabel: 'close',
}
};

11 changes: 11 additions & 0 deletions docs/en/site-components/_bulletin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: bulletin
createTime: 2025/02/07 13:53:24
---

<h3>剑指 v25.10</h3>

我们诚邀广大开源爱好者加入 KitX 项目

QQ 交流群: 978183263

10 changes: 10 additions & 0 deletions docs/site-components/_bulletin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: _bulletin
createTime: 2025/02/07 13:53:24
---
剑指 v25.10

我们诚邀广大开源爱好者加入 KitX 项目

QQ 交流群: 978183263

0 comments on commit 611f861

Please sign in to comment.