-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add support for multiple languages
- Loading branch information
Showing
17 changed files
with
595 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import { defineConfig } from 'vitepress' | ||
|
||
export const en = defineConfig({ | ||
lang: 'en-US', | ||
description: 'A Self-hosted Comment System.', | ||
|
||
themeConfig: { | ||
sidebar: { | ||
'/en/guide/': [ | ||
{ | ||
text: 'Quick Start', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Project Introduction', link: '/en/guide/intro.md' }, | ||
{ text: 'Program Deployment', link: '/en/guide/deploy.md' }, | ||
{ text: 'Data Migration', link: '/en/guide/transfer.md' }, | ||
], | ||
}, | ||
{ | ||
text: 'Core Guide', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Sidebar', link: '/en/guide/frontend/sidebar.md' }, | ||
{ text: 'Email Notification', link: '/en/guide/backend/email.md' }, | ||
{ text: 'Multi-channel Notification', link: '/en/guide/backend/admin_notify.md' }, | ||
{ text: 'Social Login', link: '/en/guide/frontend/auth.md' }, | ||
{ text: 'Comment Moderation', link: '/en/guide/backend/moderator.md' }, | ||
{ text: 'Captcha', link: '/en/guide/backend/captcha.md' }, | ||
{ text: 'Image Upload', link: '/en/guide/backend/img-upload.md' }, | ||
{ text: 'Accounts and Multi-site', link: '/en/guide/backend/multi-site.md' }, | ||
{ text: 'Resolve Relative Path', link: '/en/guide/backend/relative-path.md' }, | ||
], | ||
}, | ||
{ | ||
text: 'Advanced Guide', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Emoticons', link: '/en/guide/frontend/emoticons.md' }, | ||
{ text: 'Page View Statistics', link: '/en/guide/frontend/pv.md' }, | ||
{ text: 'LaTeX', link: '/en/guide/frontend/latex.md' }, | ||
{ text: 'Image Lightbox', link: '/en/guide/frontend/lightbox.md' }, | ||
{ text: 'Image Lazy Load', link: '/en/guide/frontend/img-lazy-load.md' }, | ||
{ text: 'IP Region', link: '/en/guide/frontend/ip-region.md' }, | ||
{ text: 'Multi-language', link: '/en/guide/frontend/i18n.md' }, | ||
{ text: 'Development Documentation', link: '/en/develop/index.md' }, | ||
], | ||
}, | ||
{ | ||
text: 'Configuration Documentation', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Environment Variables', link: '/en/guide/env.md' }, | ||
{ text: 'Configuration File', link: '/en/guide/backend/config.md' }, | ||
{ text: 'Interface Configuration', link: '/en/guide/frontend/config.md' }, | ||
], | ||
}, | ||
{ | ||
text: 'Deployment Instructions', | ||
collapsed: true, | ||
items: [ | ||
{ text: 'Daemon', link: '/en/guide/backend/daemon.md' }, | ||
{ text: 'Reverse Proxy', link: '/en/guide/backend/reverse-proxy.md' }, | ||
{ text: 'Build', link: '/en/develop/contributing.md' }, | ||
{ text: 'Program Upgrade', link: '/en/guide/backend/update.md' }, | ||
{ text: 'Docker', link: '/en/guide/backend/docker.md' }, | ||
], | ||
}, | ||
{ | ||
text: 'More Content', | ||
collapsed: true, | ||
items: [ | ||
{ text: 'Security', link: '/en/guide/security.md' }, | ||
{ text: 'Additional Reading', link: '/en/guide/extras.md' }, | ||
{ text: 'Case Studies', link: '/en/guide/cases.md' }, | ||
{ text: 'About Us', link: '/en/guide/about.md' }, | ||
], | ||
}, | ||
], | ||
'/en/develop/': [ | ||
{ | ||
text: 'Development Documentation', | ||
items: [ | ||
{ text: 'Development Instructions', link: '/en/develop/index.md' }, | ||
{ text: 'Contribution Guide', link: '/en/develop/contributing.md' }, | ||
{ text: 'Import to Blog', link: '/en/develop/import-blog.md' }, | ||
{ text: 'Import to Framework', link: '/en/develop/import-framework.md' }, | ||
{ text: 'Frontend API', link: '/en/develop/fe-api.md' }, | ||
{ text: 'Frontend Event', link: '/en/develop/event.md' }, | ||
{ text: 'Plugin Development', link: '/en/develop/plugin.md' }, | ||
{ text: 'Compatibility', link: '/en/develop/compatibility.md' }, | ||
{ | ||
text: 'HTTP API', | ||
link: 'https://artalk.js.org/http-api.html', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
|
||
nav: [ | ||
{ | ||
text: 'Introduction', | ||
link: '/en/guide/intro', | ||
}, | ||
{ | ||
text: 'Deployment', | ||
link: '/en/guide/deploy', | ||
}, | ||
{ | ||
text: 'Configuration', | ||
link: '/en/guide/backend/config', | ||
}, | ||
{ | ||
text: 'Migration', | ||
link: '/en/guide/transfer', | ||
}, | ||
{ | ||
text: 'Cases', | ||
link: '/en/guide/cases', | ||
}, | ||
{ | ||
text: 'Development', | ||
link: '/en/develop/', | ||
}, | ||
{ | ||
text: 'Links', | ||
items: [ | ||
{ | ||
text: 'Code Repository', | ||
link: 'https://github.com/ArtalkJS/Artalk', | ||
}, | ||
], | ||
}, | ||
], | ||
|
||
editLink: { | ||
pattern: 'https://github.com/ArtalkJS/Artalk/edit/master/docs/docs/:path', | ||
text: 'Improve this document', | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { shared } from './shared' | ||
import { zh } from './zh' | ||
import { en } from './en' | ||
|
||
export default defineConfig({ | ||
...shared, | ||
locales: { | ||
root: { label: '简体中文', ...zh }, | ||
en: { label: 'English', ...en }, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { defineConfig } from 'vitepress' | ||
import iterator from 'markdown-it-for-inline' | ||
import * as Version from '../../code/ArtalkVersion.json' | ||
|
||
export const shared = defineConfig({ | ||
title: 'Artalk', | ||
|
||
// TODO: Uncomment after move default language to subfolder | ||
// rewrites: { | ||
// 'zh/:rest*': ':rest*', | ||
// }, | ||
|
||
/* prettier-ignore */ | ||
head: [ | ||
['link', { rel: 'icon', type: 'image/png', href: '/favicon.png' }], | ||
['meta', { name: 'theme-color', content: '#007bff' }], | ||
['meta', { property: 'og:type', content: 'website' }], | ||
['meta', { property: 'og:locale', content: 'en' }], | ||
['meta', { property: 'og:title', content: 'Artalk - A Self-hosted Comment System'}], | ||
['meta', { property: 'og:site_name', content: 'Artalk' }], | ||
['meta', { property: 'og:image', content: 'https://artalk.js.org/assets/images/artalk-banner.png' }], | ||
['meta', { property: 'og:url', content: 'https://artalk.js.org/' }], | ||
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi' }], | ||
], | ||
|
||
markdown: { | ||
// @link https://github.com/shikijs/shiki | ||
theme: { | ||
light: 'github-light', | ||
dark: 'github-dark', | ||
}, | ||
config: (md) => { | ||
md.use(iterator, 'artalk_version', 'text', function (tokens, idx) { | ||
tokens[idx].content = tokens[idx].content.replace(/:ArtalkVersion:/g, Version.latest) | ||
}) | ||
md.use(iterator, 'artalk_version_link', 'link_open', (tokens, idx) => { | ||
const href = tokens[idx].attrGet('href') | ||
tokens[idx].attrSet('href', href.replace(/:ArtalkVersion:/g, Version.latest)) | ||
}) | ||
}, | ||
}, | ||
|
||
sitemap: { | ||
hostname: 'https://artalk.js.org', | ||
transformItems(items) { | ||
return items.filter((item) => !item.url.includes('migration')) | ||
}, | ||
}, | ||
|
||
lastUpdated: true, | ||
cleanUrls: true, | ||
metaChunk: true, | ||
|
||
themeConfig: { | ||
socialLinks: [{ icon: 'github', link: 'https://github.com/ArtalkJS/Artalk' }], | ||
|
||
search: { | ||
provider: 'algolia', | ||
options: { | ||
appId: '2WNJ32WVTY', | ||
apiKey: '6c6ebc345a87b738264f19095b78c91c', | ||
indexName: 'artalk-js', | ||
}, | ||
}, | ||
}, | ||
|
||
vite: { | ||
server: { | ||
open: '/guide/intro.html', | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.