登录页:英文、简体中文、繁体中文主题文案。
账户中心:完整简体中文,并修正“我的资源”和品牌标题。 Admin:浏览器标题跟随当前语言。 Email:页脚支持英文、简体中文、繁体中文;其他语言回退英文。 增加中英文 Storybook 验证场景。
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* This file has been claimed for ownership from @keycloakify/keycloak-admin-ui version 260700.0.2.
|
||||
* To relinquish ownership and restore this file to its original content, run the following command:
|
||||
*
|
||||
* $ npx keycloakify own --path "admin/KcAdminUi.tsx" --revert
|
||||
*/
|
||||
|
||||
import "@patternfly/patternfly/patternfly-addons.css";
|
||||
import "@patternfly/react-core/dist/styles/base.css";
|
||||
import { useEffect, useReducer } from "react";
|
||||
import { startColorSchemeManagement } from "./colorScheme";
|
||||
import { createHashRouter, RouterProvider } from "react-router-dom";
|
||||
import { i18n } from "./i18n/i18n";
|
||||
import { Root } from "./Root";
|
||||
import { routes } from "./routes";
|
||||
|
||||
import "./index.css";
|
||||
|
||||
const router = createHashRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Root />,
|
||||
children: routes
|
||||
}
|
||||
]);
|
||||
const prI18nInitialized = i18n.init();
|
||||
startColorSchemeManagement();
|
||||
|
||||
export default function KcAdminUi() {
|
||||
const [isI18nInitialized, setI18nInitialized] = useReducer(() => true, false);
|
||||
|
||||
useEffect(() => {
|
||||
prI18nInitialized.then(() => setI18nInitialized());
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isI18nInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const updateDocumentTitle = () => {
|
||||
document.title = i18n.t("nexusAdminConsoleTitle");
|
||||
};
|
||||
|
||||
updateDocumentTitle();
|
||||
i18n.on("languageChanged", updateDocumentTitle);
|
||||
|
||||
return () => {
|
||||
i18n.off("languageChanged", updateDocumentTitle);
|
||||
};
|
||||
}, [isI18nInitialized]);
|
||||
|
||||
if (!isI18nInitialized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <RouterProvider router={router} />;
|
||||
}
|
||||
Reference in New Issue
Block a user