Skip to content

Commit

Permalink
feat(docs): add support for Traditional Chinese (HK and TW) and impro… (
Browse files Browse the repository at this point in the history
#2)

* feat(docs): add support for Traditional Chinese (HK and TW) and improve documentation

- Add Traditional Chinese (HK and TW) translations for documentation
- Update English and Chinese documentation with new content and features
- Implement automated translation workflow using DeepSeek API
- Refactor documentation structure and improve readability
- Add new sections on technology stack, architecture, and internationalization

* update workflows
  • Loading branch information
zds-s authored Jan 14, 2025
1 parent ad0914d commit 57ee1a4
Show file tree
Hide file tree
Showing 195 changed files with 17,471 additions and 60 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/auto-translate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Translate Docs

on:
push:
paths:
- 'docs/**'

jobs:
translate:
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get All Changed Markdown Files
id: changed-markdown-files
uses: tj-actions/changed-files@v45
with:
# Avoid using single or double quotes for multiline patterns
files: |
docs/**.md
- name: List All Changed Markdown Files
if: steps.changed-markdown-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: phpize
extensions: swoole, redis
ini-values: extension=opencc

- name: Install OpenCC
run: |
sudo apt-get install libopencc-dev -y
- name: Build opencc4php
run: |
git clone https://github.com/nauxliu/opencc4php.git --depth 1
cd opencc4php
phpize
./configure
make
sudo make install
php --ri opencc
cd ..
rm -rf opencc4php
- name: Install Packages
run: pnpm install

- name: Setup Dependencies
run: composer install

- name: Start Translate ZH
run: |
cp docs/index.md docs/zh/index.md
php bin/doc-translate
- name: Start Translate EN
if: steps.changed-markdown-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
pnpm run docs:translate
- name: Commit Updated
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update docs and translate
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ dist-ssr
/.vitepress/.temp/
/.vitepress/cache/
/.vitepress/cache/deps/
/vendor/
composer.lock
44 changes: 42 additions & 2 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import {defineConfigWithTheme, type MarkdownRenderer} from 'vitepress'

import enGetNavs from "./src/en/nav";
import zhGetNavs from "./src/zh/nav";
import enGetConfig from "./src/en/config";
import enGetSidebar from "./src/en/sidebars";

import zhGetNavs from "./src/zh/nav";
import zhGetConfig from "./src/zh/config";
import zhGetSidebar from "./src/zh/sidebars";
import enGetSidebar from "./src/en/sidebars";

import hkConfig from "./src/zh-hk/config";
import hkNav from "./src/zh-hk/nav";
import hkSidebar from "./src/zh-hk/sidebars";

import twConfig from "./src/zh-tw/config";
import twNav from "./src/zh-tw/nav";
import twSidebar from "./src/zh-tw/sidebars";


import { AnnouncementPlugin } from 'vitepress-plugin-announcement'
import { plantuml } from "@mdit/plugin-plantuml";
import { demoPreviewPlugin } from './plugins/previewPlugin'
Expand Down Expand Up @@ -45,6 +57,34 @@ export default defineConfigWithTheme ({
level:[2 ,4],
},
}
},
"zh-hk":{
label:"繁體中文(香港)",
lang:"zh-hk",
link:"/zh-hk/index",
...hkConfig,
themeConfig:{
logo: '/logo.svg',
nav: hkNav,
sidebar:hkSidebar,
outline:{
level:[2 ,4],
},
}
},
"zh-tw":{
label:"繁體中文(台灣)",
lang:"zh-tw",
link:"/zh-tw/index",
...twConfig,
themeConfig:{
logo: '/logo.svg',
nav: twNav,
sidebar:twSidebar,
outline:{
level:[2 ,4],
},
}
}
},
themeConfig: {
Expand Down
4 changes: 2 additions & 2 deletions .vitepress/src/en/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
title: "MineAdmin",
description: "Enterprise-grade back-office management system",
tagline: "Brand new version, ready to use right out of the box",
description: "Enterprise-level Backend Management System",
tagline: "Brand New Version, Ready to Use Out of the Box",
}
12 changes: 6 additions & 6 deletions .vitepress/src/en/nav.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {DefaultTheme} from "vitepress";
import { DefaultTheme } from "vitepress";

const nav:DefaultTheme.NavItem[] = [
const nav: DefaultTheme.NavItem[] = [
{ text: 'Guide', link: '/en/guide/introduce/mineadmin' },
{ text: 'Frontend', link: '/en/front/base/concept' },
{ text: 'Backend', link: '/en/backend/index' },
{ text: 'Plugins', link: '/en/plugin/index' },
{ text: 'Plugins', link: "/en/plugin/index" },
{ text: 'FAQ', link: '/en/faq/index' },
{ text: 'More' ,items:[
{ text: 'Old Version Documentation', link: 'https://docv2.mineadmin.com' },
{ text: 'More Recommendations', items: [
{ text: 'Legacy Documentation', link: 'https://docv2.mineadmin.com' },
{ text: 'Hyperf Component Library', link: 'https://hyperf.fans/' },
{ text: 'Fantastic-admin Framework', link: 'https://fantastic-admin.hurui.me/' },
{ text: 'Fantastic-admin Frontend Framework', link: 'https://fantastic-admin.hurui.me/' },
]}
]

Expand Down
Loading

0 comments on commit 57ee1a4

Please sign in to comment.