Skip to content

Commit 7c390b7

Browse files
committed
docs: update readme
1 parent f3e7528 commit 7c390b7

File tree

2 files changed

+60
-22
lines changed

2 files changed

+60
-22
lines changed

README.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ const App = () => {
683683
};
684684
```
685685

686-
> Need to install [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-antd) plugin
686+
> Need to install [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-antd) plugin
687687
688688
---
689689

@@ -972,14 +972,33 @@ Enum.install(antdPlugin, {
972972

973973
The following plugins are available. You can choose to install them based on your needs:
974974

975-
- [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-antd) - Ant Design oriented features, including `enum.toSelect`, `enum.toMenu`, `enum.toFilter`, and `enum.toValueMap`. With these methods, you can directly bind enums to the corresponding Ant Design components, greatly simplifying your code.
976-
- [@enum-plus/plugin-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next) - Integrates [i18next](https://www.i18next.com) to enable internationalization of enum labels.
977-
- [@enum-plus/plugin-react-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react-i18next) - Integrates [react-i18next](https://react.i18next.com) to enable internationalization of enum labels.
978-
- [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react) - React integration, including support for `Enum.localize` to return React components, and listening for language changes to auto update components.
979-
- [@enum-plus/plugin-i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue) - Integrates [i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue) to enable internationalization of enum labels and listen for language changes to auto update components.
980-
- [@enum-plus/plugin-vue-i18n](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-vue-i18n) - Integrates [vue-i18n](https://vue-i18n.intlify.dev) to enable internationalization of enum labels and listen for language changes to auto update components.
981-
- We are working on the following plugins:
982-
- [@enum-plus/plugin-angular](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-angular): Angular integration, including support for `Enum.localize` to return Angular components, and listening for language changes to auto update components. _We need your help to develop this plugin!_
975+
- [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-antd)
976+
977+
[Ant Design](https://ant.design) oriented features, including `enum.toSelect`, `enum.toMenu`, `enum.toFilter`, and `enum.toValueMap`. With these methods, you can directly bind enums to the corresponding Ant Design components, greatly simplifying your code.
978+
979+
- [@enum-plus/plugin-i18next](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-i18next)
980+
981+
Integrates [i18next](https://www.i18next.com) to enable internationalization of enum labels.
982+
983+
- [@enum-plus/plugin-react-i18next](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-react-i18next)
984+
985+
Integrates [react-i18next](https://react.i18next.com) to enable internationalization of enum labels.
986+
987+
- [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-react)
988+
989+
React integration, including support for `Enum.localize` to return React components, and listening for language changes to auto update components.
990+
991+
- [@enum-plus/plugin-i18next-vue](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-i18next-vue)
992+
993+
Integrates [i18next-vue](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-i18next-vue) to enable internationalization of enum labels and listen for language changes to auto update components.
994+
995+
- [@enum-plus/plugin-vue-i18n](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-vue-i18n)
996+
997+
Integrates [vue-i18n](https://vue-i18n.intlify.dev) to enable internationalization of enum labels and listen for language changes to auto update components.
998+
999+
We are working on the following plugins:
1000+
1001+
- [@enum-plus/plugin-angular](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-angular): Angular integration, including support for `Enum.localize` to return Angular components, and listening for language changes to auto update components. _We need your help to develop this plugin!_
9831002

9841003
> If the plugin you are searching for is not available, or if you want to develop your own plugin, please refer to the [Plugin Development Guide](./docs/plugin-development.md). You can develop new plugins in the official enum-plus repository or publish your developed plugins to npm and share your plugin links here. We sincerely need your help to enrich the plugin ecosystem!
9851004
@@ -1021,9 +1040,9 @@ WeekEnum.named.Monday.label; // Monday or 星期一, depending on the current lo
10211040
WeekEnum.name; // Week or 周, depending on the current locale
10221041
```
10231042

1024-
This plugin also supports custom i18next options, and even allows complete control over the `localize` method. Please refer to the [plugin documentation](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next#plugin-options) for more details.
1043+
This plugin also supports custom i18next options, and even allows complete control over the `localize` method. Please refer to the [plugin documentation](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-i18next#plugin-options) for more details.
10251044

1026-
If you need to automatically update the UI after switching languages, this requires the capabilities of frameworks like React, Vue, or Angular. Please consider using plugins such as [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react) or [@enum-plus/plugin-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-vue).
1045+
If you need to automatically update the UI after switching languages, this requires the capabilities of frameworks like React, Vue, or Angular. Please consider using plugins such as [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-react) or [@enum-plus/plugin-vue](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-vue).
10271046

10281047
If you are using other internationalization libraries, such as `react-intl`, `vue-i18next`, or `ngx-translate`, you can integrate these libraries by overwriting the `Enum.localize` method.
10291048

@@ -1038,7 +1057,7 @@ Enum.localize = (key) => {
10381057
};
10391058
```
10401059

1041-
> Once you have completed this feature, it is recommended that you consider publishing it as an npm package and share it in the [Awesome Plugins](#awesome-plugins) section, so that others can benefit from your work. If you believe that this project is very general, you can also consider submitting it to the official [enum-plus](https://github.com/shijistar/enum-plus/tree/main/packages) plugin repository. For specific development rules, please refer to the [Plugin Development Guide](./docs/plugin-development.md).
1060+
> Once you have completed this feature, it is recommended that you consider publishing it as an npm package and share it in the [Awesome Plugins](#awesome-plugins) section, so that others can benefit from your work. If you believe that this project is very general, you can also consider submitting it to the official [enum-plus](https://github.com/shijistar/enum-plus/tree/master/packages) plugin repository. For specific development rules, please refer to the [Plugin Development Guide](./docs/plugin-development.md).
10421061
10431062
---
10441063

@@ -1293,7 +1312,7 @@ Please use the `enum.key(value)` method to get the key name according to its val
12931312

12941313
### Why does the search function of the Ant Design Select stop working after enabling internationalization?
12951314

1296-
This is because `Enum.localize` returns a component instance instead of a regular string, causing Ant Design to fail in performing string matching correctly. Please use the `enum.isMatch` method to enable the search functionality. Please refer to [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react#dropdown-search) for more details.
1315+
This is because `Enum.localize` returns a component instance instead of a regular string, causing Ant Design to fail in performing string matching correctly. Please use the `enum.isMatch` method to enable the search functionality. Please refer to [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/master/packages/plugin-react#dropdown-search) for more details.
12971316

12981317
```bash
12991318
npm install @enum-plus/plugin-react
@@ -1337,7 +1356,7 @@ const WeekEnum = Enum(weekInit);
13371356

13381357
Yes, actually it wasn't easy from the beginning. The working principles of Jest and Playwright are quite different. Jest runs in a Node.js environment, while Playwright runs in a browser environment and then returns to the Node.js environment to execute assertions. To make them share a set of test code, we did the following:
13391358

1340-
1. **Environment Adaptation**: We wrote an [adaptation layer](https://github.com/shijistar/enum-plus/tree/main/test/engines/index.ts) to handle the differences between the two testing frameworks.
1359+
1. **Environment Adaptation**: We wrote an [adaptation layer](https://github.com/shijistar/enum-plus/tree/master/test/engines/index.ts) to handle the differences between the two testing frameworks.
13411360
2. **Abstract Testing Logic**: We abstracted the testing logic into some independent modules, so that these test suites can be reused in different testing frameworks.
13421361
3. **Enhanced Serialization Mechanism**: E2E tests require running in a browser environment and then passing the running results to the Node.js environment for assertions. To achieve this, we developed an [enhanced serialization library](https://github.com/shijistar/jsoneo). Since the `enum-plus` enums internally use types like `class`, `function`, `Symbol`, `Date`, and `RegExp`, built-in functions rewritten like `Symbol.toStringTag` and `Symbol.hasInstance`, and even including `Getter/Setter`, which are not serializable by `JSON.stringify`. We implemented support for these complex features through [jsoneo](https://github.com/shijistar/jsoneo). So complex objects can cross different environments through `serialization/deserialization` while retaining all dynamic behaviors. The transferred object remains "alive", just like the original object has not been serialized.
13431362

README.zh-CN.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -964,14 +964,33 @@ Enum.install(antdPlugin, {
964964

965965
目前我们已经开发并发布了以下插件,你可以根据需要选择安装:
966966

967-
- [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-antd) - Ant Design 相关功能,包括 `enum.toSelect``enum.toMenu``enum.toFilter``enum.toValueMap`。通过这些方法,可以直接将枚举绑定到对应的 Ant Design 组件上,极大地简化了代码。
968-
- [@enum-plus/plugin-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next) - 集成 [i18next](https://www.i18next.com) 并实现枚举标签的国际化。
969-
- [@enum-plus/plugin-react-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react-i18next) - 自动适配 [react-i18next](https://react.i18next.com) 以让枚举支持国际化。
970-
- [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react) - React 集成,包括支持 `Enum.localize` 返回 React 组件,以及监听语言变化以自动重新渲染组件。
971-
- [@enum-plus/plugin-i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue) - 集成 [i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue) 并实现枚举标签的国际化,支持切换语言后自动更新UI。
972-
- [@enum-plus/plugin-vue-i18n](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-vue-i18n) - 集成 [vue-i18n](https://vue-i18n.intlify.dev) 并实现枚举标签的国际化,支持切换语言后自动更新UI。
973-
- 我们正在开发以下插件:
974-
- [@enum-plus/plugin-angular](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-angular): Angular 集成,包括支持 `Enum.localize` 返回 Angular 组件,以及监听语言变化以自动重新渲染组件。_我们需要你的帮助来开发这个插件!_
967+
- [@enum-plus/plugin-antd](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-antd)
968+
969+
面向 [Ant Design](https://ant-design.antgroup.com) 的功能扩展,包括 `enum.toSelect``enum.toMenu``enum.toFilter``enum.toValueMap`。通过这些方法,可以直接将枚举绑定到对应的 Ant Design 组件上,极大地简化了代码。
970+
971+
- [@enum-plus/plugin-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next)
972+
973+
集成 [i18next](https://www.i18next.com) 并实现枚举标签的国际化。
974+
975+
- [@enum-plus/plugin-react-i18next](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react-i18next)
976+
977+
自动适配 [react-i18next](https://react.i18next.com) 以让枚举支持国际化。
978+
979+
- [@enum-plus/plugin-react](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-react)
980+
981+
React 集成,包括支持 `Enum.localize` 返回 React 组件,以及监听语言变化以自动重新渲染组件。
982+
983+
- [@enum-plus/plugin-i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue)
984+
985+
集成 [i18next-vue](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-i18next-vue) 并实现枚举标签的国际化,支持切换语言后自动更新UI。
986+
987+
- [@enum-plus/plugin-vue-i18n](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-vue-i18n)
988+
989+
集成 [vue-i18n](https://vue-i18n.intlify.dev) 并实现枚举标签的国际化,支持切换语言后自动更新UI。
990+
991+
我们正在开发以下插件:
992+
993+
- [@enum-plus/plugin-angular](https://github.com/shijistar/enum-plus/tree/main/packages/plugin-angular): Angular 集成,包括支持 `Enum.localize` 返回 Angular 组件,以及监听语言变化以自动重新渲染组件。_我们需要你的帮助来开发这个插件!_
975994

976995
> 如果你没有找到需要的插件,或者你想开发自己的插件,请参阅 [插件开发指南](./docs/plugin-development.zh-CN.md)。你可以在enum-plus官方仓库中开发新插件,也可以将你开发的插件发布到 npm 上,并把你的插件链接分享在这里。我们真诚地需要你的帮助,来丰富插件生态系统!
977996

0 commit comments

Comments
 (0)