From 9f7ae450ded8b1adee386bd4971298d6b31d6f67 Mon Sep 17 00:00:00 2001 From: hexxa Date: Mon, 27 Sep 2021 13:57:37 +0800 Subject: [PATCH] fix(panes): make pane title i18n --- src/client/web/src/components/panes.tsx | 41 +++++++++++++++---------- src/client/web/src/i18n/en_US.ts | 7 +++-- src/client/web/src/i18n/zh_CN.ts | 3 ++ 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/client/web/src/components/panes.tsx b/src/client/web/src/components/panes.tsx index c80c5d4..1c561c0 100644 --- a/src/client/web/src/components/panes.tsx +++ b/src/client/web/src/components/panes.tsx @@ -1,8 +1,8 @@ import * as React from "react"; -import { Set, Map } from "immutable"; +import { Set, List } from "immutable"; import { updater } from "./state_updater"; -import { roleAdmin, roleUser, roleVisitor } from "../client"; +import { Flexbox } from "./layout/flexbox"; import { ICoreState, MsgProps } from "./core_state"; import { PaneSettings } from "./pane_settings"; import { AdminPane, AdminProps } from "./pane_admin"; @@ -20,7 +20,7 @@ export interface Props { update?: (updater: (prevState: ICoreState) => ICoreState) => void; } -export interface State { } +export interface State {} export class Panes extends React.Component { constructor(p: Props) { super(p); @@ -34,29 +34,39 @@ export class Panes extends React.Component { }; render() { - let displaying = this.props.panes.displaying; + const displaying = this.props.panes.displaying; + const title = this.props.msg.pkg.get(`pane.${this.props.panes.displaying}`); const btnClass = displaying === "login" ? "hidden" : ""; - const showSettings = this.props.panes.paneNames.get("settings") && displaying === "settings" ? "" : "hidden"; - const showLogin = this.props.panes.paneNames.get("login") && displaying === "login" ? "" : "hidden"; - const showAdmin = this.props.panes.paneNames.get("admin") && displaying === "admin" ? "" : "hidden"; + const showSettings = + this.props.panes.paneNames.get("settings") && displaying === "settings" + ? "" + : "hidden"; + const showLogin = + this.props.panes.paneNames.get("login") && displaying === "login" + ? "" + : "hidden"; + const showAdmin = + this.props.panes.paneNames.get("admin") && displaying === "admin" + ? "" + : "hidden"; return (
-
-

{displaying}

- -
+ {title}, -
- -
+ , + ])} + className="padding-l" + childrenStyles={List([{}, { justifyContent: "flex-end" }])} + />
@@ -82,7 +92,6 @@ export class Panes extends React.Component { update={this.props.update} />
-
); diff --git a/src/client/web/src/i18n/en_US.ts b/src/client/web/src/i18n/en_US.ts index 1b96267..a41c514 100644 --- a/src/client/web/src/i18n/en_US.ts +++ b/src/client/web/src/i18n/en_US.ts @@ -74,7 +74,10 @@ export const msgs: Map = Map({ "share.404.desc": "You can share a folder in the items tab", "upload.404.title": "No uploading is in the progress", "upload.404.desc": "You can upload a file in the items tab", - "detail": "Detail", - "refresh": "Refresh", + detail: "Detail", + refresh: "Refresh", "refresh-hint": "Please refresh later to see the result", + "pane.login": "Login", + "pane.admin": "Administration", + "pane.settings": "Settings", }); diff --git a/src/client/web/src/i18n/zh_CN.ts b/src/client/web/src/i18n/zh_CN.ts index 22b0a35..9f2c2a5 100644 --- a/src/client/web/src/i18n/zh_CN.ts +++ b/src/client/web/src/i18n/zh_CN.ts @@ -75,4 +75,7 @@ export const msgs: Map = Map({ "detail": "详细", "refresh": "刷新", "refresh-hint": "请稍后刷新查看结果", + "pane.login": "登入", + "pane.admin": "管理", + "pane.settings": "设置", });