Skip to content

Commit

Permalink
feat: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Mar 24, 2023
1 parent 3186f40 commit 607f177
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 413 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Unawared DX
- **lazyload** locale resource
- Options like 'i18n-ally'

## Install

Expand All @@ -25,7 +26,9 @@ import { i18nDetector } from 'vite-plugin-i18n-detector'
export default defineConfig({
plugins: [
i18nDetector({
localeEntry: path.join(__dirname, './src/locale'),
localesPaths: [path.join(__dirname, './src/locale')],
pathMatcher: '{locale}/{namespaces}.{ext}',
enabledParsers: ['json', 'json5'],
}),
],
})
Expand Down Expand Up @@ -107,10 +110,10 @@ function App() {
{
"i18n-ally.localesPaths": ["src/locale"],
"i18n-ally.keystyle": "flat",
"i18n-ally.enabledParsers": ["json"],
"i18n-ally.enabledParsers": ["json", "json5"],
"i18n-ally.enabledFrameworks": ["react", "i18next"],
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
"i18n-ally.pathMatcher": "{locale}/{namespaces}.{ext}",
"i18n-ally.sourceLanguage": "en"
}
```
Expand Down
65 changes: 0 additions & 65 deletions __test__/utils.test.ts

This file was deleted.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,16 @@
"vite": ">=4.0.0"
},
"dependencies": {
"@minko-fe/lodash-pro": "^0.0.63",
"clone-deep": "^4.0.1",
"debug": "^4.3.4",
"depth": "^0.1.1",
"fast-glob": "^3.2.12",
"fs-extra": "^11.1.1",
"json5": "^2.2.3",
"jsonc-simple-parser": "^3.0.0",
"parse-glob": "^3.0.4",
"pathe": "^1.1.0",
"picocolors": "^1.0.0",
"query-string": "^8.1.0",
"strip-dirs": "^3.0.0",
"tiny-glob": "^0.2.9"
"string.prototype.trimend": "^1.0.6",
"uniq": "^1.0.1"
},
"devDependencies": {
"@minko-fe/eslint-config": "1.2.32",
Expand Down
2 changes: 1 addition & 1 deletion playground/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"dev": "cross-env DEBUG=vite-plugin-i18n* vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
Expand Down
9 changes: 1 addition & 8 deletions playground/spa/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ function App() {
>
德文
</button>
<div>
<a href='https://vitejs.dev' target='_blank' rel='noreferrer'>
<img src={viteLogo} className='logo' alt='Vite logo' />
</a>
<a href='https://reactjs.org' target='_blank' rel='noreferrer'>
<img src={reactLogo} className='logo react' alt='React logo' />
</a>
</div>

<h1>Vite + React</h1>
<div className='card'>
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
Expand Down
3 changes: 0 additions & 3 deletions playground/spa/src/locale/de/d.ts

This file was deleted.

1 change: 0 additions & 1 deletion playground/spa/src/locale/de/de.json

This file was deleted.

7 changes: 7 additions & 0 deletions playground/spa/src/locale/de/more.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mo": {
"fdsa": {
"ff": "fdasf"
}
}
}
3 changes: 1 addition & 2 deletions playground/spa/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ export default defineConfig({
plugins: [
react(),
i18nDetector({
include: path.join(__dirname, './src/locale'),
localesPaths: [path.join(__dirname, './src/locale')],
pathMatcher: '{locale}/{namespaces}.{ext}',
pathMatcher: '{locale}/{namespace}',
enabledParsers: ['json', 'json5'],
}),
],
Expand Down
Loading

0 comments on commit 607f177

Please sign in to comment.