Help Translation
The project is built using Vitepress, thus it's ok to edit Markdown files and preview the results easily. You should have a GitHub account to create pull requests (PRs).
Folder Structure
Files and .**
folders in the project directory have already been configured properly. You should focus on docs/
folder.
.vitepress/
: The config and theme of the siteconfig.ts
: Main configsidebar.ts
: Sidebar configtheme/
: Theme config
components/
: Vue.js components that can be used in Markdown filespublic/
: public assetsblog/
commands/
faq/
guides/
releases/
: Content of the document site<locale>/
: Translation of a locale, such aszh-hans/
representsSimplified Chinese
index.md
: Index file for the Home Page. In sub-folders, its metadata controls thetitle
,order
... of the content.
Add a new locale
- Edit
docs/.vitepress/config.ts
, please edit<locale>
and specific texts to correct ones.tsthemeConfig:{ search: { options: { locales: { ... // Translate Search Texts for the <locale> "<locale>": { translations: { button: { buttonText: "", buttonAriaLabel: "", }, modal: { displayDetails: "", backButtonTitle: "", noResultsText: "", resetButtonTitle: "", footer: { selectText: "", navigateText: "", closeText: "", }, }, }, }, } } }
- Edit
docs/.vitepress/config.ts
, please edit<locale>
,<English/简体中文/...>
, and specific texts to correct ones.tslocales: { ... // Override Config for the <locale> "<locale>": { label: "<English/简体中文/...>", lang: "<locale>", link: "/<locale>/", title: "Advancedfx", description: "Half-Life Advanced Effects (HLAE) is a tool to enrich Source (mainly CS:GO) engine based movie making.", themeConfig: { lastUpdated: { text: "Last Updated", }, editLink: { pattern: "https://github.com/advancedfx/afx-doc/edit/master/docs/:path", text: "Edit this page on GitHub", }, docFooter: { prev: "Previous Page", next: "Next Page", }, footer: { message: "Made with ❤️ by Advancedfx", copyright: "Copyright © 2023-present advancedfx.org", }, nav: [ { text: "Guides", link: "/<locale>/guides/" }, { text: "Commands", link: "/<locale>/commands/" }, { text: "FAQ", link: "/<locale>/faq/" }, { text: "Blog", link: "/<locale>/blog/" }, { text: "Releases", link: "/<locale>/releases/" }, { text: "Download", link: "/<locale>/" }, // TODO: link to download # ], }, }, }
- Edit
docs/.vitepress/sidebar.ts
, please edit<locale>
to the correct one.tsconst sidebar = generateSidebar([ ... // Duplicate Previous Ones to modify { ...common_options, scanStartPath: "<locale>", resolvePath: "/<locale>/", excludeFolders: ["releases", "blog"], }, { ...common_options, scanStartPath: "<locale>/releases", resolvePath: "/<locale>/releases/", sortMenusOrderByDescending: true, }, { ...common_options, scanStartPath: "<locale>/blog", resolvePath: "/<locale>/blog/", sortMenusOrderByDescending: true, }, ]);
- Duplicate
blog/
commands/
faq/
guides/
releases/
andindex.md
to a new<locale>
folder. - Do edit and translation. Git Commit and push when you are ready.
- Create a Pull Request to merge your contribution.
Translate new pages
Similar to above steps, but this time without step 1~3.
In step 4, copy new files to the correct path in <locale>
folder.
Edit a existed page
If you see a existed page that need translation or improvement, simply click Edit this page on GitHub
and follow the instructions. It would be like the above step 5~6.
Notice on writing .md
for the site
Before the Main content of markdown, we have a metadata
section. title
will be used in the sidebar. order
will be used to determine the order of pages in the sidebar.
---
title: Get Started
order: 0
---
# Get Started
Yo~✋🏻
index.md
in subfolders configures the title and order of the folder/group of content.
WARNING
All .md
file names must be lower_cased
.
Test Locally
- Install Node.js >= 18.
- Install pnpm globally:
npm i -g pnpm
- Git clone the repository and change to the directory.
- Install packages:
pnpm install
- Start Testing:
pnpm dev
CTRL+C
quit and re-dev triggers sidebar updates.
INFO
Checkout package.json
> scripts
to view all pnpm *
commands.