mirror of
https://github.com/usememos/memos.git
synced 2025-02-22 14:17:48 +01:00
chore: update i18n (#212)
* feat: 增加部分 i18n * feat: 增加部分 i18n * feat: 增加部分 i18n
This commit is contained in:
parent
707d1a96eb
commit
7079faf2b9
@ -6,6 +6,7 @@ import Icon from "./Icon";
|
|||||||
import { generateDialog } from "./Dialog";
|
import { generateDialog } from "./Dialog";
|
||||||
import toastHelper from "./Toast";
|
import toastHelper from "./Toast";
|
||||||
import Selector from "./common/Selector";
|
import Selector from "./common/Selector";
|
||||||
|
import useI18n from "../hooks/useI18n";
|
||||||
import "../less/create-shortcut-dialog.less";
|
import "../less/create-shortcut-dialog.less";
|
||||||
|
|
||||||
interface Props extends DialogProps {
|
interface Props extends DialogProps {
|
||||||
@ -18,6 +19,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
|
|||||||
const [title, setTitle] = useState<string>("");
|
const [title, setTitle] = useState<string>("");
|
||||||
const [filters, setFilters] = useState<Filter[]>([]);
|
const [filters, setFilters] = useState<Filter[]>([]);
|
||||||
const requestState = useLoading(false);
|
const requestState = useLoading(false);
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const shownMemoLength = memoService.getState().memos.filter((memo) => {
|
const shownMemoLength = memoService.getState().memos.filter((memo) => {
|
||||||
return checkShouldShowMemoWithFilters(memo, filters);
|
return checkShouldShowMemoWithFilters(memo, filters);
|
||||||
@ -99,7 +101,7 @@ const CreateShortcutDialog: 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>
|
||||||
{shortcutId ? "Edit Shortcut" : "Create Shortcut"}
|
{shortcutId ? t("common.edit-shortcut") : t("common.create-shortcut")}
|
||||||
</p>
|
</p>
|
||||||
<button className="btn close-btn" onClick={destroy}>
|
<button className="btn close-btn" onClick={destroy}>
|
||||||
<Icon.X />
|
<Icon.X />
|
||||||
@ -107,11 +109,11 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="dialog-content-container">
|
<div className="dialog-content-container">
|
||||||
<div className="form-item-container input-form-container">
|
<div className="form-item-container input-form-container">
|
||||||
<span className="normal-text">Title</span>
|
<span className="normal-text">{t("common.title")}</span>
|
||||||
<input className="title-input" type="text" placeholder="shortcut title" value={title} onChange={handleTitleInputChange} />
|
<input className="title-input" type="text" placeholder="shortcut title" value={title} onChange={handleTitleInputChange} />
|
||||||
</div>
|
</div>
|
||||||
<div className="form-item-container filter-form-container">
|
<div className="form-item-container filter-form-container">
|
||||||
<span className="normal-text">Filters</span>
|
<span className="normal-text">{t("common.filters")}</span>
|
||||||
<div className="filters-wrapper">
|
<div className="filters-wrapper">
|
||||||
{filters.map((f, index) => {
|
{filters.map((f, index) => {
|
||||||
return (
|
return (
|
||||||
@ -125,7 +127,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<div className="create-filter-btn" onClick={handleAddFilterBenClick}>
|
<div className="create-filter-btn" onClick={handleAddFilterBenClick}>
|
||||||
New Filter
|
{t("common.new-filter")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -134,10 +136,10 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
|
|||||||
<div></div>
|
<div></div>
|
||||||
<div className="btns-container">
|
<div className="btns-container">
|
||||||
<span className={`tip-text ${filters.length === 0 && "hidden"}`}>
|
<span className={`tip-text ${filters.length === 0 && "hidden"}`}>
|
||||||
<strong>{shownMemoLength}</strong> eligible memo
|
<strong>{shownMemoLength}</strong> {t("common.eligible-memo")}
|
||||||
</span>
|
</span>
|
||||||
<button className={`btn save-btn ${requestState.isLoading ? "requesting" : ""}`} onClick={handleSaveBtnClick}>
|
<button className={`btn save-btn ${requestState.isLoading ? "requesting" : ""}`} onClick={handleSaveBtnClick}>
|
||||||
Save
|
{t("common.save")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,7 @@ import { useAppSelector } from "../store";
|
|||||||
import { locationService, shortcutService } from "../services";
|
import { locationService, shortcutService } from "../services";
|
||||||
import * as utils from "../helpers/utils";
|
import * as utils from "../helpers/utils";
|
||||||
import { getTextWithMemoType } from "../helpers/filter";
|
import { getTextWithMemoType } from "../helpers/filter";
|
||||||
|
import useI18n from "../hooks/useI18n";
|
||||||
import "../less/memo-filter.less";
|
import "../less/memo-filter.less";
|
||||||
|
|
||||||
const MemoFilter = () => {
|
const MemoFilter = () => {
|
||||||
@ -10,10 +11,11 @@ const MemoFilter = () => {
|
|||||||
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId } = query;
|
const { tag: tagQuery, duration, type: memoType, text: textQuery, shortcutId } = query;
|
||||||
const shortcut = shortcutId ? shortcutService.getShortcutById(shortcutId) : null;
|
const shortcut = shortcutId ? shortcutService.getShortcutById(shortcutId) : null;
|
||||||
const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut);
|
const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || shortcut);
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`filter-query-container ${showFilter ? "" : "!hidden"}`}>
|
<div className={`filter-query-container ${showFilter ? "" : "!hidden"}`}>
|
||||||
<span className="tip-text">Filter:</span>
|
<span className="tip-text">{t("common.filter")}:</span>
|
||||||
<div
|
<div
|
||||||
className={"filter-item-container " + (shortcut ? "" : "hidden")}
|
className={"filter-item-container " + (shortcut ? "" : "hidden")}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -2,10 +2,12 @@ import { locationService } from "../services";
|
|||||||
import { useAppSelector } from "../store";
|
import { useAppSelector } from "../store";
|
||||||
import { memoSpecialTypes } from "../helpers/filter";
|
import { memoSpecialTypes } from "../helpers/filter";
|
||||||
import Icon from "./Icon";
|
import Icon from "./Icon";
|
||||||
|
import useI18n from "../hooks/useI18n";
|
||||||
import "../less/search-bar.less";
|
import "../less/search-bar.less";
|
||||||
|
|
||||||
const SearchBar = () => {
|
const SearchBar = () => {
|
||||||
const memoType = useAppSelector((state) => state.location.query?.type);
|
const memoType = useAppSelector((state) => state.location.query?.type);
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const handleMemoTypeItemClick = (type: MemoSpecType | undefined) => {
|
const handleMemoTypeItemClick = (type: MemoSpecType | undefined) => {
|
||||||
const { type: prevType } = locationService.getState().query ?? {};
|
const { type: prevType } = locationService.getState().query ?? {};
|
||||||
@ -28,9 +30,9 @@ const SearchBar = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="quickly-action-wrapper">
|
<div className="quickly-action-wrapper">
|
||||||
<div className="quickly-action-container">
|
<div className="quickly-action-container">
|
||||||
<p className="title-text">QUICKLY FILTER</p>
|
<p className="title-text">{t("common.quickly-filter")}</p>
|
||||||
<div className="section-container types-container">
|
<div className="section-container types-container">
|
||||||
<span className="section-text">Type:</span>
|
<span className="section-text">{t("common.types")}:</span>
|
||||||
<div className="values-container">
|
<div className="values-container">
|
||||||
{memoSpecialTypes.map((t, idx) => {
|
{memoSpecialTypes.map((t, idx) => {
|
||||||
return (
|
return (
|
||||||
|
@ -14,6 +14,7 @@ const ShortcutList = () => {
|
|||||||
const query = useAppSelector((state) => state.location.query);
|
const query = useAppSelector((state) => state.location.query);
|
||||||
const shortcuts = useAppSelector((state) => state.shortcut.shortcuts);
|
const shortcuts = useAppSelector((state) => state.shortcut.shortcuts);
|
||||||
const loadingState = useLoading();
|
const loadingState = useLoading();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const pinnedShortcuts = shortcuts
|
const pinnedShortcuts = shortcuts
|
||||||
.filter((s) => s.rowStatus === "ARCHIVED")
|
.filter((s) => s.rowStatus === "ARCHIVED")
|
||||||
@ -37,7 +38,7 @@ const ShortcutList = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="shortcuts-wrapper">
|
<div className="shortcuts-wrapper">
|
||||||
<p className="title-text">
|
<p className="title-text">
|
||||||
<span className="normal-text">Shortcuts</span>
|
<span className="normal-text">{t("common.shortcuts")}</span>
|
||||||
<button className="btn" onClick={() => showCreateShortcutDialog()}>
|
<button className="btn" onClick={() => showCreateShortcutDialog()}>
|
||||||
<Icon.Plus className="icon-img" />
|
<Icon.Plus className="icon-img" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -69,7 +69,7 @@ const TagList = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tags-wrapper">
|
<div className="tags-wrapper">
|
||||||
<p className="title-text">Tags</p>
|
<p className="title-text">{t("common.tags")}</p>
|
||||||
<div className="tags-container">
|
<div className="tags-container">
|
||||||
{tags.map((t, idx) => (
|
{tags.map((t, idx) => (
|
||||||
<TagItemContainer key={t.text + "-" + idx} tag={t} tagQuery={query?.tag} />
|
<TagItemContainer key={t.text + "-" + idx} tag={t} tagQuery={query?.tag} />
|
||||||
|
@ -25,7 +25,18 @@
|
|||||||
"explore": "Explore",
|
"explore": "Explore",
|
||||||
"sign-in": "Sign in",
|
"sign-in": "Sign in",
|
||||||
"sign-out": "Sign out",
|
"sign-out": "Sign out",
|
||||||
"back-to-home": "Back to Home"
|
"back-to-home": "Back to Home",
|
||||||
|
"shortcuts": "Shortcuts",
|
||||||
|
"create-shortcut" : "Create Shortcut",
|
||||||
|
"edit-shortcut": "Edit Shortcut",
|
||||||
|
"title": "Title",
|
||||||
|
"filter": "Filter",
|
||||||
|
"filters": "Filters",
|
||||||
|
"new-filter": "New Filter",
|
||||||
|
"eligible-memo": "eligible memo",
|
||||||
|
"tags": "Tags",
|
||||||
|
"quickly-filter": "QUICKLY FILTER",
|
||||||
|
"types": "TYPE"
|
||||||
},
|
},
|
||||||
"slogan": "An open source, self-hosted knowledge base that works with a SQLite db file.",
|
"slogan": "An open source, self-hosted knowledge base that works with a SQLite db file.",
|
||||||
"auth": {
|
"auth": {
|
||||||
|
@ -25,7 +25,18 @@
|
|||||||
"explore": "探索",
|
"explore": "探索",
|
||||||
"sign-in": "登录",
|
"sign-in": "登录",
|
||||||
"sign-out": "退出登录",
|
"sign-out": "退出登录",
|
||||||
"back-to-home": "回到主页"
|
"back-to-home": "回到主页",
|
||||||
|
"shortcuts": "快捷方式",
|
||||||
|
"create-shortcut" : "创建快捷方式",
|
||||||
|
"edit-shortcut": "编辑快捷方式",
|
||||||
|
"title": "标题",
|
||||||
|
"filter": "过滤",
|
||||||
|
"filters": "全部过滤",
|
||||||
|
"new-filter": "新建过滤",
|
||||||
|
"eligible-memo": "符合条件的memo",
|
||||||
|
"tags": "全部标签",
|
||||||
|
"quickly-filter": "快速过滤",
|
||||||
|
"types": "类型"
|
||||||
},
|
},
|
||||||
"slogan": "一个开源的、支持私有化部署的碎片化知识卡片管理工具。",
|
"slogan": "一个开源的、支持私有化部署的碎片化知识卡片管理工具。",
|
||||||
"auth": {
|
"auth": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user