Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cd652941
authored
Aug 21, 2024
by
Li Kui
Committed by
GitHub
Aug 21, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: switching language does not load the translation of the component correctly (#4205)
closes #4191
1 parent
fab92ee7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
11 deletions
apps/web-antd/src/locales/index.ts
apps/web-ele/src/locales/index.ts
apps/web-naive/src/locales/index.ts
packages/locales/src/i18n.ts
playground/src/locales/index.ts
apps/web-antd/src/locales/index.ts
View file @
cd65294
...
...
@@ -91,4 +91,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
});
}
export
{
$t
,
antdLocale
,
loadMessages
,
setupI18n
};
export
{
$t
,
antdLocale
,
setupI18n
};
apps/web-ele/src/locales/index.ts
View file @
cd65294
...
...
@@ -91,4 +91,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
});
}
export
{
$t
,
elementLocale
,
loadMessages
,
setupI18n
};
export
{
$t
,
elementLocale
,
setupI18n
};
apps/web-naive/src/locales/index.ts
View file @
cd65294
...
...
@@ -28,4 +28,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
});
}
export
{
$t
,
loadMessages
,
setupI18n
};
export
{
$t
,
setupI18n
};
packages/locales/src/i18n.ts
View file @
cd65294
...
...
@@ -10,8 +10,6 @@ import type {
import
{
type
App
,
unref
}
from
'vue'
;
import
{
createI18n
}
from
'vue-i18n'
;
const
loadedLanguages
=
new
Set
<
string
>
();
const
i18n
=
createI18n
({
globalInjection
:
true
,
legacy
:
false
,
...
...
@@ -78,10 +76,6 @@ async function loadLocaleMessages(lang: SupportedLanguagesType) {
return
setI18nLanguage
(
lang
);
}
if
(
loadedLanguages
.
has
(
lang
))
{
return
setI18nLanguage
(
lang
);
}
const
message
=
await
localesMap
[
lang
]?.();
if
(
message
?.
default
)
{
...
...
@@ -91,7 +85,6 @@ async function loadLocaleMessages(lang: SupportedLanguagesType) {
const
mergeMessage
=
await
loadMessages
(
lang
);
i18n
.
global
.
mergeLocaleMessage
(
lang
,
mergeMessage
);
loadedLanguages
.
add
(
lang
);
return
setI18nLanguage
(
lang
);
}
...
...
playground/src/locales/index.ts
View file @
cd65294
...
...
@@ -91,4 +91,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) {
});
}
export
{
$t
,
antdLocale
,
loadMessages
,
setupI18n
};
export
{
$t
,
antdLocale
,
setupI18n
};
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment