Skip to content

Commit b4d178f

Browse files
authored
[fix] [frontend] i18n options and redundant usage (#93)
* fix(prompt-components): missing vitest config * fix(i18n): add language for IntlClient * fix(i18n): options.detection
1 parent 1eb20fc commit b4d178f

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/packages/cozeloop/i18n/src/i18n.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ async function initIntl(options: IntlClientOptions = {}) {
2424
lookupCookie: 'i18next',
2525
lookupLocalStorage: 'i18next',
2626
caches: ['cookie'],
27+
...options.detection,
2728
},
2829
resources: {
2930
'zh-CN': {
@@ -36,8 +37,4 @@ async function initIntl(options: IntlClientOptions = {}) {
3637
});
3738
}
3839

39-
I18n.t('please_add');
40-
41-
I18n.t('Confirm');
42-
4340
export { I18n, initIntl };

frontend/packages/cozeloop/intl/src/intl-client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class IntlClient {
2222
return i18next.language;
2323
}
2424

25+
get language() {
26+
return i18next.language;
27+
}
28+
2529
async setLang(lng: string) {
2630
await i18next.changeLanguage(lng);
2731
}

frontend/packages/cozeloop/prompt-components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@coze-arch/bot-typings": "workspace:*",
4545
"@coze-arch/eslint-config": "workspace:*",
4646
"@coze-arch/ts-config": "workspace:*",
47+
"@coze-arch/vitest-config": "workspace:*",
4748
"@cozeloop/tailwind-config": "workspace:*",
4849
"@types/lodash-es": "^4.17.10",
4950
"@types/react": "18.2.37",

0 commit comments

Comments
 (0)