Skip to content

Commit 96f9785

Browse files
SunrisepeakCopilot
andauthored
add multi language support (#3)
* add multi language support - mcpp-community/OpenOrg#1 Signed-off-by: sunrisepeak <speakshen@163.com> * update * update * Update book/build.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update xmake.lua Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: sunrisepeak <speakshen@163.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 71ae939 commit 96f9785

25 files changed

Lines changed: 699 additions & 28 deletions

.github/workflows/online-ebook.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ jobs:
5050
# with:
5151
# mdbook-version: '0.4.43'
5252

53-
- run: mdbook build
54-
5553
- name: Setup Pages
5654
id: pages
5755
uses: actions/configure-pages@v4
5856
- name: Build with mdBook
5957
run: |
6058
export PATH=/home/xlings/.xlings_data/bin:$PATH
61-
mdbook build
59+
./build.sh
6260
- name: Upload artifact
6361
uses: actions/upload-pages-artifact@v3
6462
with:

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
# d2x-project-template
22

3-
> d2x交互式教程项目模板 - `Book + Video + Code + X`
3+
> d2x Interactive Tutorial Project Template - `Book + Video + Code + X`
44
55
[![d2x](https://img.shields.io/badge/d2x-ok-green.svg)](https://github.com/d2learn/d2x)
66
[![online-ebook](https://img.shields.io/badge/online-ebook-orange.svg)](https://github.com/d2learn/d2x)
77
[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE-CODE)
88

9-
| [d2x工具](https://github.com/d2learn/d2x) - [论坛](https://forum.d2learn.org) |
9+
| [d2x Tool](https://github.com/d2learn/d2x) - [Forum](https://forum.d2learn.org) / [中文](README.zh.md) - [English](README.md) |
1010
| --- |
11-
| [文档](https://d2learn.github.io/d2x-project-template) -> [工具和环境配置](https://d2learn.github.io/d2x-project-template/chapter_1.html) -> [项目和新内容添加](https://d2learn.github.io/d2x-project-template/chapter_2.html) |
11+
| [Documentation](https://d2learn.github.io/d2x-project-template/en) -> [Tools and Environment](https://d2learn.github.io/d2x-project-template/en/chapter_1.html) -> [Project Configuration and New Content](https://d2learn.github.io/d2x-project-template/en/chapter_2.html) |
1212

13-
该项目提供了一个, 可以被[d2x](https://github.com/d2learn/d2x)工具识别和加载的**交互式教程项目**的基础结构. 开发者和教程创作者, 可以基于这个模板来设计开发自己的交互式教程项目
13+
This project provides a basic structure for an **interactive tutorial project** that can be recognized and loaded by the [d2x](https://github.com/d2learn/d2x) tool. Developers and tutorial creators can design and develop their own interactive tutorial projects based on this template.
1414

15-
## 功能特色
15+
## Features
1616

17-
- 提供了基础的 `Book + Video + Code + X` 结构
18-
- d2x工具可以直接识别和加载
19-
- 提供了项目依赖描述, 支持一键配置环境
17+
- Provides a basic structure of `Book + Video + Code + X`
18+
- The d2x tool can directly recognize and load it
19+
- Provides project dependency description, supporting one-click environment configuration
2020

21-
## 快速开始
21+
## Quick Start
2222

23-
- 第一步: 点击 [新建教程模板](https://github.com/new?template_name=d2x-project-template&template_owner=d2learn) 按钮, 通过模板仓库创建新教程项目
24-
- 第二步: 克隆新仓库到本地 - `git clone git@github.com:your_name/your_repo_name.git`
25-
- 第三步:
26-
- [安装d2x工具](https://d2learn.github.io/d2x-project-template/chapter_1.html)
27-
- [认识项目结构并配置](https://d2learn.github.io/d2x-project-template/chapter_2.html)
23+
- Step 1: Click the [Create New Tutorial Template](https://github.com/new?template_name=d2x-project-template&template_owner=d2learn) button to create a new tutorial project from the template repository
24+
- Step 2: Clone the new repository to your local machine - `git clone git@github.com:your_name/your_repo_name.git`
25+
- Step 3:
26+
- [Install d2x Tool](https://d2learn.github.io/d2x-project-template/en/chapter_1.html)
27+
- [Understand Project Structure and Configuration](https://d2learn.github.io/d2x-project-template/en/chapter_2.html)
2828

29-
## 具体项目案例
29+
## Project Examples
3030

31-
| 项目 | 简介 | 备注 |
31+
| Project | Description | Remarks |
3232
| --- | --- | --- |
33-
| [d2mcpp](https://github.com/mcpp-community/d2mcpp) | 现代C++核心特性入门教程 | |
34-
| [d2ds](https://github.com/d2learn/d2ds) | 强调动手实践的数据结构学习项目 | |
33+
| [d2mcpp](https://github.com/mcpp-community/d2mcpp) | Tutorial on Modern C++ Core Features | |
34+
| [d2ds](https://github.com/d2learn/d2ds) | Data Structure Learning Project with Emphasis on Hands-on Practice | |
3535

36-
## 其他
36+
## Others
3737

38-
- [d2x工具](https://github.com/d2learn/d2x)
39-
- [论坛交流和反馈](https://forum.d2learn.org)
40-
- `交流群`: 167535744
38+
- [d2x Tool](https://github.com/d2learn/d2x)
39+
- [Forum Communication and Feedback](https://forum.d2learn.org)
40+
- `Chat Group`: 167535744

README.zh.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# d2x-project-template
2+
3+
> d2x交互式教程项目模板 - `Book + Video + Code + X`
4+
5+
[![d2x](https://img.shields.io/badge/d2x-ok-green.svg)](https://github.com/d2learn/d2x)
6+
[![online-ebook](https://img.shields.io/badge/online-ebook-orange.svg)](https://github.com/d2learn/d2x)
7+
[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE-CODE)
8+
9+
| [d2x工具](https://github.com/d2learn/d2x) - [论坛](https://forum.d2learn.org) / [中文](README.zh.md) - [English](README.md) |
10+
| --- |
11+
| [文档](https://d2learn.github.io/d2x-project-template) -> [工具和环境配置](https://d2learn.github.io/d2x-project-template/chapter_1.html) -> [项目和新内容添加](https://d2learn.github.io/d2x-project-template/chapter_2.html) |
12+
13+
该项目提供了一个, 可以被[d2x](https://github.com/d2learn/d2x)工具识别和加载的**交互式教程项目**的基础结构. 开发者和教程创作者, 可以基于这个模板来设计开发自己的交互式教程项目
14+
15+
## 功能特色
16+
17+
- 提供了基础的 `Book + Video + Code + X` 结构
18+
- d2x工具可以直接识别和加载
19+
- 提供了项目依赖描述, 支持一键配置环境
20+
21+
## 快速开始
22+
23+
- 第一步: 点击 [新建教程模板](https://github.com/new?template_name=d2x-project-template&template_owner=d2learn) 按钮, 通过模板仓库创建新教程项目
24+
- 第二步: 克隆新仓库到本地 - `git clone git@github.com:your_name/your_repo_name.git`
25+
- 第三步:
26+
- [安装d2x工具](https://d2learn.github.io/d2x-project-template/chapter_1.html)
27+
- [认识项目结构并配置](https://d2learn.github.io/d2x-project-template/chapter_2.html)
28+
29+
## 具体项目案例
30+
31+
| 项目 | 简介 | 备注 |
32+
| --- | --- | --- |
33+
| [d2mcpp](https://github.com/mcpp-community/d2mcpp) | 现代C++核心特性入门教程 | |
34+
| [d2ds](https://github.com/d2learn/d2ds) | 强调动手实践的数据结构学习项目 | |
35+
36+
## 其他
37+
38+
- [d2x工具](https://github.com/d2learn/d2x)
39+
- [论坛交流和反馈](https://forum.d2learn.org)
40+
- `交流群`: 167535744

book/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 书籍/文档
2+
3+
```
4+
d2x book
5+
```

book/book.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[book]
22
authors = ["sunrisepeak"]
3-
language = "en"
3+
language = "zh"
44
multilingual = false
55
src = "src"
66
title = "D2X Project Template | D2X项目模板"
77

8+
[build]
9+
build-dir = "book"
10+
811
[output.html]
912
git-repository-url = "https://github.com/d2learn/d2x-project-template"

book/build.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# script dir
4+
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
5+
6+
echo "[Top] - Building Chinese book..."
7+
cd "$SCRIPT_DIR"
8+
mdbook build
9+
10+
echo "[Sub - 1] - Building English book..."
11+
cd "$SCRIPT_DIR"
12+
cd en && mdbook build
13+
14+
echo "[imgs] - copy imgs to output directory..."
15+
cd "$SCRIPT_DIR"
16+
cp -r imgs book/
17+
18+
echo "Build completed."
19+
20+
#python -m http.server --directory book

book/en/book.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[book]
2+
authors = ["sunrisepeak"]
3+
language = "en"
4+
multilingual = false
5+
src = "src"
6+
title = "D2X Project Template | D2X项目模板"
7+
8+
[build]
9+
build-dir = "../book/en"
10+
11+
[output.html]
12+
git-repository-url = "https://github.com/d2learn/d2x-project-template"

book/en/src/SUMMARY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Summary
2+
3+
- [Introduction](./chapter_0.md)
4+
- [Tools and Environment](./chapter_1.md)
5+
- [Project Configuration and New Content](./chapter_2.md)
6+
- [Waiting for Your Extension](./chapter_3.md)

book/en/src/chapter_0.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div align=right>
2+
3+
🌎 [中文] | [English]
4+
</div>
5+
6+
[中文]: ../chapter_0.html
7+
[English]: ./chapter_0.html
8+
9+
# d2x-project-template
10+
11+
> d2x Interactive Tutorial Project Template - `Book + Video + Code + X`
12+
13+
[![d2x](https://img.shields.io/badge/d2x-ok-green.svg)](https://github.com/d2learn/d2x)
14+
[![online-ebook](https://img.shields.io/badge/online-ebook-orange.svg)](https://github.com/d2learn/d2x)
15+
[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE-CODE)
16+
17+
| [d2x Tool](https://github.com/d2learn/d2x) - [Forum](https://forum.d2learn.org) |
18+
| --- |
19+
| [Documentation](https://d2learn.github.io/d2x-project-template/en) -> [Tools and Environment](https://d2learn.github.io/d2x-project-template/en/chapter_1.html) -> [Project Configuration and New Content](https://d2learn.github.io/d2x-project-template/en/chapter_2.html) |
20+
21+
This project provides a basic structure for an **interactive tutorial project** that can be recognized and loaded by the [d2x](https://github.com/d2learn/d2x) tool. Developers and tutorial creators can design and develop their own interactive tutorial projects based on this template.
22+
23+
## Features
24+
25+
- Provides a basic structure of `Book + Video + Code + X`
26+
- The d2x tool can directly recognize and load it
27+
- Provides project dependency description, supporting one-click environment configuration
28+
29+
## Project Examples
30+
31+
| Project | Description | Remarks |
32+
| --- | --- | --- |
33+
| [d2mcpp](https://github.com/mcpp-community/d2mcpp) | Tutorial on Modern C++ Core Features | |
34+
| [d2ds](https://github.com/d2learn/d2ds) | Data Structure Learning Project with Emphasis on Hands-on Practice | |
35+
36+
## Others
37+
38+
- [d2x Tool](https://github.com/d2learn/d2x)
39+
- [Forum Communication and Feedback](https://forum.d2learn.org)
40+
- `Chat Group`: 167535744

book/en/src/chapter_1.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<div align=right>
2+
3+
🌎 [中文] | [English]
4+
</div>
5+
6+
[中文]: ../chapter_1.html
7+
[English]: ./chapter_1.html
8+
9+
# Tools Installation and Environment Configuration
10+
11+
This chapter introduces how to install the d2x tool, create a template project, and perform basic environment configuration.
12+
13+
## 1. Installing the d2x Tool
14+
15+
### Method 1: Installation via xlings Package Manager (Recommended)
16+
17+
[xlings](https://xlings.d2learn.org) is an open-source package manager that can solve inconsistent dependency issues across different environments.
18+
19+
<details>
20+
<summary>Click to view xlings installation command</summary>
21+
22+
---
23+
24+
#### Linux/MacOS
25+
26+
```bash
27+
curl -fsSL https://d2learn.org/xlings-install.sh | bash
28+
```
29+
30+
#### Windows - PowerShell
31+
32+
```bash
33+
irm https://d2learn.org/xlings-install.ps1.txt | iex
34+
```
35+
36+
> tips: xlings -> [details](https://xlings.d2learn.org)
37+
38+
---
39+
40+
</details>
41+
42+
```bash
43+
xlings install d2x
44+
```
45+
46+
### Method 2: Building from Source
47+
48+
TODO...
49+
50+
## 2. Creating a Project & Testing
51+
52+
### Creating a Project
53+
54+
**Create via Template (Recommended)**
55+
56+
Click the [Create New Tutorial Template](https://github.com/new?template_name=d2x-project-template&template_owner=d2learn) button to create a new tutorial project from the template repository. Then, clone the generated repository to your local machine.
57+
58+
```bash
59+
git clone git@github.com:your_name/your_repo_name.git
60+
```
61+
62+
**Local Creation**
63+
64+
Create a new project using the `d2x new xxx` command.
65+
66+
```bash
67+
d2x new d2hello
68+
```
69+
70+
After running the command, a directory named `d2hello` will be generated. Enter/open this directory to see the basic structure of the project.
71+
72+
### Testing
73+
74+
Enter the root directory of the newly created project and run commands to test completeness.
75+
76+
**Documentation Preview Command Test**
77+
78+
Running the following command will open the project's documentation/book in your browser.
79+
80+
```bash
81+
d2x book
82+
```
83+
84+
**Code Auto-Detection Function Test**
85+
86+
Running the checker command below will enter the real-time code detection mode in the console. When you modify the file code, the console will update automatically.
87+
88+
```bash
89+
d2x checker
90+
```

0 commit comments

Comments
 (0)