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
7b098761
Unverified
Commit
7b098761
authored
Sep 10, 2022
by
winwin2011
Committed by
GitHub
Sep 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: i18n for dialogs (#203)
* feat: i18n in dialog * fix: use common translation
parent
50fa560d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
13 deletions
+47
-13
ArchivedMemoDialog.tsx
web/src/components/ArchivedMemoDialog.tsx
+5
-3
DailyReviewDialog.tsx
web/src/components/DailyReviewDialog.tsx
+1
-1
ResourcesDialog.tsx
web/src/components/ResourcesDialog.tsx
+7
-7
en.json
web/src/locales/en.json
+17
-1
zh.json
web/src/locales/zh.json
+17
-1
No files found.
web/src/components/ArchivedMemoDialog.tsx
View file @
7b098761
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
useLoading
from
"../hooks/useLoading"
;
import
useLoading
from
"../hooks/useLoading"
;
import
useI18n
from
"../hooks/useI18n"
;
import
{
memoService
}
from
"../services"
;
import
{
memoService
}
from
"../services"
;
import
{
useAppSelector
}
from
"../store"
;
import
{
useAppSelector
}
from
"../store"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
...
@@ -11,6 +12,7 @@ import "../less/archived-memo-dialog.less";
...
@@ -11,6 +12,7 @@ import "../less/archived-memo-dialog.less";
type
Props
=
DialogProps
;
type
Props
=
DialogProps
;
const
ArchivedMemoDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
ArchivedMemoDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
t
}
=
useI18n
();
const
{
destroy
}
=
props
;
const
{
destroy
}
=
props
;
const
memos
=
useAppSelector
((
state
)
=>
state
.
memo
.
memos
);
const
memos
=
useAppSelector
((
state
)
=>
state
.
memo
.
memos
);
const
loadingState
=
useLoading
();
const
loadingState
=
useLoading
();
...
@@ -36,7 +38,7 @@ const ArchivedMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -36,7 +38,7 @@ const ArchivedMemoDialog: 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
>
Archived Memos
{
t
(
"archived.archived-memos"
)
}
</
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"
/>
...
@@ -45,11 +47,11 @@ const ArchivedMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -45,11 +47,11 @@ const ArchivedMemoDialog: React.FC<Props> = (props: Props) => {
<
div
className=
"dialog-content-container"
>
<
div
className=
"dialog-content-container"
>
{
loadingState
.
isLoading
?
(
{
loadingState
.
isLoading
?
(
<
div
className=
"tip-text-container"
>
<
div
className=
"tip-text-container"
>
<
p
className=
"tip-text"
>
fetching data...
</
p
>
<
p
className=
"tip-text"
>
{
t
(
"archived.fetching-data"
)
}
</
p
>
</
div
>
</
div
>
)
:
archivedMemos
.
length
===
0
?
(
)
:
archivedMemos
.
length
===
0
?
(
<
div
className=
"tip-text-container"
>
<
div
className=
"tip-text-container"
>
<
p
className=
"tip-text"
>
No archived memos.
</
p
>
<
p
className=
"tip-text"
>
{
t
(
"archived.no-archived-memos"
)
}
</
p
>
</
div
>
</
div
>
)
:
(
)
:
(
<
div
className=
"archived-memos-container"
>
<
div
className=
"archived-memos-container"
>
...
...
web/src/components/DailyReviewDialog.tsx
View file @
7b098761
...
@@ -97,7 +97,7 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
...
@@ -97,7 +97,7 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
</
div
>
</
div
>
{
dailyMemos
.
length
===
0
?
(
{
dailyMemos
.
length
===
0
?
(
<
div
className=
"tip-container"
>
<
div
className=
"tip-container"
>
<
p
className=
"tip-text"
>
Oops, there is nothing.
</
p
>
<
p
className=
"tip-text"
>
{
t
(
"daily-review.oops-nothing"
)
}
</
p
>
</
div
>
</
div
>
)
:
(
)
:
(
<
div
className=
"dailymemos-wrapper"
>
<
div
className=
"dailymemos-wrapper"
>
...
...
web/src/components/ResourcesDialog.tsx
View file @
7b098761
...
@@ -127,16 +127,16 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
...
@@ -127,16 +127,16 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
</
button
>
</
button
>
</
div
>
</
div
>
<
div
className=
"dialog-content-container"
>
<
div
className=
"dialog-content-container"
>
<
div
className=
"tip-text-container"
>
(👨💻WIP)
View your static resources in memos. e.g. images
</
div
>
<
div
className=
"tip-text-container"
>
(👨💻WIP)
{
t
(
"resources.description"
)
}
</
div
>
<
div
className=
"upload-resource-container"
onClick=
{
()
=>
handleUploadFileBtnClick
()
}
>
<
div
className=
"upload-resource-container"
onClick=
{
()
=>
handleUploadFileBtnClick
()
}
>
<
div
className=
"upload-resource-btn"
>
<
div
className=
"upload-resource-btn"
>
<
Icon
.
File
className=
"icon-img"
/>
<
Icon
.
File
className=
"icon-img"
/>
<
span
>
Upload
</
span
>
<
span
>
{
t
(
"resources.upload"
)
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
{
loadingState
.
isLoading
?
(
{
loadingState
.
isLoading
?
(
<
div
className=
"loading-text-container"
>
<
div
className=
"loading-text-container"
>
<
p
className=
"tip-text"
>
fetching data...
</
p
>
<
p
className=
"tip-text"
>
{
t
(
"resources.fetching-data"
)
}
</
p
>
</
div
>
</
div
>
)
:
(
)
:
(
<
div
className=
"resource-table-container"
>
<
div
className=
"resource-table-container"
>
...
@@ -147,7 +147,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
...
@@ -147,7 +147,7 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
<
span
></
span
>
<
span
></
span
>
</
div
>
</
div
>
{
state
.
resources
.
length
===
0
?
(
{
state
.
resources
.
length
===
0
?
(
<
p
className=
"tip-text"
>
No resource.
</
p
>
<
p
className=
"tip-text"
>
{
t
(
"resources.no-resources"
)
}
</
p
>
)
:
(
)
:
(
state
.
resources
.
map
((
resource
)
=>
(
state
.
resources
.
map
((
resource
)
=>
(
<
div
key=
{
resource
.
id
}
className=
"resource-container"
>
<
div
key=
{
resource
.
id
}
className=
"resource-container"
>
...
@@ -156,10 +156,10 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
...
@@ -156,10 +156,10 @@ const ResourcesDialog: React.FC<Props> = (props: Props) => {
<
span
className=
"field-text"
>
{
resource
.
type
}
</
span
>
<
span
className=
"field-text"
>
{
resource
.
type
}
</
span
>
<
div
className=
"buttons-container"
>
<
div
className=
"buttons-container"
>
<
Dropdown
className=
"actions-dropdown"
>
<
Dropdown
className=
"actions-dropdown"
>
<
button
onClick=
{
()
=>
handlPreviewBtnClick
(
resource
)
}
>
Preview
</
button
>
<
button
onClick=
{
()
=>
handlPreviewBtnClick
(
resource
)
}
>
{
t
(
"resources.preview"
)
}
</
button
>
<
button
onClick=
{
()
=>
handleCopyResourceLinkBtnClick
(
resource
)
}
>
Copy Link
</
button
>
<
button
onClick=
{
()
=>
handleCopyResourceLinkBtnClick
(
resource
)
}
>
{
t
(
"resources.copy-link"
)
}
</
button
>
<
button
className=
"delete-btn"
onClick=
{
()
=>
handleDeleteResourceBtnClick
(
resource
)
}
>
<
button
className=
"delete-btn"
onClick=
{
()
=>
handleDeleteResourceBtnClick
(
resource
)
}
>
Delete
{
t
(
"common.delete"
)
}
</
button
>
</
button
>
</
Dropdown
>
</
Dropdown
>
</
div
>
</
div
>
...
...
web/src/locales/en.json
View file @
7b098761
...
@@ -39,6 +39,22 @@
...
@@ -39,6 +39,22 @@
"setting"
:
"Setting"
,
"setting"
:
"Setting"
,
"archived"
:
"Archived"
"archived"
:
"Archived"
},
},
"daily-review"
:
{
"oops-nothing"
:
"Oops, there is nothing."
},
"resources"
:
{
"description"
:
"View your static resources in memos. e.g. images"
,
"no-resources"
:
"No resources."
,
"fetching-data"
:
"fetching data..."
,
"upload"
:
"Upload"
,
"preview"
:
"Preview"
,
"copy-link"
:
"Copy Link"
},
"archived"
:
{
"archived-memos"
:
"Archived Memos"
,
"no-archived-memos"
:
"No archived memos."
,
"fetching-data"
:
"fetching data..."
},
"editor"
:
{
"editor"
:
{
"editing"
:
"Editing..."
,
"editing"
:
"Editing..."
,
"save"
:
"Save"
,
"save"
:
"Save"
,
...
@@ -68,4 +84,4 @@
...
@@ -68,4 +84,4 @@
"create-a-member"
:
"Create a member"
"create-a-member"
:
"Create a member"
}
}
}
}
}
}
\ No newline at end of file
web/src/locales/zh.json
View file @
7b098761
...
@@ -39,6 +39,22 @@
...
@@ -39,6 +39,22 @@
"setting"
:
"设置"
,
"setting"
:
"设置"
,
"archived"
:
"已归档"
"archived"
:
"已归档"
},
},
"daily-review"
:
{
"oops-nothing"
:
"啊哦,空空荡荡。"
},
"resources"
:
{
"description"
:
"查看在 Memo 中的静态资源。例如:图片"
,
"no-resources"
:
"没有资源"
,
"fetching-data"
:
"请求数据中..."
,
"upload"
:
"上传"
,
"preview"
:
"预览"
,
"copy-link"
:
"拷贝链接"
},
"archived"
:
{
"archived-memos"
:
"已归档的 Memo"
,
"no-archived-memos"
:
"没有归档的 Memo"
,
"fetching-data"
:
"请求数据中..."
},
"editor"
:
{
"editor"
:
{
"editing"
:
"编辑中..."
,
"editing"
:
"编辑中..."
,
"save"
:
"记下"
,
"save"
:
"记下"
,
...
@@ -68,4 +84,4 @@
...
@@ -68,4 +84,4 @@
"create-a-member"
:
"创建成员"
"create-a-member"
:
"创建成员"
}
}
}
}
}
}
\ No newline at end of file
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