Skip to content

Commit

Permalink
[add] Unsafe Numeric detector
Browse files Browse the repository at this point in the history
[fix] 2 detail bugs
[migrate] move i18n utility functions to MobX-i18n
[optimize] update Upstream packages
  • Loading branch information
TechQuery committed Dec 16, 2022
1 parent d49605b commit c3c27e5
Show file tree
Hide file tree
Showing 8 changed files with 383 additions and 581 deletions.
44 changes: 2 additions & 42 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,48 +160,7 @@ serviceWorker?.addEventListener('controllerchange', () =>
### Internationalization
`source/i18n/en-US.ts`
```typescript
export enum en_US {
title = 'Title',
name = 'Name'
}
```
`source/i18n/zh-CN.ts`
```typescript
export enum zh_CN {
title = '标题',
name = '名称'
}
```
`source/index.tsx`
```javascript
import { render, createCell } from 'web-cell';
import { documentReady, bootI18n, textJoin } from 'web-utility';

import { en_US } from './i18n/en-US';
import { zh_CN } from './i18n/zh-CN';

console.log(
navigator.languages.includes('zh-CN'), // true
document.documentElement.lang // ''
);
const { language, words } = bootI18n({
'en-US': en_US,
'zh-CN': zh_CN
});
documentReady.then(() =>
render(
<h1>{textJoin(words.title, words.name, 'test', 'example')}</h1>
// <h1>标题名称 test example</h1>
);
);
```
Migrate to [MobX i18n][9] since v4.
### Test scripts
Expand Down Expand Up @@ -247,3 +206,4 @@ describe('My module', async () => {
[6]: https://mochajs.org/
[7]: https://jestjs.io/
[8]: https://typestrong.org/ts-node/
[9]: https://github.com/idea2app/MobX-i18n
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-utility",
"version": "3.9.9",
"version": "4.0.0",
"license": "LGPL-3.0",
"author": "[email protected]",
"description": "Web front-end toolkit based on TypeScript",
Expand All @@ -24,30 +24,30 @@
"main": "dist/index.js",
"module": "dist/index.esm.js",
"dependencies": {
"@swc/helpers": "^0.4.12",
"element-internals-polyfill": "^1.1.14",
"regenerator-runtime": "^0.13.10"
"@swc/helpers": "^0.4.14",
"element-internals-polyfill": "^1.1.17",
"regenerator-runtime": "^0.13.11"
},
"peerDependencies": {
"typescript": "^4.1.0"
},
"devDependencies": {
"@parcel/packager-ts": "~2.6.2",
"@parcel/transformer-typescript-types": "~2.6.2",
"@peculiar/webcrypto": "^1.4.0",
"@types/jest": "^29.1.2",
"@types/node": "^16.11.66",
"@webcomponents/webcomponentsjs": "^2.6.0",
"husky": "^8.0.1",
"@peculiar/webcrypto": "^1.4.1",
"@types/jest": "^29.2.4",
"@types/node": "^16.18.10",
"@webcomponents/webcomponentsjs": "^2.7.0",
"husky": "^8.0.2",
"intersection-observer": "^0.12.2",
"jest": "^29.2.0",
"jest-environment-jsdom": "^29.2.0",
"lint-staged": "^13.0.3",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"lint-staged": "^13.1.0",
"open-cli": "^7.1.0",
"parcel": "~2.6.2",
"prettier": "^2.7.1",
"prettier": "^2.8.1",
"ts-jest": "^29.0.3",
"typedoc": "^0.23.16",
"typedoc": "^0.23.22",
"typedoc-plugin-mdn-links": "^2.0.0",
"typescript": "~4.7.4"
},
Expand Down
Loading

0 comments on commit c3c27e5

Please sign in to comment.