@@ -235,12 +238,11 @@ export default () => {
}
const showPromptToRenameFolder = (folderPathname: string) => {
prompt({
- title: 'Rename the Folder',
- message:
- 'Enter the new folder name, every note and subfolder paths will also be updated.',
+ title: t('folder.rename'),
+ message: t('folder.renameMessage'),
iconType: DialogIconTypes.Question,
defaultValue: folderPathname.split('/').pop(),
- submitButtonLabel: 'Rename Folder',
+ submitButtonLabel: t('folder.rename'),
onClose: async (value: string | null) => {
const folderPathSplit = folderPathname.split('/')
if (
@@ -257,8 +259,8 @@ export default () => {
openSideNavFolderItemRecursively(storage.id, newPathname)
} catch (error) {
pushMessage({
- title: 'Error',
- description: 'You could not rename the folder'
+ title: t('general.error'),
+ description: t('folder.renameErrorMessage')
})
}
}
@@ -323,14 +325,14 @@ export default () => {
popup(event, [
{
type: MenuTypes.Normal,
- label: 'Rename Storage',
+ label: t('storage.rename'),
onClick: async () => {
prompt({
title: `Rename "${storage.name}" storage`,
- message: 'Enter new storage name',
+ message: t('storage.renameMessage'),
iconType: DialogIconTypes.Question,
defaultValue: storage.name,
- submitButtonLabel: 'Rename Storage',
+ submitButtonLabel: t('storage.rename'),
onClose: async (value: string | null) => {
if (value == null) return
await renameStorage(storage.id, value)
@@ -340,14 +342,13 @@ export default () => {
},
{
type: MenuTypes.Normal,
- label: 'Remove Storage',
+ label: t('storage.remove'),
onClick: async () => {
messageBox({
title: `Remove "${storage.name}" storage`,
- message:
- 'The storage will be unlinked from this app.',
+ message: t('storage.removeMessage'),
iconType: DialogIconTypes.Warning,
- buttons: ['Remove Storage', 'Cancel'],
+ buttons: [t('storage.remove'), t('general.cancel')],
defaultButtonIndex: 0,
cancelButtonIndex: 1,
onClose: (value: number | null) => {
@@ -372,7 +373,7 @@ export default () => {
@@ -388,7 +389,7 @@ export default () => {
/>
:
}
active={trashcanPageIsActive}
onClick={() => push(trashcanPagePathname)}
@@ -403,7 +404,7 @@ export default () => {
)
})}
{storageEntries.length === 0 && (
-
No storages
+
{t('storage.noStorage')}
)}
{preferences['general.tutorials'] === 'display' && (
diff --git a/src/components/SideNavigator/TagListFragment.tsx b/src/components/SideNavigator/TagListFragment.tsx
index f9fe0a1793..39a2938278 100644
--- a/src/components/SideNavigator/TagListFragment.tsx
+++ b/src/components/SideNavigator/TagListFragment.tsx
@@ -8,11 +8,14 @@ import { useContextMenu, MenuTypes } from '../../lib/contextMenu'
import { useDialog, DialogIconTypes } from '../../lib/dialog'
import { useDb } from '../../lib/db'
import { IconTag, IconTags, IconTagFill } from '../icons'
+import { useTranslation } from 'react-i18next'
interface TagListFragmentProps {
storage: NoteStorage
}
+const { t } = useTranslation()
+
const TagListFragment = ({ storage }: TagListFragmentProps) => {
const { toggleSideNavOpenedItem, sideNavOpenedItemSet } = useGeneralStatus()
const { id: storageId, tagMap } = storage
@@ -44,13 +47,13 @@ const TagListFragment = ({ storage }: TagListFragmentProps) => {
popup(event, [
{
type: MenuTypes.Normal,
- label: 'Remove Tag',
+ label: t('tag.remove'),
onClick: () => {
messageBox({
title: `Remove "${tagName}" tag`,
- message: 'The tag will be untagged from all notes.',
+ message: t('tag.removeMessage'),
iconType: DialogIconTypes.Warning,
- buttons: ['Remove Folder', 'Cancel'],
+ buttons: [t('tag.removeMessage'), t('general.cancel')],
defaultButtonIndex: 0,
cancelButtonIndex: 1,
onClose: (value: number | null) => {
@@ -73,7 +76,7 @@ const TagListFragment = ({ storage }: TagListFragmentProps) => {
}
- label='Tags'
+ label={t('tag.tag')}
folded={tagList.length > 0 ? tagListIsFolded : undefined}
onFoldButtonClick={() => {
toggleSideNavOpenedItem(tagListNavItemId)
diff --git a/src/components/Storage/StorageCreate.tsx b/src/components/Storage/StorageCreate.tsx
index bfb8a9883d..d2745728a5 100644
--- a/src/components/Storage/StorageCreate.tsx
+++ b/src/components/Storage/StorageCreate.tsx
@@ -46,7 +46,7 @@ export default () => {
{t('Create new storage')}
-
+
{
checked={storageType === 'cloud'}
onChange={() => setStorageType('cloud')}
/>
- Cloud
+ {t('storage.typeCloud')}
{(storageType === 'local' || isLoggedIn) && (
<>
createStorageCallback()}>
- Create Storage
+ {t('storage.create')}
>
@@ -86,7 +86,7 @@ export default () => {
{!isLoggedIn && storageType === 'cloud' && (
<>
- You need to sign in to create a cloud storage.
+ {t('storage.needSignIn')}
{
const db = useDb()
const router = useRouter()
+ const { t } = useTranslation()
const [name, setName] = useState(storage.name)
const { messageBox } = useDialog()
const { pushMessage } = useToast()
@@ -31,9 +33,9 @@ export default ({ storage }: StorageEditProps) => {
const removeCallback = useCallback(() => {
messageBox({
title: `Remove "${storage.name}" storage`,
- message: 'The storage will be unlinked from this app.',
+ message: t('storage.removeMessage'),
iconType: DialogIconTypes.Warning,
- buttons: ['Remove Storage', 'Cancel'],
+ buttons: [t('storage.remove'), t('general.cancel')],
defaultButtonIndex: 0,
cancelButtonIndex: 1,
onClose: async (value: number | null) => {
@@ -43,7 +45,7 @@ export default ({ storage }: StorageEditProps) => {
router.push('/app')
} catch {
pushMessage({
- title: 'Network Error',
+ title: t('general.networkError'),
description: `An error occurred while deleting storage (id: ${storage.id})`
})
}
@@ -56,7 +58,7 @@ export default ({ storage }: StorageEditProps) => {
() => {
db.renameStorage(storage.id, name).catch(() => {
pushMessage({
- title: 'Network Error',
+ title: t('general.networkError'),
description: `An error occured while updating storage (id:${storage.id}}`
})
})
@@ -68,11 +70,11 @@ export default ({ storage }: StorageEditProps) => {
return (
- Edit Storage
+ {t('storage.edit')}
- Delete Storage
+ {t('storage.delete')}
{isCloudStorageData(storage) && (
- Last synced at
+ {t('storage.syncDate')}
{new Date(storage.cloudStorage.updatedAt).toLocaleString()}
diff --git a/src/components/Tutorials/TutorialsNoteDetail.tsx b/src/components/Tutorials/TutorialsNoteDetail.tsx
index 0d7f39d41e..24093fb146 100644
--- a/src/components/Tutorials/TutorialsNoteDetail.tsx
+++ b/src/components/Tutorials/TutorialsNoteDetail.tsx
@@ -8,6 +8,7 @@ import { TutorialsNavigatorTreeItem } from '../../lib/tutorials'
import { StyledNoteDetailContainer } from '../NotePage/NoteDetail/NoteDetail'
import { ViewModeType } from '../../lib/generalStatus'
import { IconEye, IconSplit, IconEdit } from '../icons'
+import { useTranslation } from 'react-i18next'
type TutorialsNoteDetailProps = {
note: TutorialsNavigatorTreeItem
@@ -79,10 +80,12 @@ export default class TutorialsNoteDetail extends React.Component<
)
+ const { t } = useTranslation()
+
return (
{note == null ? (
- No note is selected
+ {t('note.unselect')}
) : (
<>
diff --git a/src/components/Tutorials/TutorialsNoteList.tsx b/src/components/Tutorials/TutorialsNoteList.tsx
index 623398cf57..b552f0a632 100644
--- a/src/components/Tutorials/TutorialsNoteList.tsx
+++ b/src/components/Tutorials/TutorialsNoteList.tsx
@@ -2,6 +2,7 @@ import React, { useCallback, KeyboardEvent, useRef } from 'react'
import { TutorialsNavigatorTreeItem } from '../../lib/tutorials'
import TutorialsNoteItem from './TutorialsNoteItem'
import { StyledNoteListContainer } from '../NotePage/NoteList/NoteList'
+import { useTranslation } from 'react-i18next'
type TutorialsNoteListProps = {
currentTree: TutorialsNavigatorTreeItem
@@ -47,6 +48,8 @@ const TutorialsNoteList = ({
? []
: parentTree.children.filter(child => child.type === 'note')
+ const { t } = useTranslation()
+
return (
@@ -65,7 +68,7 @@ const TutorialsNoteList = ({
)
})}
- {notes.length === 0 && - No notes
}
+ {notes.length === 0 && - {t('note.nothing')}
}
)
diff --git a/src/components/Tutorials/TutorialsPage.tsx b/src/components/Tutorials/TutorialsPage.tsx
index acec69903d..d30ce87997 100644
--- a/src/components/Tutorials/TutorialsPage.tsx
+++ b/src/components/Tutorials/TutorialsPage.tsx
@@ -5,6 +5,7 @@ import { useGeneralStatus, ViewModeType } from '../../lib/generalStatus'
import { useRouter } from '../../lib/router'
import TutorialsNoteList from './TutorialsNoteList'
import TutorialsNoteDetail from './TutorialsNoteDetail'
+import { useTranslation } from 'react-i18next'
interface TutorialsPageProps {
pathname: string
@@ -18,7 +19,7 @@ type TutoriasPagePicker = {
export default ({ pathname }: TutorialsPageProps) => {
const { generalStatus, setGeneralStatus } = useGeneralStatus()
const router = useRouter()
-
+ const { t } = useTranslation()
const searchThroughTreeForIdenticalNode = useCallback(
(
pathToSearch: string,
@@ -241,7 +242,7 @@ export default ({ pathname }: TutorialsPageProps) => {
}
right={
selectedNote == null ? (
-
No note selected
+
{t('note.unselect')}
) : (