Skip to content

Commit

Permalink
Vitepress (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 authored Jan 16, 2025
1 parent 6e502bd commit 7d16957
Show file tree
Hide file tree
Showing 69 changed files with 4,128 additions and 1,389 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: docbuild

on:
push:
paths: [ 'docs/**']
pull_request:
paths: [ 'docs/**']

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
ref: main

- uses: actions/setup-node@master
with:
node-version: 20
cache: npm
- uses: actions/configure-pages@v4
- run: |
cd docs
npm install
npm run docs:build
cp index.html .vitepress/dist
cd ..
git checkout -b docbuild
- uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ cpp/LunaHook/scripts/YY-Thunks-1.0.7-Binary.zip
cpp/libs/YY-Thunks
py/LunaTranslator/.vscode/settings.json
py/files/yearsummary/yearsummary.value.js
docs/.vitepress/cache
docs/node_modules
docs/.vitepress/dist
83 changes: 83 additions & 0 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { defineConfig } from 'vitepress'

export const en = defineConfig({

themeConfig: {
footer: {
message: "<a href='support'>Support the author</a>",
copyright: `Released under the GPLv3 license`
},
nav: [
{ text: "HomePage", link: "https://lunatranslator.org/" },
{ text: "Vedio Tutorial", link: "https://www.youtube.com/results?search_query=LunaTranslator" },
{ text: "Discord", link: "https://discord.com/invite/ErtDwVeAbB" }
],
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
},
sidebar: [
{
text: 'Basic',
items: [
{ text: 'Download and Launch', link: '/en/README' },
{ text: 'Unable to Start the Software', link: '/en/cantstart' },
{ text: 'Basic Usage', link: '/en/basicuse' },
{ text: 'Software Update', link: '/en/update' },
{ text: 'Support the Author', link: '/en/support' }
]
},
{
text: 'Detailed',
items: [
{
text: 'HOOK Related Settings', link: '/en/hooksettings',
collapsed: true,
items: [
{ text: 'HOOK Settings', link: '/en/hooksettings' },
{ text: 'Embedded Translation', link: '/en/embedtranslate' },
{ text: 'Playing Old Games on XP Virtual Machine and Extracting Text for Translation', link: '/en/playonxp' }
]
},
{
text: 'OCR Related Settings', link: '/en/useapis/ocrapi',
collapsed: true,
items: [
{ text: 'OCR interface settings', link: '/en/useapis/ocrapi' },
{ text: 'OCR Automation Execution Methods', link: '/en/ocrparam' },
{ text: 'Binding Game Window in OCR Mode', link: '/en/gooduseocr' }
]
},
{
text: 'Translation interface settings', link: '/en/useapis/tsapi',
collapsed: true,
items: [
{ text: 'Traditional online translation interface', link: '/en/useapis/tsapi' },
{ text: 'Large Model API for Translation', link: '/en/guochandamoxing' },
{ text: 'Large Model Offline Translation', link: '/en/offlinellm' }
]
},
{
text: 'Text Processing & Translation Optimization', link: '/en/textprocess',
collapsed: true,
items: [
{ text: 'Functions and Usage of Various Text Processing Methods', link: '/en/textprocess' },
{ text: 'Functions of Various Translation Optimizations', link: '/en/transoptimi' }
]
},
{ text: 'Speech Synthesis', link: '/en/ttsofname' },
{
text: 'Tokenization & Dictionary', link: '/en/qa1',
collapsed: true,
items: [
{ text: 'Using Mecab for Tokenization & Part-of-Speech Color Annotation', link: '/en/qa1' },
{ text: 'Anki Integration', link: '/en/qa2' }
]
},
{ text: 'Tool Buttons', link: '/en/alltoolbuttons' },
{ text: 'Shortcut Keys', link: '/en/fastkeys' }
]
}
]
}
})
63 changes: 63 additions & 0 deletions docs/.vitepress/config/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { defineConfig } from 'vitepress'
import { en } from './en'
import { zh, zhSearch } from './zh'
import { ja, jaSearch } from './ja'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "LunaTranslator",
head: [
['link', { rel: 'icon', href: 'https://image.lunatranslator.org/luna.ico' }],
['script', {},
`
window.onload = function () {
if (window.location.hostname.startsWith('docs')) {
let replacetarget2 = window.location.protocol + '//' + window.location.hostname.substring(5);
let ele = document.querySelector("#app > div > header > div > div.wrapper > div > div.content > div > nav > a:nth-child(2)")
if (ele) {
ele.href = ele.href.replace('https://lunatranslator.org', replacetarget2)
}
}
}
function openlink(url) {
window.open(window.location.protocol + '//' + window.location.hostname.substring(5) + '/' + url, "_blank")
}
`]
],
rewrites: {
// 'zh/:rest*': ':rest*'
},

lastUpdated: true,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
socialLinks: [
{ icon: 'github', link: 'https://github.com/HIllya51/LunaTranslator' }
],
outline: {
level: [2, 3],
},
search: {
provider: 'local', options: {
locales: {
...zhSearch,
...jaSearch
}
}
},
logo: 'https://image.lunatranslator.org/luna.ico'
},

locales: {
zh: { label: '简体中文', ...zh },
en: { label: 'English', ...en },
ja: { label: '日本語', ...ja }
},
ignoreDeadLinks: true,
markdown: {
config(md) {
md.use(tabsMarkdownPlugin)
}
}
})
141 changes: 141 additions & 0 deletions docs/.vitepress/config/ja.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { defineConfig } from 'vitepress'
export const jaSearch = {
ja: {
placeholder: 'ドキュメントを検索',
translations: {
button: {
buttonText: 'ドキュメントを検索',
buttonAriaLabel: 'ドキュメントを検索'
},
modal: {
searchBox: {
resetButtonTitle: '検索条件をクリア',
resetButtonAriaLabel: '検索条件をクリア',
cancelButtonText: 'キャンセル',
cancelButtonAriaLabel: 'キャンセル'
},
startScreen: {
recentSearchesTitle: '検索履歴',
noRecentSearchesText: '検索履歴はありません',
saveRecentSearchButtonTitle: '検索履歴に保存',
removeRecentSearchButtonTitle: '検索履歴から削除',
favoriteSearchesTitle: 'お気に入り',
removeFavoriteSearchButtonTitle: 'お気に入りから削除'
},
errorScreen: {
titleText: '結果を取得できません',
helpText: 'ネットワーク接続を確認してください'
},
footer: {
selectText: '選択',
navigateText: '切り替え',
closeText: '閉じる',
searchByText: '検索プロバイダ'
},
noResultsScreen: {
noResultsText: '関連する結果が見つかりません',
suggestedQueryText: '以下のクエリを試してみてください',
reportMissingResultsText: 'このクエリに結果があるべきだと思いますか?',
reportMissingResultsLinkText: 'フィードバックを送信'
}
}
}
}
}
export const ja = defineConfig({
themeConfig: {
outline: {
level: [2, 3],
label: "ページナビゲーション"
},
footer: {
message: "<a href='support'>作者を支援する</a>",
copyright: `GPLv3ライセンスに基づいて公開`
},
editLink: {
pattern: 'https://github.com/HIllya51/LunaTranslator/edit/main/docs/:path',
text: 'GitHubでこのページを編集'
},

docFooter: {
prev: '前のページ',
next: '次のページ'
},

lastUpdated: {
text: '最終更新日',
formatOptions: {
dateStyle: 'short',
timeStyle: 'medium'
}
},
nav: [
{ text: "公式サイト", link: "/README" },
{ text: "ビデオチュー", link: "https://www.youtube.com/results?search_query=LunaTranslator" },
{ text: "Discord", link: "https://discord.com/invite/ErtDwVeAbB" }
],
sidebar: [
{
text: '基本的な',
items: [
{ text: 'ダウンロードと起動', link: '/ja/README' },
{ text: 'ソフトウェアが起動しない', link: '/ja/cantstart' },
{ text: '基本的な使用方法', link: '/ja/basicuse' },
{ text: 'ソフトウェアの更新', link: '/ja/update' },
{ text: '作者をサポートする', link: '/ja/support' }
]
},
{
text: '詳細な',
items: [
{
text: 'HOOK関連設定', link: '/ja/hooksettings',
collapsed: true,
items: [
{ text: 'HOOK設定', link: '/ja/hooksettings' },
{ text: '埋め込み翻訳', link: '/ja/embedtranslate' },
{ text: 'XP仮想マシンで古いゲームをプレイしてテキストを抽出して翻訳する', link: '/ja/playonxp' }
]
},
{
text: 'OCR関連設定', link: '/ja/useapis/ocrapi',
collapsed: true,
items: [
{ text: 'OCRインターフェース設定', link: '/ja/useapis/ocrapi' },
{ text: 'OCR自動化実行方法', link: '/ja/ocrparam' },
{ text: 'OCRモードでゲームウィンドウをバインドする', link: '/ja/gooduseocr' }
]
},
{
text: '翻訳インターフェース設定', link: '/ja/useapis/tsapi',
collapsed: true,
items: [
{ text: '従来のオンライン翻訳インターフェース', link: '/ja/useapis/tsapi' },
{ text: '大規模モデルAPI翻訳', link: '/ja/guochandamoxing' },
{ text: '大規模モデルオフライン翻訳', link: '/ja/offlinellm' }
]
},
{
text: 'テキスト処理&翻訳最適化', link: '/ja/textprocess',
collapsed: true,
items: [
{ text: 'さまざまなテキスト処理方法の役割と使用方法', link: '/ja/textprocess' },
{ text: 'さまざまな翻訳最適化の役割', link: '/ja/transoptimi' }
]
},
{ text: '音声合成', link: '/ja/ttsofname' },
{
text: '形態素解析&辞書', link: '/ja/qa1',
collapsed: true,
items: [
{ text: 'Mecabを使用した形態素解析&品詞カラー表示', link: '/ja/qa1' },
{ text: 'Anki統合', link: '/ja/qa2' }
]
},
{ text: 'ツールボタン', link: '/ja/alltoolbuttons' },
{ text: 'ショートカットキー', link: '/ja/fastkeys' }
]
}
]
}
})
Loading

0 comments on commit 7d16957

Please sign in to comment.