Skip to content

Commit

Permalink
package: upgrade vitepress-i18n package
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Oct 24, 2024
1 parent d43d5d4 commit 0dc8cb5
Show file tree
Hide file tree
Showing 3 changed files with 504 additions and 342 deletions.
39 changes: 19 additions & 20 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { generateSidebar } from 'vitepress-sidebar';
import { defineConfig } from 'vitepress';
import { generateI18nLocale, generateI18nSearch } from 'vitepress-i18n';
import { defineConfig, UserConfig } from 'vitepress';
import { withI18n } from 'vitepress-i18n';
import { VitePressI18nOptions } from 'vitepress-i18n/dist/types';
import { name, repository, description, homepage } from '../../package.json';

const defaultLocale: string = 'ko';
const defineSupportLocales = [{ label: defaultLocale, translateLocale: defaultLocale }];

const editLinkPattern = 'https://github.com/jooy2/til/edit/master/docs/:path';
const vitePressI18nConfig: VitePressI18nOptions = {
locales: [defaultLocale],
rootLocale: defaultLocale,
searchProvider: 'local',
description: {
ko: description
}
};

// Ref: https://vitepress.vuejs.org/config/introduction
export default defineConfig({
const vitePressConfig: UserConfig = {
title: name.toUpperCase(),
lastUpdated: true,
lang: 'ko-KR',
Expand All @@ -29,6 +36,9 @@ export default defineConfig({
},
themeConfig: {
logo: { src: '/logo-32.png', width: 24, height: 24 },
editLink: {
pattern: 'https://github.com/jooy2/til/edit/master/docs/:path'
},
sidebar: generateSidebar({
documentRootPath: 'docs',
collapseDepth: 2,
Expand All @@ -37,11 +47,6 @@ export default defineConfig({
useTitleFromFileHeading: true,
useTitleFromFrontmatter: true
}),
search: generateI18nSearch({
defineLocales: defineSupportLocales,
rootLocale: defaultLocale,
provider: 'local'
}),
nav: [
{
text: 'Blog',
Expand All @@ -52,13 +57,7 @@ export default defineConfig({
footer: {
copyright: 'ยฉ <a href="https://jooy2.com">Jooy2</a>'
}
},
locales: generateI18nLocale({
description: {
ko: description
},
defineLocales: defineSupportLocales,
rootLocale: defaultLocale,
editLinkPattern
})
});
}
};

export default defineConfig(withI18n(vitePressConfig, vitePressI18nConfig));
Loading

0 comments on commit 0dc8cb5

Please sign in to comment.