Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(i18n): add English translations for docs #978

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ pnpm-lock.yaml
ui/artalk/src/api/v2.ts
docs/swagger/swagger.json
docs/swagger/swagger.yaml
docs/docs/**
docs/docs/**/*.md
docs/docs/.vitepress/dist/**
docs/docs/.vitepress/cache/**
ui/artalk-sidebar/src/lib/md5.js
ui/artalk/src/lib/detect.ts
**/dist/**
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ update-conf:
go generate ./internal/config

update-conf-docs:
go run ./internal/config/meta/gen --format markdown --locale zh-CN -o ./docs/docs/guide/env.md
go run ./internal/config/meta/gen --format markdown --locale en -o ./docs/docs/en/guide/env.md
go run ./internal/config/meta/gen --format markdown --locale zh-CN -o ./docs/docs/zh/guide/env.md

update-docs-features:
pnpm -F docs-landing update:readme

update-swagger:
go install github.com/swaggo/swag/cmd/swag@latest
Expand Down
54 changes: 27 additions & 27 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,38 @@

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

<!-- prettier-ignore-end -->
Expand Down
125 changes: 125 additions & 0 deletions docs/docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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: 'Admins 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: 'Localization', 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: false,
items: [
{ text: 'Daemon Process', link: '/en/guide/backend/daemon.md' },
{ text: 'Reverse Proxy', link: '/en/guide/backend/reverse-proxy.md' },
{
text: 'Compile Source',
link: 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md',
},
{ text: 'Program Upgrade', link: '/en/guide/backend/update.md' },
{ text: 'Docker', link: '/en/guide/backend/docker.md' },
],
},
],
'/en/develop/': [
{
text: 'Development Documentation',
items: [
{ text: 'Development Instructions', link: '/en/develop/index.md' },
{
text: 'Contribution Guide',
link: 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md',
target: '_blank',
},
{ 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: 'Development',
link: '/en/develop/',
},
],

editLink: {
pattern: 'https://github.com/ArtalkJS/Artalk/edit/master/docs/docs/:path',
text: 'Improve this document',
},
},
})
12 changes: 12 additions & 0 deletions docs/docs/.vitepress/config/index.ts
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 },
},
})
71 changes: 71 additions & 0 deletions docs/docs/.vitepress/config/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { defineConfig } from 'vitepress'
import iterator from 'markdown-it-for-inline'
import * as Version from '../../code/ArtalkVersion.json'

export const shared = defineConfig({
title: 'Artalk',

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',
},
},
})
Loading