chore: update i18n dialog

This commit is contained in:
Steven
2022-08-19 22:12:24 +08:00
parent dd04bc9e1d
commit a98e64cf0a
3 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { useAppSelector } from "../store"; import { useAppSelector } from "../store";
import toImage from "../labs/html2image"; import toImage from "../labs/html2image";
import useI18n from "../hooks/useI18n";
import useToggle from "../hooks/useToggle"; import useToggle from "../hooks/useToggle";
import { DAILY_TIMESTAMP } from "../helpers/consts"; import { DAILY_TIMESTAMP } from "../helpers/consts";
import * as utils from "../helpers/utils"; import * as utils from "../helpers/utils";
@ -19,6 +20,7 @@ const monthChineseStrArray = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "
const weekdayChineseStrArray = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; const weekdayChineseStrArray = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const DailyReviewDialog: React.FC<Props> = (props: Props) => { const DailyReviewDialog: React.FC<Props> = (props: Props) => {
const { t } = useI18n();
const memos = useAppSelector((state) => state.memo.memos); const memos = useAppSelector((state) => state.memo.memos);
const [currentDateStamp, setCurrentDateStamp] = useState(utils.getDateStampByDate(utils.getDateString(props.currentDateStamp))); const [currentDateStamp, setCurrentDateStamp] = useState(utils.getDateStampByDate(utils.getDateString(props.currentDateStamp)));
const [showDatePicker, toggleShowDatePicker] = useToggle(false); const [showDatePicker, toggleShowDatePicker] = useToggle(false);
@ -61,7 +63,7 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
<> <>
<div className="dialog-header-container"> <div className="dialog-header-container">
<p className="title-text" onClick={() => toggleShowDatePicker()}> <p className="title-text" onClick={() => toggleShowDatePicker()}>
<span className="icon-text">📅</span> Daily Review <span className="icon-text">📅</span> {t("sidebar.daily-review")}
</p> </p>
<div className="btns-container"> <div className="btns-container">
<button className="btn-text" onClick={() => setCurrentDateStamp(currentDateStamp - DAILY_TIMESTAMP)}> <button className="btn-text" onClick={() => setCurrentDateStamp(currentDateStamp - DAILY_TIMESTAMP)}>

View File

@ -1,5 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import * as utils from "../helpers/utils"; import * as utils from "../helpers/utils";
import useI18n from "../hooks/useI18n";
import useLoading from "../hooks/useLoading"; import useLoading from "../hooks/useLoading";
import { resourceService } from "../services"; import { resourceService } from "../services";
import Dropdown from "./common/Dropdown"; import Dropdown from "./common/Dropdown";
@ -18,6 +19,7 @@ interface State {
const ResourcesDialog: React.FC<Props> = (props: Props) => { const ResourcesDialog: React.FC<Props> = (props: Props) => {
const { destroy } = props; const { destroy } = props;
const { t } = useI18n();
const loadingState = useLoading(); const loadingState = useLoading();
const [state, setState] = useState<State>({ const [state, setState] = useState<State>({
resources: [], resources: [],
@ -99,7 +101,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
<div className="dialog-header-container"> <div className="dialog-header-container">
<p className="title-text"> <p className="title-text">
<span className="icon-text">🌄</span> <span className="icon-text">🌄</span>
Resources {t("sidebar.resources")}
</p> </p>
<button className="btn close-btn" onClick={destroy}> <button className="btn close-btn" onClick={destroy}>
<Icon.X className="icon-img" /> <Icon.X className="icon-img" />

View File

@ -33,7 +33,7 @@
}, },
"sidebar": { "sidebar": {
"daily-review": "每日回顾", "daily-review": "每日回顾",
"resources": "资源", "resources": "资源",
"setting": "设置", "setting": "设置",
"archived": "已归档" "archived": "已归档"
}, },