Skip to content

Commit 9afa7ca

Browse files
authored
docs(i18n): add English translations for docs (#978)
* docs: add support for multiple languages * docs(i18n): add English translations
1 parent 6d54b72 commit 9afa7ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+5319
-213
lines changed

.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ pnpm-lock.yaml
1212
ui/artalk/src/api/v2.ts
1313
docs/swagger/swagger.json
1414
docs/swagger/swagger.yaml
15-
docs/docs/**
15+
docs/docs/**/*.md
16+
docs/docs/.vitepress/dist/**
17+
docs/docs/.vitepress/cache/**
1618
ui/artalk-sidebar/src/lib/md5.js
1719
ui/artalk/src/lib/detect.ts
1820
**/dist/**

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ update-conf:
5959
go generate ./internal/config
6060

6161
update-conf-docs:
62-
go run ./internal/config/meta/gen --format markdown --locale zh-CN -o ./docs/docs/guide/env.md
62+
go run ./internal/config/meta/gen --format markdown --locale en -o ./docs/docs/en/guide/env.md
63+
go run ./internal/config/meta/gen --format markdown --locale zh-CN -o ./docs/docs/zh/guide/env.md
64+
65+
update-docs-features:
66+
pnpm -F docs-landing update:readme
6367

6468
update-swagger:
6569
go install github.com/swaggo/swag/cmd/swag@latest

README.en.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,38 @@
2727

2828
<!-- features -->
2929
* [Sidebar](https://artalk.js.org/guide/frontend/sidebar.html): Quick management, intuitive browsing
30-
* [Social Login](https://artalk.js.org/guide/frontend/auth.html): Quick login via social accounts
31-
* [Email Notification](https://artalk.js.org/guide/backend/email.html): Multiple sending methods, email templates
32-
* [Multi-channel Push](https://artalk.js.org/guide/backend/admin_notify.html): Multiple push methods, notification templates
33-
* [In-site Notifications](https://artalk.js.org/guide/frontend/sidebar.html): Red dot marking, mention list
34-
* [CAPTCHA](https://artalk.js.org/guide/backend/captcha.html): Multiple verification types, frequency limitation
30+
* [Social Login](https://artalk.js.org/guide/frontend/auth.html): Fast login via social accounts
31+
* [Email Notification](https://artalk.js.org/guide/backend/email.html): Various sending methods, email templates
32+
* [Diverse Push](https://artalk.js.org/guide/backend/admin_notify.html): Multiple push methods, notification templates
33+
* [Site Notification](https://artalk.js.org/guide/frontend/sidebar.html): Red dot marks, mention list
34+
* [Captcha](https://artalk.js.org/guide/backend/captcha.html): Various verification types, frequency limits
3535
* [Comment Moderation](https://artalk.js.org/guide/backend/moderator.html): Content detection, spam interception
36-
* [Image Upload](https://artalk.js.org/guide/backend/img-upload.html): Custom upload, support for image hosting
37-
* [Markdown](https://artalk.js.org/guide/intro.html): Support Markdown syntax
38-
* [Emoticons](https://artalk.js.org/guide/frontend/emoticons.html): Compatible with OwO, quick integration
39-
* [Multi-site](https://artalk.js.org/guide/backend/multi-site.html): Site isolation, centralized management
36+
* [Image Upload](https://artalk.js.org/guide/backend/img-upload.html): Custom upload, supports image hosting
37+
* [Markdown](https://artalk.js.org/guide/intro.html): Supports Markdown syntax
38+
* [Emoji Pack](https://artalk.js.org/guide/frontend/emoticons.html): Compatible with OwO, quick integration
39+
* [Multi-Site](https://artalk.js.org/guide/backend/multi-site.html): Site isolation, centralized management
4040
* [Admin](https://artalk.js.org/guide/backend/multi-site.html): Password verification, badge identification
41-
* [Page Management](https://artalk.js.org/guide/frontend/sidebar.html): Quick view, one-click title jump
42-
* [Page Views Statistics](https://artalk.js.org/guide/frontend/pv.html): Easily track page views
43-
* [Hierarchy](https://artalk.js.org/guide/frontend/config.html#nestmax): Nested paginated lists, scroll loading
41+
* [Page Management](https://artalk.js.org/guide/frontend/sidebar.html): Quick view, one-click title navigation
42+
* [Page View Statistics](https://artalk.js.org/guide/frontend/pv.html): Easily track page views
43+
* [Hierarchical Structure](https://artalk.js.org/guide/frontend/config.html#nestmax): Nested paginated list, infinite scroll
4444
* [Comment Voting](https://artalk.js.org/guide/frontend/config.html#vote): Upvote or downvote comments
45-
* [Comment Sorting](https://artalk.js.org/guide/frontend/config.html#listsort): Multiple sorting options, freedom to choose
46-
* [Comment Search](https://artalk.js.org/guide/frontend/sidebar.html): Quickly search comment content
45+
* [Comment Sorting](https://artalk.js.org/guide/frontend/config.html#listsort): Various sorting options, freely selectable
46+
* [Comment Search](https://artalk.js.org/guide/frontend/sidebar.html): Quick comment content search
4747
* [Comment Pinning](https://artalk.js.org/guide/frontend/sidebar.html): Pin important messages
48-
* [Author-only View](https://artalk.js.org/guide/frontend/config.html): Show only comments from the author
49-
* [Comment Jumping](https://artalk.js.org/guide/intro.html): Quickly jump to referenced comments
50-
* [Auto Save](https://artalk.js.org/guide/frontend/config.html): Content input auto-saving
51-
* [IP Geolocation](https://artalk.js.org/guide/frontend/ip-region.html): User IP location display
48+
* [View Author Only](https://artalk.js.org/guide/frontend/config.html): Show only the author's comments
49+
* [Comment Jump](https://artalk.js.org/guide/intro.html): Quickly jump to quoted comment
50+
* [Auto Save](https://artalk.js.org/guide/frontend/config.html): Content loss prevention
51+
* [IP Region](https://artalk.js.org/guide/frontend/ip-region.html): Display user's IP region
5252
* [Data Migration](https://artalk.js.org/guide/transfer.html): Free migration, quick backup
53-
* [Image Lightbox](https://artalk.js.org/guide/frontend/lightbox.html): Quickly integrate image lightbox
54-
* [Image Lazy Loading](https://artalk.js.org/guide/frontend/img-lazy-load.html): Delay loading images, optimize experience
55-
* [Latex](https://artalk.js.org/guide/frontend/latex.html): Latex formula parsing integration
56-
* [Dark Mode](https://artalk.js.org/guide/frontend/config.html#darkmode): Dark mode switching
57-
* [Extension Plugins](https://artalk.js.org/develop/): Create more possibilities
58-
* [Multi-language](https://artalk.js.org/guide/frontend/i18n.html): Multi-language switching
59-
* [Command Line](https://artalk.js.org/guide/backend/config.html): Command line operation management capability
60-
* [API Documentation](https://artalk.js.org/develop/): Provides OpenAPI format documentation
61-
* [Program Upgrade](https://artalk.js.org/guide/backend/update.html): Version detection, one-click upgrade
53+
* [Image Lightbox](https://artalk.js.org/guide/frontend/lightbox.html): Quick integration of image lightbox
54+
* [Image Lazy Load](https://artalk.js.org/guide/frontend/img-lazy-load.html): Lazy load images, optimize experience
55+
* [Latex](https://artalk.js.org/guide/frontend/latex.html): Integrate Latex formula parsing
56+
* [Night Mode](https://artalk.js.org/guide/frontend/config.html#darkmode): Switch to night mode
57+
* [Extension Plugin](https://artalk.js.org/develop/plugin.html): Create more possibilities
58+
* [Multi-Language](https://artalk.js.org/guide/frontend/i18n.html): Switch between multiple languages
59+
* [Command Line](https://artalk.js.org/guide/backend/config.html): Command line operation management
60+
* [API Documentation](https://artalk.js.org/http-api.html): Provides OpenAPI format documentation
61+
* [Program Upgrade](https://artalk.js.org/guide/backend/update.html): Version check, one-click upgrade
6262
<!-- /features -->
6363

6464
<!-- prettier-ignore-end -->

docs/docs/.vitepress/config/en.ts

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
export const en = defineConfig({
4+
lang: 'en-US',
5+
description: 'A Self-hosted Comment System.',
6+
7+
themeConfig: {
8+
sidebar: {
9+
'/en/guide/': [
10+
{
11+
text: 'Quick Start',
12+
collapsed: false,
13+
items: [
14+
{ text: 'Project Introduction', link: '/en/guide/intro.md' },
15+
{ text: 'Program Deployment', link: '/en/guide/deploy.md' },
16+
{ text: 'Data Migration', link: '/en/guide/transfer.md' },
17+
],
18+
},
19+
{
20+
text: 'Core Guide',
21+
collapsed: false,
22+
items: [
23+
{ text: 'Sidebar', link: '/en/guide/frontend/sidebar.md' },
24+
{ text: 'Email Notification', link: '/en/guide/backend/email.md' },
25+
{ text: 'Multi-channel Notification', link: '/en/guide/backend/admin_notify.md' },
26+
{ text: 'Social Login', link: '/en/guide/frontend/auth.md' },
27+
{ text: 'Comment Moderation', link: '/en/guide/backend/moderator.md' },
28+
{ text: 'Captcha', link: '/en/guide/backend/captcha.md' },
29+
{ text: 'Image Upload', link: '/en/guide/backend/img-upload.md' },
30+
{ text: 'Admins and Multi-Site', link: '/en/guide/backend/multi-site.md' },
31+
{ text: 'Resolve Relative Path', link: '/en/guide/backend/relative-path.md' },
32+
],
33+
},
34+
{
35+
text: 'Advanced Guide',
36+
collapsed: false,
37+
items: [
38+
{ text: 'Emoticons', link: '/en/guide/frontend/emoticons.md' },
39+
{ text: 'Page View Statistics', link: '/en/guide/frontend/pv.md' },
40+
{ text: 'LaTeX', link: '/en/guide/frontend/latex.md' },
41+
{ text: 'Image Lightbox', link: '/en/guide/frontend/lightbox.md' },
42+
{ text: 'Image Lazy Load', link: '/en/guide/frontend/img-lazy-load.md' },
43+
{ text: 'IP Region', link: '/en/guide/frontend/ip-region.md' },
44+
{ text: 'Localization', link: '/en/guide/frontend/i18n.md' },
45+
{ text: 'Development Documentation', link: '/en/develop/index.md' },
46+
],
47+
},
48+
{
49+
text: 'Configuration Documentation',
50+
collapsed: false,
51+
items: [
52+
{ text: 'Environment Variables', link: '/en/guide/env.md' },
53+
{ text: 'Configuration File', link: '/en/guide/backend/config.md' },
54+
{ text: 'Interface Configuration', link: '/en/guide/frontend/config.md' },
55+
],
56+
},
57+
{
58+
text: 'Deployment Instructions',
59+
collapsed: false,
60+
items: [
61+
{ text: 'Daemon Process', link: '/en/guide/backend/daemon.md' },
62+
{ text: 'Reverse Proxy', link: '/en/guide/backend/reverse-proxy.md' },
63+
{
64+
text: 'Compile Source',
65+
link: 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md',
66+
},
67+
{ text: 'Program Upgrade', link: '/en/guide/backend/update.md' },
68+
{ text: 'Docker', link: '/en/guide/backend/docker.md' },
69+
],
70+
},
71+
],
72+
'/en/develop/': [
73+
{
74+
text: 'Development Documentation',
75+
items: [
76+
{ text: 'Development Instructions', link: '/en/develop/index.md' },
77+
{
78+
text: 'Contribution Guide',
79+
link: 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md',
80+
target: '_blank',
81+
},
82+
{ text: 'Import to Blog', link: '/en/develop/import-blog.md' },
83+
{ text: 'Import to Framework', link: '/en/develop/import-framework.md' },
84+
{ text: 'Frontend API', link: '/en/develop/fe-api.md' },
85+
{ text: 'Frontend Event', link: '/en/develop/event.md' },
86+
{ text: 'Plugin Development', link: '/en/develop/plugin.md' },
87+
{ text: 'Compatibility', link: '/en/develop/compatibility.md' },
88+
{
89+
text: 'HTTP API',
90+
link: 'https://artalk.js.org/http-api.html',
91+
},
92+
],
93+
},
94+
],
95+
},
96+
97+
nav: [
98+
{
99+
text: 'Introduction',
100+
link: '/en/guide/intro',
101+
},
102+
{
103+
text: 'Deployment',
104+
link: '/en/guide/deploy',
105+
},
106+
{
107+
text: 'Configuration',
108+
link: '/en/guide/backend/config',
109+
},
110+
{
111+
text: 'Migration',
112+
link: '/en/guide/transfer',
113+
},
114+
{
115+
text: 'Development',
116+
link: '/en/develop/',
117+
},
118+
],
119+
120+
editLink: {
121+
pattern: 'https://github.com/ArtalkJS/Artalk/edit/master/docs/docs/:path',
122+
text: 'Improve this document',
123+
},
124+
},
125+
})

docs/docs/.vitepress/config/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from 'vitepress'
2+
import { shared } from './shared'
3+
import { zh } from './zh'
4+
import { en } from './en'
5+
6+
export default defineConfig({
7+
...shared,
8+
locales: {
9+
root: { label: '简体中文', ...zh },
10+
en: { label: 'English', ...en },
11+
},
12+
})

docs/docs/.vitepress/config/shared.ts

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { defineConfig } from 'vitepress'
2+
import iterator from 'markdown-it-for-inline'
3+
import * as Version from '../../code/ArtalkVersion.json'
4+
5+
export const shared = defineConfig({
6+
title: 'Artalk',
7+
8+
rewrites: {
9+
'zh/:rest*': ':rest*',
10+
},
11+
12+
/* prettier-ignore */
13+
head: [
14+
['link', { rel: 'icon', type: 'image/png', href: '/favicon.png' }],
15+
['meta', { name: 'theme-color', content: '#007bff' }],
16+
['meta', { property: 'og:type', content: 'website' }],
17+
['meta', { property: 'og:locale', content: 'en' }],
18+
['meta', { property: 'og:title', content: 'Artalk - A Self-hosted Comment System'}],
19+
['meta', { property: 'og:site_name', content: 'Artalk' }],
20+
['meta', { property: 'og:image', content: 'https://artalk.js.org/assets/images/artalk-banner.png' }],
21+
['meta', { property: 'og:url', content: 'https://artalk.js.org/' }],
22+
['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' }],
23+
],
24+
25+
markdown: {
26+
// @link https://github.com/shikijs/shiki
27+
theme: {
28+
light: 'github-light',
29+
dark: 'github-dark',
30+
},
31+
config: (md) => {
32+
md.use(iterator, 'artalk_version', 'text', function (tokens, idx) {
33+
tokens[idx].content = tokens[idx].content.replace(/:ArtalkVersion:/g, Version.latest)
34+
})
35+
md.use(iterator, 'artalk_version_link', 'link_open', (tokens, idx) => {
36+
const href = tokens[idx].attrGet('href')
37+
tokens[idx].attrSet('href', href.replace(/:ArtalkVersion:/g, Version.latest))
38+
})
39+
},
40+
},
41+
42+
sitemap: {
43+
hostname: 'https://artalk.js.org',
44+
transformItems(items) {
45+
return items.filter((item) => !item.url.includes('migration'))
46+
},
47+
},
48+
49+
lastUpdated: true,
50+
cleanUrls: true,
51+
metaChunk: true,
52+
53+
themeConfig: {
54+
socialLinks: [{ icon: 'github', link: 'https://github.com/ArtalkJS/Artalk' }],
55+
56+
search: {
57+
provider: 'algolia',
58+
options: {
59+
appId: '2WNJ32WVTY',
60+
apiKey: '6c6ebc345a87b738264f19095b78c91c',
61+
indexName: 'artalk-js',
62+
},
63+
},
64+
},
65+
66+
vite: {
67+
server: {
68+
open: '/guide/intro.html',
69+
},
70+
},
71+
})

0 commit comments

Comments
 (0)