docs: upgrade vitepress-i18n package

This commit is contained in:
leejooy96 committed 2024-10-24 15:15:08 +09:00
1 parent 5f5789cb0c
commit a7a8420cf1
3 files changed
+42 -46

No files matched your search

+5 -4
View File
@@ -10,7 +10,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"vitepress": "^1.4.1", "vitepress": "^1.4.1",
"vitepress-i18n": "^1.0.6", "vitepress-i18n": "^1.3.0",
"vitepress-sidebar": "^1.27.1", "vitepress-sidebar": "^1.27.1",
"vue": "^3.5.12" "vue": "^3.5.12"
}, },
@@ -2781,9 +2781,10 @@
} }
}, },
"node_modules/vitepress-i18n": { "node_modules/vitepress-i18n": {
"version": "1.0.6", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/vitepress-i18n/-/vitepress-i18n-1.0.6.tgz", "resolved": "https://registry.npmjs.org/vitepress-i18n/-/vitepress-i18n-1.3.0.tgz",
"integrity": "sha512-SNiOrA+mLFMyL9+Fkrqp7iGM+M+Gzg3fsT1nY7li3JlrFkRu4sal/rKXtKDZrqQGFd7blIdTurYGBe27bMxs7g==", "integrity": "sha512-9GNglkvXCvFIVSYjQ4gjZSnhVCilzfHLlntr0TA6PTaqBvYhE5fdxVCqycQdVTXeLRHBDoZfxztzqSRgkQqoxQ==",
"license": "MIT",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"
} }
+1 -1
View File
@@ -14,7 +14,7 @@
}, },
"dependencies": { "dependencies": {
"vitepress": "^1.4.1", "vitepress": "^1.4.1",
"vitepress-i18n": "^1.0.6", "vitepress-i18n": "^1.3.0",
"vitepress-sidebar": "^1.27.1", "vitepress-sidebar": "^1.27.1",
"vue": "^3.5.12" "vue": "^3.5.12"
} }
+36 -41
View File
@@ -1,18 +1,40 @@
import { generateSidebar } from 'vitepress-sidebar' import { generateSidebar } from 'vitepress-sidebar'
import { name, repository, homepage } from '../../../package.json' import { name, repository, homepage } from '../../../package.json'
import { defineConfig } from 'vitepress' import { defineConfig } from 'vitepress'
import { generateI18nLocale, generateI18nSearch } from 'vitepress-i18n' import { withI18n } from 'vitepress-i18n'
const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1) const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
const defaultLocale: string = 'en' const defaultLocale: string = 'en'
const editLinkPattern = 'https://github.com/jooy2/vutron/edit/master/docs/src/:path'
const defineSupportLocales = [ const vitePressI18nConfigs = {
{ label: defaultLocale, translateLocale: defaultLocale }, locales: [defaultLocale, 'ko'],
{ label: 'ko', translateLocale: 'ko' } rootLocale: defaultLocale,
] searchProvider: 'local',
description: {
en: 'Vutron is a preconfigured template for developing Electron cross-platform desktop apps. It uses Vue 3 and allows you to build a fast development environment with little effort.',
ko: 'Vutron은 Electron 크로스 플랫폼 데스크톱 앱 개발을 위해 미리 구성된 템플릿입니다. Vue 3을 사용하며 적은 노력으로 빠른 개발 환경을 구축할 수 있습니다.'
},
themeConfig: {
en: {
nav: [
{
text: 'Getting Started',
link: '/installation-and-build/getting-started'
}
]
},
ko: {
nav: [
{
text: '시작하기',
link: '/ko/installation-and-build/getting-started'
}
]
}
}
}
export default defineConfig({ const vitePressConfigs = {
title: capitalizeFirst(name), title: capitalizeFirst(name),
lastUpdated: true, lastUpdated: true,
outDir: '../dist', outDir: '../dist',
@@ -30,11 +52,9 @@ export default defineConfig({
}, },
themeConfig: { themeConfig: {
logo: { src: '/icon.png', width: 24, height: 24 }, logo: { src: '/icon.png', width: 24, height: 24 },
search: generateI18nSearch({ editLink: {
defineLocales: defineSupportLocales, pattern: 'https://github.com/jooy2/vutron/edit/master/docs/src/:path'
rootLocale: defaultLocale, },
provider: 'local'
}),
sidebar: generateSidebar([ sidebar: generateSidebar([
...[defaultLocale, 'ko'].map((lang) => { ...[defaultLocale, 'ko'].map((lang) => {
return { return {
@@ -57,32 +77,7 @@ export default defineConfig({
}) })
]), ]),
socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }] socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }]
}, }
locales: generateI18nLocale({ }
defineLocales: defineSupportLocales,
rootLocale: defaultLocale, export default defineConfig(withI18n(vitePressConfigs, vitePressI18nConfigs))
editLinkPattern: editLinkPattern,
description: {
en: 'Vutron is a preconfigured template for developing Electron cross-platform desktop apps. It uses Vue 3 and allows you to build a fast development environment with little effort.',
ko: 'Vutron은 Electron 크로스 플랫폼 데스크톱 앱 개발을 위해 미리 구성된 템플릿입니다. Vue 3을 사용하며 적은 노력으로 빠른 개발 환경을 구축할 수 있습니다.'
},
themeConfig: {
en: {
nav: [
{
text: 'Getting Started',
link: '/installation-and-build/getting-started'
}
]
},
ko: {
nav: [
{
text: '시작하기',
link: '/ko/installation-and-build/getting-started'
}
]
}
}
})
})