Skip to content

Commit

Permalink
fix(i18n): i18n fixes (#1312)
Browse files Browse the repository at this point in the history
* fix(i18n): forget some i18n

* fix(classroom): language will be reset upon enter classroom (#1314)

* refactor(i18n): improve i18n
  • Loading branch information
BlackHole1 authored Jan 19, 2022
1 parent 3756edd commit 198e065
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const AppStoreButton = observer<AppStoreButtonProps>(function AppStoreBut
<>
<TopBarRightBtn
icon={<img src={appStoreSVG} />}
title="Open App Store"
title={t("app-store")}
onClick={() => setAppStoreIsVisible(true)}
/>
<Modal
Expand Down
2 changes: 1 addition & 1 deletion desktop/renderer-app/src/components/CloudStorageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CloudStorageButton = observer<CloudStorageButtonProps>(function Clo
<>
<TopBarRightBtn
icon={<img src={cloudStorageSVG} />}
title="Open Cloud Storage"
title={t("cloud-storage")}
onClick={showModal}
/>
<Modal
Expand Down
4 changes: 3 additions & 1 deletion desktop/renderer-app/src/components/InviteButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import { TopBarRightBtn } from "flat-components";
import { RoomItem } from "../stores/room-store";
import { InviteModal } from "./Modal/InviteModal";
import inviteSVG from "../assets/image/invite.svg";
import { useTranslation } from "react-i18next";

export interface InviteButtonProps {
roomInfo?: RoomItem;
}

export const InviteButton = observer<InviteButtonProps>(function InviteButton({ roomInfo }) {
const { t } = useTranslation();
const [isShowInviteModal, showInviteModal] = useState(false);
const hideInviteModal = (): void => showInviteModal(false);
return (
<div>
<TopBarRightBtn
icon={<img src={inviteSVG} />}
title="Invite"
title={t("invitation")}
onClick={() => showInviteModal(true)}
/>
{roomInfo && (
Expand Down
6 changes: 3 additions & 3 deletions desktop/renderer-app/src/pages/BigClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<img src={shareScreenSVG} />
)
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -281,7 +281,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon={<img src={exitSVG} />}
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
Expand All @@ -293,7 +293,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<img src={hideSideSVG} />
)
}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={handleSideOpenerSwitch}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export const MainRoomList = observer<MainRoomListProps>(function MainRoomList({
});
}
if (room.roomUUID) {
result.push({ key: "invite", text: t("copy-invitation") });
result.push({ key: "invite", text: t("invitation") });
}
}
return result as SubActions;
Expand Down
6 changes: 3 additions & 3 deletions desktop/renderer-app/src/pages/OneToOnePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
<img src={shareScreenSVG} />
)
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -239,7 +239,7 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon={<img src={exitSVG} />}
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
Expand All @@ -251,7 +251,7 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
<img src={hideSideSVG} />
)
}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={handleSideOpenerSwitch}
/>
</>
Expand Down
6 changes: 3 additions & 3 deletions desktop/renderer-app/src/pages/SmallClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
<img src={shareScreenSVG} />
)
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -306,7 +306,7 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon={<img src={exitSVG} />}
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
Expand All @@ -318,7 +318,7 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
<img src={hideSideSVG} />
)
}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={() => openRealtimeSide(isRealtimeSideOpen => !isRealtimeSideOpen)}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { observer } from "mobx-react-lite";
import React from "react";
import RecordIdleSVG from "./icons/record-idle.svg";
import RecordStartedSVG from "./icons/record-started.svg";
import { useTranslation } from "react-i18next";

export type CloudRecordBtnProps = {
isRecording: boolean;
Expand All @@ -11,9 +12,12 @@ export type CloudRecordBtnProps = {

export const CloudRecordBtn: React.FC<CloudRecordBtnProps> = observer(
({ isRecording, onClick }) => {
const { t } = useTranslation();

return (
<TopBarRightBtn
icon={<img src={isRecording ? RecordStartedSVG : RecordIdleSVG} />}
title={t("recording")}
onClick={onClick}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import raiseHandActiveSVG from "./icons/raise-hand-active.svg";
import "./style.less";

import React from "react";
import { useTranslation } from "react-i18next";

export interface RaiseHandProps {
isRaiseHand?: boolean;
Expand All @@ -15,8 +16,10 @@ export const RaiseHand: React.FC<RaiseHandProps> = ({
disableHandRaising,
onRaiseHandChange,
}) => {
const { t } = useTranslation();

return disableHandRaising ? null : (
<button className="raise-hand-btn" title="举手" onClick={onRaiseHandChange}>
<button className="raise-hand-btn" title={t("raise-your-hand")} onClick={onRaiseHandChange}>
<img src={isRaiseHand ? raiseHandActiveSVG : raiseHandSVG} />
</button>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const MoreMenu: React.FC<MoreMenuProps> = ({
</>
)}
<Menu.Item onClick={() => setInviteRoomVisible(true)}>
{t("copy-invitation")}
{t("invitation")}
</Menu.Item>
<CancelSubPeriodicRoomModal
isCreator={isCreator}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const RoomDetailFooter = observer<RoomDetailFooterProps>(function RoomDet
</Button>
)}
<Button className="room-detail-footer-btn" onClick={() => setIsShowInviteModal(true)}>
{t("copy-invitation")}
{t("invitation")}
</Button>
<Button className="room-detail-footer-btn" type="primary" onClick={onJoinRoom}>
{isCreator && room.roomStatus === RoomStatus.Idle ? t("begin") : t("join-room")}
Expand Down
13 changes: 10 additions & 3 deletions packages/flat-i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"room-type": "Room Type",
"think-again": "Think again",
"cancel-general-room-tips": "Are you sure to cancel this room? \nAfter cancellation, other members will not be able to join.",
"copy-invitation": "Invite",
"invitation": "Invite",
"join-room": "Join room",
"modify-room": "Modify",
"copy-success": "Copy successfully",
Expand Down Expand Up @@ -364,7 +364,8 @@
"choose-share-content": "Choose what to share",
"tip-window-title": "Ending screen sharing",
"tip-window-body": "You are sharing the current screen",
"tip-window-button": "End Sharing"
"tip-window-button": "End Sharing",
"self": "Share Screen"
},
"app-store": "AppStore(Beta)",
"recently-used": "Recently Used",
Expand All @@ -390,6 +391,12 @@
"user-guide-button": "Check it out now",
"start-recording": "Start recording",
"stop-recording": "Stop recording",
"recording": "Recording",
"open-in-browser": "Open in Browser",
"room-started": "Started: "
"room-started": "Started:",
"exit": "Exit",
"side-panel": {
"hide": "Hide",
"show": "Show"
}
}
13 changes: 10 additions & 3 deletions packages/flat-i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"remove-room": "移除房间",
"cancel-room": "取消房间",
"modify-room": "修改房间",
"copy-invitation": "复制邀请",
"invitation": "邀请",
"join-room": "加入房间",
"copy-success": "复制成功",
"copy-fail": "复制失败,请确保已允许相关权限",
Expand Down Expand Up @@ -364,7 +364,8 @@
"choose-share-content": "选择共享内容",
"tip-window-title": "结束屏幕共享",
"tip-window-body": "正在共享屏幕",
"tip-window-button": "结束共享"
"tip-window-button": "结束共享",
"self": "屏幕分享"
},
"app-store": "应用中心(测试版)",
"recently-used": "最近使用",
Expand All @@ -390,6 +391,12 @@
"user-guide-button": "立即查看",
"start-recording": "开始录制",
"stop-recording": "停止录制",
"recording": "录制",
"open-in-browser": "请在浏览器中打开",
"room-started": "已上课:"
"room-started": "已上课:",
"exit": "退出",
"side-panel": {
"hide": "折叠",
"show": "展开"
}
}
2 changes: 1 addition & 1 deletion web/flat-web/src/components/AppStoreButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const AppStoreButton = observer<AppStoreButtonProps>(function AppStoreBut
<>
<TopBarRightBtn
icon={<img src={appStoreSVG} />}
title="Open App Store"
title={t("app-store")}
onClick={() => setAppStoreIsVisible(true)}
/>
<Modal
Expand Down
2 changes: 1 addition & 1 deletion web/flat-web/src/components/CloudStorageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CloudStorageButton = observer<CloudStorageButtonProps>(function Clo
<>
<TopBarRightBtn
icon={<img src={cloudStorageSVG} />}
title="Open Cloud Storage"
title={t("cloud-storage")}
onClick={showModal}
/>
<Modal
Expand Down
4 changes: 3 additions & 1 deletion web/flat-web/src/components/InviteButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ import { observer } from "mobx-react-lite";
import { RoomItem } from "../stores/room-store";
import { InviteModal } from "./Modal/InviteModal";
import { TopBarRightBtn } from "flat-components";
import { useTranslation } from "react-i18next";

export interface InviteButtonProps {
roomInfo?: RoomItem;
}

export const InviteButton = observer<InviteButtonProps>(function InviteButton({ roomInfo }) {
const { t } = useTranslation();
const [isShowInviteModal, showInviteModal] = useState(false);
const hideInviteModal = (): void => showInviteModal(false);
return (
<div>
<TopBarRightBtn
icon={<img src={inviteSVG} />}
title="Invite"
title={t("invitation")}
onClick={() => showInviteModal(true)}
/>
{roomInfo && (
Expand Down
6 changes: 3 additions & 3 deletions web/flat-web/src/pages/BigClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
? "share-screen-active"
: "share-screen"
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -253,13 +253,13 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon="exit"
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
<TopBarRightBtn
icon={isRealtimeSideOpen ? "hide-side" : "hide-side-active"}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={handleSideOpenerSwitch}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export const MainRoomList = observer<MainRoomListProps>(function MainRoomList({
});
}
if (room.roomUUID) {
result.push({ key: "invite", text: t("copy-invitation") });
result.push({ key: "invite", text: t("invitation") });
}
}
return result as SubActions;
Expand Down
6 changes: 3 additions & 3 deletions web/flat-web/src/pages/OneToOnePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
? "share-screen-active"
: "share-screen"
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -213,13 +213,13 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon="exit"
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
<TopBarRightBtn
icon={isRealtimeSideOpen ? "hide-side" : "hide-side-active"}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={handleSideOpenerSwitch}
/>
</>
Expand Down
6 changes: 3 additions & 3 deletions web/flat-web/src/pages/SmallClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
? "share-screen-active"
: "share-screen"
}
title="Share Screen"
title={t("share-screen.self")}
onClick={handleShareScreen}
/>
)}
Expand All @@ -284,13 +284,13 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
<InviteButton roomInfo={classRoomStore.roomInfo} />
<TopBarRightBtn
icon="exit"
title="Exit"
title={t("exit")}
onClick={() => confirm(ExitRoomConfirmType.ExitButton)}
/>
<TopBarDivider />
<TopBarRightBtn
icon={isRealtimeSideOpen ? "hide-side" : "hide-side-active"}
title={isRealtimeSideOpen ? "hide side panel" : "show side panel"}
title={isRealtimeSideOpen ? t("side-panel.hide") : t("side-panel.show")}
onClick={() => {
openRealtimeSide(isRealtimeSideOpen => !isRealtimeSideOpen);
whiteboardStore.setRightSideClose(isRealtimeSideOpen);
Expand Down

0 comments on commit 198e065

Please sign in to comment.