fix(share): The language of the shared page will cause the language of the original website to change. (#18043)

This commit is contained in:
chanx
2026-08-10 17:26:18 +08:00
committed by GitHub
parent d6292da508
commit 5a2cd36b45
8 changed files with 44 additions and 47 deletions

View File

@@ -97,7 +97,11 @@ export const loadLanguageAsync = async (lng: string): Promise<void> => {
}
};
export const changeLanguageAsync = async (lng: string): Promise<void> => {
export const changeLanguageAsync = async (
lng: string,
options: { persist?: boolean } = {},
): Promise<void> => {
const { persist = true } = options;
const normalizedLng = lng;
if (
@@ -107,7 +111,9 @@ export const changeLanguageAsync = async (lng: string): Promise<void> => {
await loadLanguageAsync(normalizedLng);
}
storage.setLanguage(lng);
if (persist) {
storage.setLanguage(lng);
}
updateDocumentLocale(lng);