Skip to content

Commit 947c509

Browse files
committed
code: add English support
1 parent 0c65a21 commit 947c509

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2432
-28
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ __pycache__
3737
# d2x project files
3838
.xlings
3939
.vscode
40+
.xmake
41+
.zed
4042
llm.config.xlings
4143
media
42-
44+
build

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
<em>D2X | Modern C++ Core Language Features - <b>"A C++ tutorial project focused on practical"</b></em>
1010

11-
<b> [Book] + [Video] + [Code] + [X] </b>
11+
<b> [📚Book] + [🎥Video] + [⌨️Code] + [👥X] </b>
1212
</div>
1313

1414
[中文]: README.zh.md
1515
[繁體中文]: README.zh.hant.md
1616
[English]: README.md
1717
[Todo]: README.md
1818

19-
[Book]: https://sunrisepeak.github.io/mcpp-standard
20-
[Video]: https://youtube.com/playlist?list=PL7uow6t1QjF0ooMLkLSS96swpSuBZvoRE
21-
[Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22-
[X]: https://forum.d2learn.org/category/20
19+
[📚Book]: https://sunrisepeak.github.io/mcpp-standard
20+
[🎥Video]: https://www.bilibili.com/video/BV182MtzPEiX
21+
[⌨️Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22+
[👥X]: https://forum.d2learn.org/category/20
2323

2424
## Goals
2525

README.zh.hant.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
<em>動手做 | 現代CPP核心語言特性 - <b>"強調動手實作的C++教學專案"</b></em>
1010

11-
<b> [Book] + [Video] + [Code] + [X] </b>
11+
<b> [📚Book] + [🎥Video] + [⌨️Code] + [👥X] </b>
1212
</div>
1313

1414
[中文]: README.zh.md
1515
[繁體中文]: README.zh.hant.md
1616
[English]: README.md
1717
[Todo]: README.md
1818

19-
[Book]: https://sunrisepeak.github.io/mcpp-standard
20-
[Video]: https://youtube.com/playlist?list=PL7uow6t1QjF0ooMLkLSS96swpSuBZvoRE
21-
[Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22-
[X]: https://forum.d2learn.org/category/20
19+
[📚Book]: https://sunrisepeak.github.io/mcpp-standard
20+
[🎥Video]: https://www.bilibili.com/video/BV182MtzPEiX
21+
[⌨️Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22+
[👥X]: https://forum.d2learn.org/category/20
2323

2424
## 目標
2525

@@ -95,4 +95,4 @@ d2x checker
9595
<img src="https://contrib.rocks/image?repo=Sunrisepeak/mcpp-standard" />
9696
</a>
9797

98-
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>
98+
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>

README.zh.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
<em>动手学 | 现代CPP核心语言特性 - <b>"强调动手实践的C++教程项目"</b></em>
1010

11-
<b> [Book] + [Video] + [Code] + [X] </b>
11+
<b> [📚Book] + [🎥Video] + [⌨️Code] + [👥X] </b>
1212
</div>
1313

1414
[中文]: README.zh.md
1515
[繁體中文]: README.zh.hant.md
1616
[English]: README.md
1717
[Todo]: README.md
1818

19-
[Book]: https://sunrisepeak.github.io/mcpp-standard
20-
[Video]: https://www.bilibili.com/video/BV182MtzPEiX
21-
[Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22-
[X]: https://forum.d2learn.org/category/20
19+
[📚Book]: https://sunrisepeak.github.io/mcpp-standard
20+
[🎥Video]: https://www.bilibili.com/video/BV182MtzPEiX
21+
[⌨️Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
22+
[👥X]: https://forum.d2learn.org/category/20
2323

2424
## 目标
2525

@@ -86,7 +86,7 @@ d2x checker
8686

8787
**📑开源协议与贡献许可(License & CLA)**
8888

89-
- 本项目欢迎自由使用与分发!你可以在 [Apache License 2.0](LICENSE-CODE)[CC-BY-NC-SA 4.0](LICENSE-BOOK) 协议下**免费**使用、修改和分享本项目的代码与文档内容
89+
- 本项目欢迎自由使用与分发!你可以在 [Apache License 2.0](LICENSE-CODE)[CC-BY-NC-SA 4.0](LICENSE-BOOK) 协议下**免费**使用、修改和分享本项目的代码与文档内容
9090
- 如希望参与贡献代码或文档,请先阅读[贡献者许可协议(CLA)](CLA.md)
9191

9292
**👥贡献者**
@@ -95,4 +95,4 @@ d2x checker
9595
<img src="https://contrib.rocks/image?repo=Sunrisepeak/mcpp-standard" />
9696
</a>
9797

98-
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>
98+
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>

book/en/book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# docs: https://rust-lang.github.io/mdBook
22
[book]
3-
title = "mcpp-standard | Dive into Modern C++ Core Language Features"
3+
title = "mcpp-standard | D2X - Modern C++ Core Language Features"
44
author = "sunrispeak"
55
language = "en"
66

book/en/src/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<div align=right>
2+
3+
👉 📚 [中文] | [English] | [Github]
4+
</div>
5+
6+
<div align=center>
7+
<img width="320" src="https://github.com/user-attachments/assets/dcc6bdea-71f8-4ed5-b445-6449c88655f3">
8+
9+
<em>D2X | Modern C++ Core Language Features - <b>"A C++ tutorial project focused on practical"</b></em>
10+
11+
<b> [📚Book] + [🎥Video] + [⌨️Code] + [👥X] </b>
12+
</div>
13+
14+
[中文]: ../
15+
[GITHUB]: https://github.com/Sunrisepeak/mcpp-standard
16+
[English]: ./
17+
18+
[📚Book]: https://sunrisepeak.github.io/mcpp-standard
19+
[🎥Video]: https://www.bilibili.com/video/BV182MtzPEiX
20+
[⌨️Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
21+
[👥X]: https://forum.d2learn.org/category/20
22+
23+
## Goals
24+
25+
- **`[Master]`** - **Core language features of Modern C++** and their usage scenarios
26+
- **`[Master]`** - The ability to **identify and debug issues** using compiler error messages
27+
- **`[Familiarize]`** - The ability to solve unfamiliar C++ problems using documentation and [cppreference](https://cppreference.com)
28+
- **`[Understand]`** - How to participate in the technical community — using open-source projects, asking questions, joining discussions, or contributing
29+
30+
## Quick Start
31+
32+
> Try `Code -> Book -> Video -> X -> Code`
33+
34+
### Interactive Code Practice (Online)
35+
36+
> [**click the button below**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=Sunrisepeak/mcpp-standard) to automatically complete the configuration in the cloud and enter the practice code detection mode
37+
38+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=Sunrisepeak/mcpp-standard)
39+
40+
### Interactive Code Practice (Local)
41+
42+
<details>
43+
<summary>click to view xlings installation command</summary>
44+
45+
---
46+
47+
#### Linux/MacOS
48+
49+
```bash
50+
curl -fsSL https://d2learn.org/xlings-install.sh | bash
51+
```
52+
53+
#### Windows - PowerShell
54+
55+
```bash
56+
irm https://d2learn.org/xlings-install.ps1.txt | iex
57+
```
58+
59+
> tips: xlings -> [details](https://xlings.d2learn.org)
60+
61+
---
62+
63+
</details>
64+
65+
```bash
66+
xlings install d2x:mcpp-standard
67+
cd mcpp-standard
68+
d2x checker
69+
```
70+
71+
**👉 [more details...](https://sunrisepeak.github.io/mcpp-standard/en/base/chapter_1.html)**
72+
73+
## Community
74+
75+
- **groups:** [mcpp forum](https://forum.d2learn.org/category/20)
76+
- [**forum:**](https://forum.d2learn.org/category/20) issues feedback, practice code, technical discussions
77+
- **community activities:** [📣 MSCP - mcpp project learning and contributor training program](https://moga.d2learn.org/activity/mscp/intro.html)
78+
79+
> **Note:** Complex issues (technical, environment setup, etc.) are recommended to be posted on the forum and detailed description of the problem can be more effective in problem solving and reuse.
80+
81+
## Contributing
82+
83+
- **Community Communication:** Report issues, participate in community discussions, and help new users solve problems.
84+
- **Project Maintenance and Development:** Participate in community issue resolution, bug fixes, multilingual support, [join the MSCP activity group](https://moga.d2learn.org/activity/mscp/docs/join-group.html), and develop and optimize new features and modules.
85+
86+
**📑License & CLA**
87+
88+
- This project welcomes free use and distribution! You may use, modify, and share the code and documentation in this project **free** under the [Apache License 2.0](LICENSE-CODE) and [CC-BY-NC-SA 4.0](LICENSE-BOOK) licenses.
89+
- If you would like to contribute code or documentation, please read the [Contributor License Agreement (CLA)](CLA.md) first.
90+
91+
**👥Contributors**
92+
93+
<a href="https://github.com/Sunrisepeak/mcpp-standard/graphs/contributors">
94+
<img src="https://contrib.rocks/image?repo=Sunrisepeak/mcpp-standard" />
95+
</a>
96+
97+
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>

book/en/src/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary
22

3-
- [Language Support - 中文 | English](./lang.md)
3+
- [README](./README.md)
44

55
# Getting Started
66

@@ -20,4 +20,4 @@
2020
# Additional Resources
2121

2222
- [Changelog](changelog.md)
23-
- [Frequently Asked Questions](fqa.md)
23+
- [Frequently Asked Questions](fqa.md)

book/src/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<div align=right>
2+
3+
👉 📚 [中文] | [English] | [Github]
4+
</div>
5+
6+
<div align=center>
7+
<img width="320" src="https://github.com/user-attachments/assets/dcc6bdea-71f8-4ed5-b445-6449c88655f3">
8+
9+
<em>动手学 | 现代CPP核心语言特性 - <b>"强调动手实践的C++教程项目"</b></em>
10+
11+
<b> [📚Book] + [🎥Video] + [⌨️Code] + [👥X] </b>
12+
</div>
13+
14+
[中文]: ./
15+
[Github]: https://github.com/Sunrisepeak/mcpp-standard
16+
[English]: ./en
17+
18+
[📚Book]: https://sunrisepeak.github.io/mcpp-standard
19+
[🎥Video]: https://www.bilibili.com/video/BV182MtzPEiX
20+
[⌨️Code]: https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings
21+
[👥X]: https://forum.d2learn.org/category/20
22+
23+
## 目标
24+
25+
- **`[掌握]`** - **现代C++核心的语言特性**及使用场景
26+
- **`[掌握]`** - 通过编译器报错信息**定位问题的能力**
27+
- **`[熟悉]`** - 通过文档和[cppreference](https://cppreference.com)解决C++中不熟悉问题的能力
28+
- **`[了解]`** - 如何参与技术社区 - 开源项目的使用、提问题、参与讨论或贡献
29+
30+
## 快速开始
31+
32+
### 在线代码练习
33+
34+
> [**点击下面按钮**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=Sunrisepeak/mcpp-standard) 即可在云端自动完成配置, 并进入练习代码检测模式
35+
36+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=Sunrisepeak/mcpp-standard)
37+
38+
### 搭建本地练习环境
39+
40+
> 尝试 `Code -> Book -> Video -> X -> Code`
41+
42+
<details>
43+
<summary>点击查看xlings安装命令</summary>
44+
45+
---
46+
47+
#### Linux/MacOS
48+
49+
```bash
50+
curl -fsSL https://d2learn.org/xlings-install.sh | bash
51+
```
52+
53+
#### Windows - PowerShell
54+
55+
```bash
56+
irm https://d2learn.org/xlings-install.ps1.txt | iex
57+
```
58+
59+
> 注: xlings工具 -> [详情](https://xlings.d2learn.org)
60+
61+
---
62+
63+
</details>
64+
65+
```bash
66+
xlings install d2x:mcpp-standard
67+
cd mcpp-standard
68+
d2x checker
69+
```
70+
71+
**👉 [更多细节...](https://sunrisepeak.github.io/mcpp-standard/base/chapter_1.html)**
72+
73+
## 社区
74+
75+
- **即时交流:** 167535744、1067245099
76+
- [**论坛版块:**](https://forum.d2learn.org/category/20) 问题反馈、练习代码、技术交流和讨论
77+
- **社区活动:** [📣 MSCP - mcpp项目学习与贡献者培养计划](https://moga.d2learn.org/activity/mscp/intro.html)
78+
79+
> **注:** 复杂性问题(技术、环境搭建等问题)推荐在论坛发帖, 并详细描述问题细节, 能更有效于问题的解决和复用
80+
81+
## 参与贡献
82+
83+
- **参与社区交流:** 反馈问题、参与社区问题讨论、帮助社区新用户解决问题
84+
- **参与项目维护和开发:** 参与社区中问题处理、修复Bug、多语言支持、[加入MSCP活动小组](https://moga.d2learn.org/activity/mscp/docs/join-group.html)、开发&优化新功能/模块
85+
86+
**📑开源协议与贡献许可(License & CLA)**
87+
88+
- 本项目欢迎自由使用与分发!你可以在 [Apache License 2.0](LICENSE-CODE)[CC-BY-NC-SA 4.0](LICENSE-BOOK) 协议下**免费**使用、修改和分享本项目的代码与文档内容
89+
- 如希望参与贡献代码或文档,请先阅读[贡献者许可协议(CLA)](CLA.md)
90+
91+
**👥贡献者**
92+
93+
<a href="https://github.com/Sunrisepeak/mcpp-standard/graphs/contributors">
94+
<img src="https://contrib.rocks/image?repo=Sunrisepeak/mcpp-standard" />
95+
</a>
96+
97+
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>

book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary
22

3-
- [语言支持 - 中文 | English](./lang.md)
3+
- [README](./README.md)
44

55
# 阅读准备
66

dslings/d2x/common.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function get_local_lang()
2+
--local config = platform.get_config_info()
3+
local local_lang = "en" -- Default language
4+
-- TODO: config language by xlings.json
5+
if is_host("linux") then
6+
local tmp_local_lang = os.getenv("LANG") or "en"
7+
if tmp_local_lang:find("zh") then
8+
local_lang = "zh"
9+
end
10+
elseif is_host("windows") then
11+
local tmp_local_lang = nil
12+
if find_tool("wmic") then -- Windows 10 and earlier
13+
-- wmic is deprecated in Windows 11, but still available
14+
tmp_local_lang = os.iorun([[wmic os get locale]])
15+
else -- win11+
16+
tmp_local_lang = os.iorun([[powershell -NoProfile -ExecutionPolicy Bypass -Command "'{0:X4}' -f (Get-Culture).LCID"]])
17+
end
18+
if tmp_local_lang and tmp_local_lang:find("0804") then
19+
local_lang = "zh"
20+
end
21+
elseif is_host("macosx") then
22+
local tmp_local_lang = os.iorun([[defaults read -g AppleLocale]])
23+
if tmp_local_lang and tmp_local_lang:find("zh") then
24+
local_lang = "zh"
25+
end
26+
end
27+
28+
return local_lang
29+
end

0 commit comments

Comments
 (0)