Skip to content

Commit

Permalink
fix: language kebab case
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Apr 7, 2023
1 parent 0620dc5 commit 7d6f96a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions playground/spa/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ function App() {
>
德文
</button>
<button
onClick={async () => {
await i18n.changeLanguage('zh-tw')
update()
}}
id='zh-tw'
>
繁体
</button>
</div>
)
}
Expand Down
3 changes: 3 additions & 0 deletions playground/spa/src/locale/zh-tw/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "繁体中文"
}
1 change: 1 addition & 0 deletions playground/spa/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ i18next
interpolation: {
escapeValue: false,
},
lowerCaseLng: true, // up to you
fallbackLng,
detection: {
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator'],
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function i18nDetector(options: I18nDetectorOptions) {
for (const k in modules) {
// Currently rollup don't support inline chunkName
// TODO: chunk name
code += `${k}: () => import('${VIRTUAL}-${k}'),`
code += `'${k}': () => import('${VIRTUAL}-${k}'),`
}
code += ' };'

Expand Down

0 comments on commit 7d6f96a

Please sign in to comment.