Skip to content

Commit c0e02d4

Browse files
committed
🌐 Handling i18n issues on popup pages #1081
1 parent 9002436 commit c0e02d4

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, { ReactNode } from "react";
2+
import { arcoLocale } from "@App/locales/arco";
3+
import i18n from "@App/locales/locales";
4+
import { ConfigProvider } from "@arco-design/web-react";
5+
6+
const PopupLayout: React.FC<{
7+
children: ReactNode;
8+
}> = ({ children }) => {
9+
return (
10+
<ConfigProvider locale={arcoLocale(i18n.language)}>
11+
<div
12+
style={{
13+
borderBottom: "1px solid var(--color-neutral-3)",
14+
}}
15+
>
16+
{children}
17+
</div>
18+
</ConfigProvider>
19+
);
20+
};
21+
22+
export default PopupLayout;

src/pages/popup/main.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { LoggerDAO } from "@App/app/repo/logger";
1515
import { switchLight } from "../components/layout/MainLayout";
1616
import App from "./App";
1717
import "@App/locales/locales";
18+
import PopupLayout from "../components/layout/PopupLayout";
1819

1920
migrate();
2021
// 初始化日志组件
@@ -37,11 +38,7 @@ IoC.registerInstance(SystemConfig, new SystemConfig(con));
3738
switchLight(localStorage.lightMode || "auto");
3839

3940
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
40-
<div
41-
style={{
42-
borderBottom: "1px solid var(--color-neutral-3)",
43-
}}
44-
>
41+
<PopupLayout>
4542
<App />
46-
</div>
43+
</PopupLayout>
4744
);

0 commit comments

Comments
 (0)