Skip to content

Commit 4ae9587

Browse files
feat: ✨ 文档示例项目支持国际化切换 (#992)
1 parent dfaff53 commit 4ae9587

207 files changed

Lines changed: 24553 additions & 3017 deletions

File tree

Some content is hidden

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

.vscode/settings.json

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,96 @@
2323
"prettier.singleQuote": true,
2424
// #让函数(名)和后面的括号之间加个空格
2525
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
26-
// #这个按用户自身习惯选择
27-
"vetur.format.defaultFormatter.html": "js-beautify-html",
28-
// #让vue中的js按编辑器自带的ts格式进行格式化
29-
"vetur.format.defaultFormatter.js": "vscode-typescript",
30-
"vetur.format.options.tabSize": 2,
31-
"vetur.format.defaultFormatterOptions": {
32-
"js-beautify-html": {
33-
"wrap_line_length": 150,
34-
"wrap_attributes": true,
35-
"end_with_newline": true
36-
// #vue组件中html代码格式化样式
37-
}
38-
},
3926
"typescript.tsdk": "node_modules/typescript/lib",
27+
"i18n-ally.keystyle": "flat",
28+
"i18n-ally.sourceLanguage": "zh-CN",
29+
"i18n-ally.displayLanguage": "zh-CN",
30+
"i18n-ally.sortKeys": true,
31+
"i18n-ally.namespace": true,
32+
"i18n-ally.keepFulfilled": true,
33+
"i18n-ally.enabledParsers": [
34+
"ts",
35+
"js",
36+
"json"
37+
],
38+
"i18n-ally.enabledFrameworks": [
39+
"vue",
40+
"vue-sfc"
41+
],
42+
"i18n-ally.extract.autoDetect": true,
43+
"i18n-ally.refactor.templates": [
44+
{
45+
"source": "html-inline",
46+
"template": "{{ $t('{key}') }}" // 不带参数的情况
47+
},
48+
{
49+
"source": "html-inline-with-params", // 带参数的情况
50+
"template": "{{ $t('{key}', {injectionParameters}) }}"
51+
},
52+
{
53+
"source": "html-attribute",
54+
"template": "$t('{key}')",
55+
"include": [
56+
"value",
57+
"placeholder",
58+
"label",
59+
"title",
60+
"desc",
61+
"content",
62+
"text",
63+
"message"
64+
]
65+
},
66+
{
67+
"source": "js-string",
68+
"template": "t('{key}')"
69+
},
70+
{
71+
"source": "js-string-with-params",
72+
"template": "t('{key}', {injectionParameters})"
73+
},
74+
{
75+
"source": "js-template",
76+
"template": "t('{key}')"
77+
},
78+
{
79+
"source": "js-template-with-params", // 给js-template添加带参数的模板
80+
"template": "t('{key}', {injectionParameters})"
81+
}
82+
],
83+
"i18n-ally.keysInUse": [
84+
"zh-CN",
85+
"en-US"
86+
],
87+
"common-intellisense.ui": [],
4088
"i18n-ally.localesPaths": [
41-
"src/uni_modules/wot-design-uni/locale",
42-
"src/uni_modules/wot-design-uni/locale/lang"
89+
"src/locale"
4390
],
44-
"common-intellisense.ui": []
91+
"i18n-ally.extract.ignored": [
92+
"不如摸鱼去",
93+
"二狗",
94+
"<wd-icon name=\"${icon}\" size=\"22px\"></wd-icon>",
95+
"top left",
96+
"top right",
97+
"bottom left",
98+
"bottom left",
99+
"bottom right",
100+
"bottom right",
101+
"\n Wot Design Uni\n ",
102+
"\n Wot Design Uni\n ",
103+
"@{{ packageConfig.version }}",
104+
"span: 24",
105+
"span: 12",
106+
"span: 8",
107+
"span: 4",
108+
"span: 8 offset: 4",
109+
"span: 6",
110+
"芦叶满汀洲,寒沙带浅流。二十年重过南楼。柳下系船犹未稳,能几日,又中秋。黄鹤断矶头,故人曾到否?旧江山浑是新愁。欲买桂花同载酒,终不似,少年游。",
111+
"`${item}`"
112+
],
113+
"i18n-ally.extract.ignoredByFiles": {
114+
},
115+
"i18n-ally.translate.engines": [
116+
"baidu"
117+
]
45118
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
</p>
44
<h1 align="center">Wot Design Uni</h1>
55

6+
<div align="center">
7+
<p>简体中文 | <a href="./README_en.md">English</a></p>
8+
</div>
9+
610
<p align="center">📱 一个基于vue3+Typescript构建,参照<a href="https://github.com/jd-ftf/wot-design-mini?tab=readme-ov-file">wot-design</a>打造的uni-app组件库</p>
711

812
<p align="center">

README_en.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<p align="center">
2+
<img alt="logo" src="https://wot-design-uni.cn/logo.png" width="200">
3+
</p>
4+
<h1 align="center">Wot Design Uni</h1>
5+
6+
<div align="center">
7+
<p><a href="./README.md">简体中文</a> | English</p>
8+
</div>
9+
10+
<p align="center">📱 A uni-app component library built with Vue3 + TypeScript, inspired by <a href="https://github.com/jd-ftf/wot-design-mini?tab=readme-ov-file">wot-design</a></p>
11+
12+
<p align="center">
13+
14+
<a href="https://github.com/Moonofweisheng/wot-design-uni">
15+
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/Moonofweisheng/wot-design-uni?logo=github&color=%234d80f0&link=https%3A%2F%2Fgithub.com%2FMoonofweisheng%2Fwot-design-uni">
16+
</a>
17+
18+
<a href='https://gitee.com/wot-design-uni/wot-design-uni/stargazers'>
19+
<img src='https://gitee.com/wot-design-uni/wot-design-uni/badge/star.svg?theme=gray' alt='star'>
20+
</a>
21+
22+
<a href="https://www.npmjs.com/package/wot-design-uni">
23+
<img alt="npm" src="https://img.shields.io/npm/v/wot-design-uni?logo=npm&color=%234d80f0&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fwot-design-uni">
24+
</a>
25+
26+
<a href="https://www.npmjs.com/package/wot-design-uni">
27+
<img alt="npm" src="https://img.shields.io/npm/dw/wot-design-uni?logo=npm&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fwot-design-uni">
28+
</a>
29+
30+
<a href="https://www.npmjs.com/package/wot-design-uni">
31+
<img src="https://img.shields.io/npm/dt/wot-design-uni?style=flat-square">
32+
</a>
33+
34+
<a href="https://github.com/Moonofweisheng/wot-design-uni">
35+
<img alt="GitHub" src="https://img.shields.io/github/license/Moonofweisheng/wot-design-uni?logo=github">
36+
</a>
37+
38+
<a href="https://github.com/actions-cool/" target="_blank" referrerpolicy="no-referrer">
39+
<img src="https://img.shields.io/badge/using-actions--cool-red?style=flat-square" alt="actions-cool" />
40+
</a>
41+
42+
<a href="https://app.netlify.com/sites/wot-design-uni/deploys" target="_blank" referrerpolicy="no-referrer">
43+
<img src="https://api.netlify.com/api/v1/badges/0991d8a9-0fb0-483b-8961-5bde066bbd50/deploy-status" alt="deploy-status" />
44+
</a>
45+
46+
</p>
47+
48+
<p align="center">
49+
🚀 <a href="https://wot-design-uni.cn">Documentation (Recommended)</a>&nbsp;
50+
✈️ <a href="https://wot-design-uni.pages.dev/">Documentation (Cloudflare)</a>&nbsp;
51+
🔥 <a href="https://wot-design-uni.netlify.app/">Documentation (Netlify)</a>&nbsp;
52+
</p>
53+
54+
## ✨ Features
55+
56+
- 🎯 Multi-platform support: WeChat Mini Program, Alipay Mini Program, DingTalk Mini Program, H5, APP, etc.
57+
- 🚀 70+ high-quality components covering mainstream mobile scenarios.
58+
- 💪 Built with TypeScript, providing a robust component type system.
59+
- 🌍 Internationalization support with 15 built-in language packs.
60+
- 📖 Rich documentation and component examples.
61+
- 🎨 Theme customization through CSS variables.
62+
- 🍭 Dark mode support.
63+
64+
## 📱 Preview
65+
66+
Scan the QR code to view the demo. Note: Due to WeChat review restrictions, the current WeChat Mini Program demo may not be the latest version. You can clone the code locally for preview.
67+
68+
<p style="display:flex;gap:24px">
69+
<img src="https://wot-design-uni.cn/wx.jpg" width="200" height="200"/>
70+
<img src="https://wot-design-uni.cn/alipay.png" width="200" height="200" />
71+
<img src="https://wot-design-uni.cn/h5.png" width="200" height="200" />
72+
<img src="https://wot-design-uni.cn/android.png" width="200" height="200" />
73+
</p>
74+
75+
## Quick Start
76+
77+
For detailed instructions, see [Quick Start](https://wot-design-uni.cn/guide/quick-use.html).
78+
79+
## Links
80+
81+
- [FAQ](https://wot-design-uni.cn/guide/common-problems.html)
82+
- [Changelog](https://wot-design-uni.cn/guide/changelog.html)
83+
- [Discussions](https://github.com/Moonofweisheng/wot-design-uni/discussions)
84+
- [QQ Group](https://wot-design-uni.cn/guide/join-group.html)
85+
86+
## Showcase
87+
88+
Check out some excellent [examples](https://wot-design-uni.cn/guide/cases.html) here!
89+
90+
We welcome contributions of excellent demos and cases. Feel free to submit your case in this [issue](https://github.com/Moonofweisheng/wot-design-uni/issues/16).
91+
92+
## Contributing
93+
94+
Please read our [Contributing Guide](./.github/CONTRIBUTING.md) before making changes to the code.
95+
96+
If you encounter any issues, please feel free to submit an [Issue](https://github.com/Moonofweisheng/wot-design-uni/issues). We also welcome your [Pull Requests](https://github.com/Moonofweisheng/wot-design-uni/pulls).
97+
98+
## Contributors
99+
100+
Thanks to all the [developers](https://github.com/Moonofweisheng/wot-design-uni/graphs/contributors) who have contributed to Wot Design Uni.
101+
102+
<a href="https://github.com/Moonofweisheng/wot-design-uni/graphs/contributors">
103+
<img src="https://contrib.rocks/image?repo=Moonofweisheng/wot-design-uni" />
104+
</a>
105+
106+
## Donate
107+
108+
Developing a UI component library is time-consuming work, especially when it needs to be adapted for multiple platforms. The Wot Design Uni team often works late into the night...
109+
110+
If you find Wot Design Uni helpful in your development work, you can donate to support our development work. Any amount is welcome, even if it's just a cola.
111+
112+
After donating, your nickname and message will be displayed on the [donor list](https://wot-design-uni.cn/reward/donor.html).
113+
114+
### Afdian Donation
115+
116+
<a href="https://afdian.com/a/weisheng233">https://afdian.com/a/weisheng233</a>
117+
118+
### Scan to Donate
119+
120+
<p>
121+
<img src="https://wot-design-uni.cn/weixinQrcode.jpg" width="200" height="200" style="margin-right:30px"/>
122+
<img src="https://wot-design-uni.cn/alipayQrcode.jpg" width="200" height="200" />
123+
</p>
124+
125+
## Acknowledgments
126+
127+
- [wot-design](https://github.com/jd-ftf/wot-design-mini) - Thanks to the wot-design team for their years of maintenance.
128+
- [uni-helper](https://github.com/uni-helper) - Thanks to the uni-helper team for providing uni-app tool libraries.
129+
- [Donors](https://wot-design-uni.cn/reward/donor.html) - Thanks to all donors who help Wot Design Uni grow better.
130+
131+
## License
132+
133+
This project is licensed under the [MIT License](https://en.wikipedia.org/wiki/MIT_License). Feel free to enjoy and participate in open source.
134+
135+
[![Star History Chart](https://api.star-history.com/svg?repos=Moonofweisheng/wot-design-uni&type=Date)](https://star-history.com/#Moonofweisheng/wot-design-uni&Date)

docs/.vitepress/config.mts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2023-07-27 10:26:09
4-
* @LastEditTime: 2025-03-25 16:27:19
4+
* @LastEditTime: 2025-03-29 15:02:23
55
* @LastEditors: weisheng
66
* @Description:
77
* @FilePath: /wot-design-uni/docs/.vitepress/config.mts
@@ -10,8 +10,9 @@
1010
import { defineConfig } from 'vitepress';
1111
import viteCompression from 'vite-plugin-compression'
1212
import { fileURLToPath, URL } from 'node:url'
13-
1413
import { MarkdownTransform } from './plugins/markdown-transform'
14+
import enUS from './locales/en-US'
15+
import zhCN from './locales/zh-CN'
1516

1617

1718
export default defineConfig({
@@ -64,6 +65,18 @@ export default defineConfig({
6465
},
6566
title: `Wot Design Uni`,
6667
description: '一个参照wot-design打造的uni-app组件库',
68+
locales: {
69+
root: {
70+
label: '简体中文',
71+
lang: 'zh-CN',
72+
...zhCN
73+
},
74+
'en-US': {
75+
label: 'English',
76+
lang: 'en-US',
77+
...enUS,
78+
}
79+
},
6780
head: [
6881
['link', { rel: 'icon', href: '/favicon.ico' }],
6982
['link', { rel: 'stylesheet', href: '/petercatai/assistant.min.css' }],

0 commit comments

Comments
 (0)