Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
7079faf2
Unverified
Commit
7079faf2
authored
Sep 14, 2022
by
ChasLui
Committed by
GitHub
Sep 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update i18n (#212)
* feat: 增加部分 i18n * feat: 增加部分 i18n * feat: 增加部分 i18n
parent
707d1a96
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
13 deletions
+42
-13
CreateShortcutDialog.tsx
web/src/components/CreateShortcutDialog.tsx
+8
-6
MemoFilter.tsx
web/src/components/MemoFilter.tsx
+3
-1
SearchBar.tsx
web/src/components/SearchBar.tsx
+4
-2
ShortcutList.tsx
web/src/components/ShortcutList.tsx
+2
-1
TagList.tsx
web/src/components/TagList.tsx
+1
-1
en.json
web/src/locales/en.json
+12
-1
zh.json
web/src/locales/zh.json
+12
-1
No files found.
web/src/components/CreateShortcutDialog.tsx
View file @
7079faf2
...
@@ -6,6 +6,7 @@ import Icon from "./Icon";
...
@@ -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) => {
...
@@ -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) => {
...
@@ -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) => {
...
@@ -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) => {
...
@@ -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) => {
...
@@ -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
>
...
...
web/src/components/MemoFilter.tsx
View file @
7079faf2
...
@@ -2,6 +2,7 @@ import { useAppSelector } from "../store";
...
@@ -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 = () => {
...
@@ -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=
{
()
=>
{
...
...
web/src/components/SearchBar.tsx
View file @
7079faf2
...
@@ -2,10 +2,12 @@ import { locationService } from "../services";
...
@@ -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 = () => {
...
@@ -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
(
...
...
web/src/components/ShortcutList.tsx
View file @
7079faf2
...
@@ -14,6 +14,7 @@ const ShortcutList = () => {
...
@@ -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 = () => {
...
@@ -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
>
...
...
web/src/components/TagList.tsx
View file @
7079faf2
...
@@ -69,7 +69,7 @@ const TagList = () => {
...
@@ -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
}
/>
...
...
web/src/locales/en.json
View file @
7079faf2
...
@@ -25,7 +25,18 @@
...
@@ -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"
:
{
...
...
web/src/locales/zh.json
View file @
7079faf2
...
@@ -25,7 +25,18 @@
...
@@ -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"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment