From a7a8420cf1960585792dae95f9697b9d979e31cd Mon Sep 17 00:00:00 2001 From: leejooy96 Date: Thu, 24 Oct 2024 15:15:08 +0900 Subject: [PATCH] docs: upgrade `vitepress-i18n` package --- docs/package-lock.json | 9 ++-- docs/package.json | 2 +- docs/src/.vitepress/config.mts | 77 ++++++++++++++++------------------ 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/docs/package-lock.json b/docs/package-lock.json index e9f37b6..df480de 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "vitepress": "^1.4.1", - "vitepress-i18n": "^1.0.6", + "vitepress-i18n": "^1.3.0", "vitepress-sidebar": "^1.27.1", "vue": "^3.5.12" }, @@ -2781,9 +2781,10 @@ } }, "node_modules/vitepress-i18n": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/vitepress-i18n/-/vitepress-i18n-1.0.6.tgz", - "integrity": "sha512-SNiOrA+mLFMyL9+Fkrqp7iGM+M+Gzg3fsT1nY7li3JlrFkRu4sal/rKXtKDZrqQGFd7blIdTurYGBe27bMxs7g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/vitepress-i18n/-/vitepress-i18n-1.3.0.tgz", + "integrity": "sha512-9GNglkvXCvFIVSYjQ4gjZSnhVCilzfHLlntr0TA6PTaqBvYhE5fdxVCqycQdVTXeLRHBDoZfxztzqSRgkQqoxQ==", + "license": "MIT", "engines": { "node": ">=18.0.0" } diff --git a/docs/package.json b/docs/package.json index 184baad..a6bcf45 100644 --- a/docs/package.json +++ b/docs/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "vitepress": "^1.4.1", - "vitepress-i18n": "^1.0.6", + "vitepress-i18n": "^1.3.0", "vitepress-sidebar": "^1.27.1", "vue": "^3.5.12" } diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 77fe009..1c789da 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -1,18 +1,40 @@ import { generateSidebar } from 'vitepress-sidebar' import { name, repository, homepage } from '../../../package.json' 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 defaultLocale: string = 'en' -const editLinkPattern = 'https://github.com/jooy2/vutron/edit/master/docs/src/:path' -const defineSupportLocales = [ - { label: defaultLocale, translateLocale: defaultLocale }, - { label: 'ko', translateLocale: 'ko' } -] +const vitePressI18nConfigs = { + locales: [defaultLocale, '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), lastUpdated: true, outDir: '../dist', @@ -30,11 +52,9 @@ export default defineConfig({ }, themeConfig: { logo: { src: '/icon.png', width: 24, height: 24 }, - search: generateI18nSearch({ - defineLocales: defineSupportLocales, - rootLocale: defaultLocale, - provider: 'local' - }), + editLink: { + pattern: 'https://github.com/jooy2/vutron/edit/master/docs/src/:path' + }, sidebar: generateSidebar([ ...[defaultLocale, 'ko'].map((lang) => { return { @@ -57,32 +77,7 @@ export default defineConfig({ }) ]), socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }] - }, - locales: generateI18nLocale({ - defineLocales: defineSupportLocales, - rootLocale: defaultLocale, - 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' - } - ] - } - } - }) -}) + } +} + +export default defineConfig(withI18n(vitePressConfigs, vitePressI18nConfigs))