Skip to content

Commit

Permalink
docs(i18n): add English translations
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Sep 17, 2024
1 parent 914fb4a commit 19540bd
Show file tree
Hide file tree
Showing 96 changed files with 4,785 additions and 127 deletions.
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
42 changes: 13 additions & 29 deletions docs/docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const en = defineConfig({
{ 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: 'Admins and Multi-Site', link: '/en/guide/backend/multi-site.md' },
{ text: 'Resolve Relative Path', link: '/en/guide/backend/relative-path.md' },
],
},
Expand All @@ -41,7 +41,7 @@ export const en = defineConfig({
{ 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: 'Localization', link: '/en/guide/frontend/i18n.md' },
{ text: 'Development Documentation', link: '/en/develop/index.md' },
],
},
Expand All @@ -56,32 +56,29 @@ export const en = defineConfig({
},
{
text: 'Deployment Instructions',
collapsed: true,
collapsed: false,
items: [
{ text: 'Daemon', link: '/en/guide/backend/daemon.md' },
{ text: 'Daemon Process', link: '/en/guide/backend/daemon.md' },
{ text: 'Reverse Proxy', link: '/en/guide/backend/reverse-proxy.md' },
{ text: 'Build', link: '/en/develop/contributing.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' },
],
},
{
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: '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' },
Expand Down Expand Up @@ -114,23 +111,10 @@ export const en = defineConfig({
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: {
Expand Down
7 changes: 3 additions & 4 deletions docs/docs/.vitepress/config/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ 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*',
// },
rewrites: {
'zh/:rest*': ':rest*',
},

/* prettier-ignore */
head: [
Expand Down
14 changes: 0 additions & 14 deletions docs/docs/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,6 @@ export const zh = defineConfig({
text: '开发',
link: '/develop/',
},
// NavbarGroup
{
text: '传送',
items: [
{
text: '代码仓库',
link: 'https://github.com/ArtalkJS/Artalk',
},
// {
// text: "文档镜像 (国内)",
// link: "https://artalk-docs.qwqaq.com",
// },
],
},
],

editLink: {
Expand Down
18 changes: 18 additions & 0 deletions docs/docs/en/develop/compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Compatibility

## Browser Compatibility

The Artalk client production environment code is built using esbuild with a target of `es2015`. However, please note that the build process only handles syntax transpilation to comply with the `es2015` standard and does not address API compatibility (no polyfills are included).

If your project needs to support older browsers and devices, consider including global polyfills in your bundled application. We recommend using the [Polyfill.io](https://polyfill.io/) service, which dynamically returns the necessary polyfills based on the user's User-Agent. Alternatively, you can manually add polyfills using [core-js](https://github.com/zloirock/core-js) or [Babel](https://babeljs.io/).

Here is a list of modern features used by Artalk:

- [All ECMAScript 2015 (ES6) features](https://compat-table.github.io/compat-table/es6/)
- [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
- [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
- [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)

## Server Compatibility

The Artalk server program is developed in Golang and supports operating systems such as Linux, Windows, and macOS. The current Golang version for Artalk can be found in the [go.mod](https://github.com/ArtalkJS/Artalk/blob/master/go.mod#L3). For the minimum operating system requirements for Golang, refer to the [Go Wiki](https://go.dev/wiki/MinimumRequirements).
3 changes: 3 additions & 0 deletions docs/docs/en/develop/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script setup lang="ts">
if (!import.meta.env.SSR) window.location = 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md';
</script>
50 changes: 50 additions & 0 deletions docs/docs/en/develop/event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Frontend Event

## Basic Events

| Event Name | Description |
| ------------------- | ------------------------------- |
| `created` | After initialization |
| `mounted` | After data loading |
| `updated` | After data update |
| `unmounted` | After destruction |
| `list-fetch` | During comment list request |
| `list-fetched` | After comment list request |
| `list-load` | Before comment loading |
| `list-loaded` | After comment loading |
| `list-failed` | When comment loading fails |
| `list-goto-first` | When comment list resets |
| `list-reach-bottom` | When comment list reaches bottom|
| `comment-inserted` | After comment insertion |
| `comment-updated` | After comment update |
| `comment-deleted` | After comment deletion |
| `comment-rendered` | After comment node rendering |
| `notifies-updated` | When unread messages change |
| `list-goto` | During comment jump |
| `page-loaded` | After page data update |
| `editor-submit` | When editor submits |
| `editor-submitted` | After editor submission |
| `user-changed` | When local user data changes |
| `sidebar-show` | When sidebar is shown |
| `sidebar-hide` | When sidebar is hidden |

Event declaration code: [@ArtalkJS/Artalk - src/types/event.ts](https://github.com/ArtalkJS/Artalk/blob/master/ui/artalk/src/types/event.ts)

## Adding Event Listeners

```js
artalk.on('list-loaded', () => {
alert('Comments have been loaded')
})
```

## Removing Event Listeners

```js
let foo = function () {
/* do something */
}

artalk.on('list-loaded', foo)
artalk.off('list-loaded', foo)
```
Loading

0 comments on commit 19540bd

Please sign in to comment.