账户中心:完整简体中文,并修正“我的资源”和品牌标题。 Admin:浏览器标题跟随当前语言。 Email:页脚支持英文、简体中文、繁体中文;其他语言回退英文。 增加中英文 Storybook 验证场景。
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
/**
|
|
* 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} />;
|
|
}
|