diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index a1a6b67..25916dd 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -130,7 +130,7 @@ const ReactionAction = (props: { event: NostrEvent }) => { }} > @@ -359,11 +359,11 @@ const Actions: Component = (props) => { const succeeded = results.filter((res) => res.status === 'fulfilled').length; const failed = results.length - succeeded; if (succeeded === results.length) { - window.alert(i18n()('post.deletedSuccessfully')); + window.alert(i18n.t('post.deletedSuccessfully')); } else if (succeeded > 0) { - window.alert(i18n()('post.failedToDeletePartially', { count: failed })); + window.alert(i18n.t('post.failedToDeletePartially', { count: failed })); } else { - window.alert(i18n()('post.failedToDelete')); + window.alert(i18n.t('post.failedToDelete')); } }, onError: (err) => { @@ -374,7 +374,7 @@ const Actions: Component = (props) => { const otherActionsPopup = useContextMenu(() => ({ menu: [ { - content: i18n()('post.copyEventId'), + content: i18n.t('post.copyEventId'), onSelect: () => { navigator.clipboard .writeText(noteEncode(props.event.id)) @@ -382,31 +382,31 @@ const Actions: Component = (props) => { }, }, { - content: i18n()('post.showJSON'), + content: i18n.t('post.showJSON'), onSelect: () => { setModal('EventDebugModal'); }, }, { - content: i18n()('post.showReposts'), + content: i18n.t('post.showReposts'), onSelect: () => { setModal('Reposts'); }, }, { - content: i18n()('post.showReactions'), + content: i18n.t('post.showReactions'), onSelect: () => { setModal('Reactions'); }, }, { when: () => props.event.pubkey === pubkey(), - content: {i18n()('post.deletePost')}, + content: {i18n.t('post.deletePost')}, onSelect: () => { const p = pubkey(); if (p == null) return; - if (!window.confirm(i18n()('post.confirmDelete'))) return; + if (!window.confirm(i18n.t('post.confirmDelete'))) return; deleteMutation.mutate({ relayUrls: config().relayUrls, pubkey: p, @@ -428,21 +428,21 @@ const Actions: Component = (props) => { props.onClickReply(); }} > - + } diff --git a/src/components/NotePostForm.tsx b/src/components/NotePostForm.tsx index 398f1ee..4ee4e95 100644 --- a/src/components/NotePostForm.tsx +++ b/src/components/NotePostForm.tsx @@ -112,10 +112,10 @@ const NotePostForm: Component = (props) => { const placeholder = (mode: NotePostFormProps['mode']) => { switch (mode) { case 'reply': - return i18n()('posting.placeholderReply'); + return i18n.t('posting.placeholderReply'); case 'normal': default: - return i18n()('posting.placeholder'); + return i18n.t('posting.placeholder'); } }; @@ -163,7 +163,7 @@ const NotePostForm: Component = (props) => { if (failed.length > 0) { const filenames = failed.map((f) => f.name).join(', '); - window.alert(i18n()('posting.failedToUploadFile', { filenames })); + window.alert(i18n.t('posting.failedToUploadFile', { filenames })); } }, })); @@ -205,7 +205,7 @@ const NotePostForm: Component = (props) => { if (publishTextNoteMutation.isPending) return; if (/nsec1[0-9a-zA-Z]+/.test(text())) { - window.alert(i18n()('posting.forbiddenToIncludeNsec')); + window.alert(i18n.t('posting.forbiddenToIncludeNsec')); return; } @@ -353,7 +353,7 @@ const NotePostForm: Component = (props) => {
- {i18n()('posting.replyToPre')} + {i18n.t('posting.replyToPre')} {(pubkey, index) => ( <> @@ -362,7 +362,7 @@ const NotePostForm: Component = (props) => { )} - {i18n()('posting.replyToPost')} + {i18n.t('posting.replyToPost')}
@@ -371,7 +371,7 @@ const NotePostForm: Component = (props) => { ref={contentWarningReasonRef} type="text" class="rounded-md border border-border bg-bg ring-border placeholder:text-fg-secondary focus:border-border focus:ring-primary" - placeholder={i18n()('posting.contentWarningReason')} + placeholder={i18n.t('posting.contentWarningReason')} maxLength={32} onInput={(ev) => setContentWarningReason(ev.currentTarget.value)} value={contentWarningReason()} @@ -406,7 +406,7 @@ const NotePostForm: Component = (props) => { }} onClick={() => close()} > - + @@ -442,8 +442,8 @@ const NotePostForm: Component = (props) => { 'p-[6px]': mode() === 'reply', }} type="button" - aria-label={i18n()('posting.contentWarning')} - title={i18n()('posting.contentWarning')} + aria-label={i18n.t('posting.contentWarning')} + title={i18n.t('posting.contentWarning')} onClick={() => { setContentWarning((e) => !e); contentWarningReasonRef?.focus(); @@ -464,8 +464,8 @@ const NotePostForm: Component = (props) => { 'p-[6px]': mode() === 'reply', }} type="button" - title={i18n()('posting.uploadImage')} - aria-label={i18n()('posting.uploadImage')} + title={i18n.t('posting.uploadImage')} + aria-label={i18n.t('posting.uploadImage')} disabled={fileUploadDisabled()} onClick={() => fileInputRef?.click()} > @@ -482,8 +482,8 @@ const NotePostForm: Component = (props) => { 'w-7': mode() === 'reply', }} type="submit" - aria-label={i18n()('posting.submit')} - title={i18n()('posting.submit')} + aria-label={i18n.t('posting.submit')} + title={i18n.t('posting.submit')} disabled={submitDisabled()} > diff --git a/src/components/Post.tsx b/src/components/Post.tsx index 62fd859..fd50a7c 100644 --- a/src/components/Post.tsx +++ b/src/components/Post.tsx @@ -36,7 +36,7 @@ const Post: Component = (props) => {
diff --git a/src/components/column/BookmarkColumn.tsx b/src/components/column/BookmarkColumn.tsx index a340e01..501a71c 100644 --- a/src/components/column/BookmarkColumn.tsx +++ b/src/components/column/BookmarkColumn.tsx @@ -33,7 +33,7 @@ const BookmarkColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/ChannelColumn.tsx b/src/components/column/ChannelColumn.tsx index ebf0159..d6f6d9e 100644 --- a/src/components/column/ChannelColumn.tsx +++ b/src/components/column/ChannelColumn.tsx @@ -44,7 +44,7 @@ const ChannelColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/Column.tsx b/src/components/column/Column.tsx index 0ee5630..f45572b 100644 --- a/src/components/column/Column.tsx +++ b/src/components/column/Column.tsx @@ -73,10 +73,10 @@ const Column: Component = (props) => { class="flex w-full items-center gap-1" onClick={() => timelineState?.clearTimeline()} > -
+
-
{i18n()('column.back')}
+
{i18n.t('column.back')}
diff --git a/src/components/column/ColumnSettings.tsx b/src/components/column/ColumnSettings.tsx index fca6fb1..835da29 100644 --- a/src/components/column/ColumnSettings.tsx +++ b/src/components/column/ColumnSettings.tsx @@ -42,7 +42,7 @@ const ColumnSettings: Component = (props) => { return (
- +
{(width) => ( @@ -56,7 +56,7 @@ const ColumnSettings: Component = (props) => { }} onClick={() => setColumnWidth(width)} > - {i18n()(`column.config.${width}`)} + {i18n.t(`column.config.${width}`)} )} @@ -65,29 +65,29 @@ const ColumnSettings: Component = (props) => {
diff --git a/src/components/column/FollowingColumn.tsx b/src/components/column/FollowingColumn.tsx index 087f296..797deb1 100644 --- a/src/components/column/FollowingColumn.tsx +++ b/src/components/column/FollowingColumn.tsx @@ -70,7 +70,7 @@ const FollowingColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/LoadMore.tsx b/src/components/column/LoadMore.tsx index 7453abc..91a2e7e 100644 --- a/src/components/column/LoadMore.tsx +++ b/src/components/column/LoadMore.tsx @@ -91,7 +91,7 @@ const LoadMore: Component = (props) => { class="flex h-12 w-full flex-col items-center justify-center hover:text-fg-secondary" onClick={() => props.loadMore.loadLatest()} > - {i18n()('column.loadLatest')} + {i18n.t('column.loadLatest')} @@ -102,7 +102,7 @@ const LoadMore: Component = (props) => { disabled={!props.eose} onClick={() => props.loadMore.loadOld()} > - {i18n()('column.loadOld')} + {i18n.t('column.loadOld')} diff --git a/src/components/column/NotificationColumn.tsx b/src/components/column/NotificationColumn.tsx index d4181c8..3d585c6 100644 --- a/src/components/column/NotificationColumn.tsx +++ b/src/components/column/NotificationColumn.tsx @@ -49,7 +49,7 @@ const NotificationColumn: Component = (props) => } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/PostsColumn.tsx b/src/components/column/PostsColumn.tsx index c615776..b18d018 100644 --- a/src/components/column/PostsColumn.tsx +++ b/src/components/column/PostsColumn.tsx @@ -49,7 +49,7 @@ const PostsColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/ReactionsColumn.tsx b/src/components/column/ReactionsColumn.tsx index 600f753..a0454e5 100644 --- a/src/components/column/ReactionsColumn.tsx +++ b/src/components/column/ReactionsColumn.tsx @@ -49,7 +49,7 @@ const ReactionsColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/column/RelaysColumn.tsx b/src/components/column/RelaysColumn.tsx index af84d4b..365a1e3 100644 --- a/src/components/column/RelaysColumn.tsx +++ b/src/components/column/RelaysColumn.tsx @@ -50,7 +50,7 @@ const RelaysColumn: Component = (props) => { } settings={() => } onClose={() => removeColumn(props.column.id)} diff --git a/src/components/event/EventDisplay.tsx b/src/components/event/EventDisplay.tsx index f332fc9..79921b5 100644 --- a/src/components/event/EventDisplay.tsx +++ b/src/components/event/EventDisplay.tsx @@ -30,14 +30,14 @@ const EventDisplay: Component = (props) => { - {i18n()('post.unsupportedKind', { kind: props.event.kind })} + {i18n.t('post.unsupportedKind', { kind: props.event.kind })}
} >
- {i18n()('post.unexpectedKind', { kind: props.event.kind })} + {i18n.t('post.unexpectedKind', { kind: props.event.kind })}
diff --git a/src/components/event/EventDisplayById.tsx b/src/components/event/EventDisplayById.tsx index ca7e071..6aa9108 100644 --- a/src/components/event/EventDisplayById.tsx +++ b/src/components/event/EventDisplayById.tsx @@ -33,7 +33,7 @@ const EventDisplayById: Component = (props) => { - {i18n()('post.failedToFetchEvent')} + {i18n.t('post.failedToFetchEvent')} {props.eventId} } @@ -45,7 +45,7 @@ const EventDisplayById: Component = (props) => { {(id) => (
- {i18n()('general.loading')} + {i18n.t('general.loading')}
)}
diff --git a/src/components/event/Reaction.tsx b/src/components/event/Reaction.tsx index 6d1172c..1258430 100644 --- a/src/components/event/Reaction.tsx +++ b/src/components/event/Reaction.tsx @@ -47,14 +47,14 @@ const ReactionDisplay: Component = (props) => {
-
+
{(url) => ( icon )} @@ -66,7 +66,7 @@ const ReactionDisplay: Component = (props) => { > - {i18n()('notification.reacted')} + {i18n.t('notification.reacted')}
{formatDate(event().createdAtAsDate())}
@@ -76,7 +76,7 @@ const ReactionDisplay: Component = (props) => { when={reactedEvent()} fallback={
- {i18n()('general.loading')} {eventId()} + {i18n.t('general.loading')} {eventId()}
} keyed diff --git a/src/components/event/Repost.tsx b/src/components/event/Repost.tsx index 04cb9f4..77c52eb 100644 --- a/src/components/event/Repost.tsx +++ b/src/components/event/Repost.tsx @@ -27,7 +27,7 @@ const Repost: Component = (props) => {
@@ -38,7 +38,7 @@ const Repost: Component = (props) => { > - {i18n()('notification.reposted')} + {i18n.t('notification.reposted')}
{formatDate(event().createdAtAsDate())}
diff --git a/src/components/event/TextNote.tsx b/src/components/event/TextNote.tsx index 52da2ec..1a99139 100644 --- a/src/components/event/TextNote.tsx +++ b/src/components/event/TextNote.tsx @@ -83,7 +83,7 @@ const TextNote: Component = (props) => { 0}>
- {i18n()('post.replyToPre')} + {i18n.t('post.replyToPre')} {(replyToPubkey: string) => ( )} - {i18n()('post.replyToPost')} + {i18n.t('post.replyToPost')}
diff --git a/src/components/event/ZapReceipt.tsx b/src/components/event/ZapReceipt.tsx index 1b62d46..523794d 100644 --- a/src/components/event/ZapReceipt.tsx +++ b/src/components/event/ZapReceipt.tsx @@ -74,20 +74,20 @@ const ZapReceiptDisplay: Component = (props) => {
-
-
+
{(url) => ( icon )} @@ -99,7 +99,7 @@ const ZapReceiptDisplay: Component = (props) => { > - {i18n()('notification.zapped')} + {i18n.t('notification.zapped')}
diff --git a/src/components/event/textNote/ContentWarningDisplay.tsx b/src/components/event/textNote/ContentWarningDisplay.tsx index 74a35b5..76b9acc 100644 --- a/src/components/event/textNote/ContentWarningDisplay.tsx +++ b/src/components/event/textNote/ContentWarningDisplay.tsx @@ -25,10 +25,10 @@ const ContentWarningDisplay: Component = (props) => - {i18n()('post.contentWarning.show')} + {i18n.t('post.contentWarning.show')} - {i18n()('post.contentWarning.reason')}: {props.contentWarning.reason} + {i18n.t('post.contentWarning.reason')}: {props.contentWarning.reason} @@ -40,7 +40,7 @@ const ContentWarningDisplay: Component = (props) => class="text-xs text-fg-secondary hover:text-fg-secondary/70" onClick={() => setShowContentWarning(false)} > - {i18n()('post.contentWarning.hide')} + {i18n.t('post.contentWarning.hide')} diff --git a/src/components/event/textNote/ImageDisplay.tsx b/src/components/event/textNote/ImageDisplay.tsx index 1aa0b32..d28ffdb 100644 --- a/src/components/event/textNote/ImageDisplay.tsx +++ b/src/components/event/textNote/ImageDisplay.tsx @@ -23,7 +23,7 @@ const ImageDisplay: Component = (props) => { class="rounded bg-bg-tertiary p-3 text-xs text-fg-secondary hover:shadow" onClick={() => setHidden(false)} > - {i18n()('post.showImage')} + {i18n.t('post.showImage')} } > diff --git a/src/components/event/textNote/PreviewedLink.tsx b/src/components/event/textNote/PreviewedLink.tsx index afda22b..5b2040e 100644 --- a/src/components/event/textNote/PreviewedLink.tsx +++ b/src/components/event/textNote/PreviewedLink.tsx @@ -109,7 +109,7 @@ const ClickToShow: Component = (props) => { class="flex flex-col items-center rounded bg-bg-tertiary p-3 text-xs text-fg-secondary hover:shadow" onClick={() => setHidden(false)} > - {i18n()('post.showPreview')} + {i18n.t('post.showPreview')}
diff --git a/src/components/event/textNote/VideoDisplay.tsx b/src/components/event/textNote/VideoDisplay.tsx index 2b6ef3e..e1e0bc4 100644 --- a/src/components/event/textNote/VideoDisplay.tsx +++ b/src/components/event/textNote/VideoDisplay.tsx @@ -22,7 +22,7 @@ const VideoDisplay: Component = (props) => { class="rounded bg-bg-tertiary p-3 text-xs text-fg-secondary hover:shadow" onClick={() => setHidden(false)} > - {i18n()('post.showVideo')} + {i18n.t('post.showVideo')} } > @@ -36,7 +36,7 @@ const VideoDisplay: Component = (props) => { src={props.url} controls > - {i18n()('post.download')} + {i18n.t('post.download')} )} diff --git a/src/components/modal/About.tsx b/src/components/modal/About.tsx index dc8dcbb..77d74f6 100644 --- a/src/components/modal/About.tsx +++ b/src/components/modal/About.tsx @@ -61,17 +61,17 @@ const About: Component = (props) => { class="rounded border-2 border-primary px-4 py-2 font-bold text-primary hover:border-primary-hover hover:text-primary-hover" href="https://github.com/syusui-s/rabbit/issues/new/choose" > - {i18n()('about.bugReport')} + {i18n.t('about.bugReport')} - {i18n()('about.sourceCode')} + {i18n.t('about.sourceCode')}
-

{i18n()('about.termOfService')}

+

{i18n.t('about.termOfService')}

Copyright (C) 2023 Shusui Moyatani and{' '} @@ -84,12 +84,12 @@ const About: Component = (props) => {

-          {i18n()('about.agplText')}
+          {i18n.t('about.agplText')}
         

- {i18n()('about.agplTranslationJa')} + {i18n.t('about.agplTranslationJa')}

@@ -97,7 +97,7 @@ const About: Component = (props) => { {packageInfo()?.self.licenseText} -

{i18n()('about.usingLibraries')}

+

{i18n.t('about.usingLibraries')}

{(p) => ( diff --git a/src/components/modal/AddColumn.tsx b/src/components/modal/AddColumn.tsx index e016275..9e6f684 100644 --- a/src/components/modal/AddColumn.tsx +++ b/src/components/modal/AddColumn.tsx @@ -84,28 +84,28 @@ const AddColumn: Component = (props) => { class="flex basis-1/2 flex-col items-center gap-2 py-8 hover:text-primary sm:basis-1/4" onClick={() => addFollowingColumn()} > - + - {i18n()('column.home')} + {i18n.t('column.home')} {/*
diff --git a/src/components/modal/Config.tsx b/src/components/modal/Config.tsx index 47ca628..afea40e 100644 --- a/src/components/modal/Config.tsx +++ b/src/components/modal/Config.tsx @@ -44,7 +44,7 @@ const Section = (props: { title: string; initialOpened?: boolean; children: JSX. onClick={() => toggleOpened()} > {props.title} - + }> @@ -73,7 +73,7 @@ const ToggleButton = (props: { area-label={props.value} onClick={(event) => props.onClick(event)} > - + ); @@ -83,7 +83,7 @@ const ProfileSection = () => { const { showProfile, showProfileEdit } = useModalState(); return ( -
+
@@ -126,11 +126,11 @@ const RelayConfig = () => { const relayUrls = importedRelays.map(([relayUrl]) => relayUrl).join('\n'); if (importedRelays.length === 0) { - window.alert(i18n()('config.relays.notConfigured')); + window.alert(i18n.t('config.relays.notConfigured')); return; } - if (!window.confirm(`${i18n()('config.relays.askImport')}\n\n${relayUrls}`)) { + if (!window.confirm(`${i18n.t('config.relays.askImport')}\n\n${relayUrls}`)) { return; } @@ -142,14 +142,14 @@ const RelayConfig = () => { }); const currentCount = config().relayUrls.length; const importedCount = currentCount - lastCount; - window.alert(i18n()('config.relays.imported', { count: importedCount })); + window.alert(i18n.t('config.relays.imported', { count: importedCount })); }; return ( <> -
+

- {i18n()('config.relays.numOfRelays', { count: config().relayUrls.length })} + {i18n.t('config.relays.numOfRelays', { count: config().relayUrls.length })}

{ onChange={(ev) => setRelayUrlInput(ev.currentTarget.value)} />
    @@ -170,7 +170,7 @@ const RelayConfig = () => { {(relayUrl: string) => (
  • {relayUrl}
    -
  • @@ -178,18 +178,18 @@ const RelayConfig = () => {
-
+
@@ -213,7 +213,7 @@ const ColorThemeConfig = () => { }; return ( -
+
{(colorTheme) => ( @@ -247,18 +247,18 @@ const DateFormatConfig = () => { }[] = [ { id: 'relative', - name: i18n()('config.display.relativeTimeNotation'), - example: i18n()('config.display.relativeTimeNotationExample'), + name: i18n.t('config.display.relativeTimeNotation'), + example: i18n.t('config.display.relativeTimeNotationExample'), }, { id: 'absolute-short', - name: i18n()('config.display.absoluteTimeNotationShort'), - example: i18n()('config.display.absoluteTimeNotationShortExample'), + name: i18n.t('config.display.absoluteTimeNotationShort'), + example: i18n.t('config.display.absoluteTimeNotationShortExample'), }, { id: 'absolute-long', - name: i18n()('config.display.absoluteTimeNotationLong'), - example: i18n()('config.display.absoluteTimeNotationLongExample'), + name: i18n.t('config.display.absoluteTimeNotationLong'), + example: i18n.t('config.display.absoluteTimeNotationLongExample'), }, ]; @@ -267,7 +267,7 @@ const DateFormatConfig = () => { }; return ( -
+
{({ id, name, example }) => ( @@ -313,17 +313,17 @@ const ReactionConfig = () => { }; return ( -
+
-
{i18n()('config.display.enableEmojiReaction')}
+
{i18n.t('config.display.enableEmojiReaction')}
toggleUseEmojiReaction()} />
-
{i18n()('config.display.showEmojiReaction')}
+
{i18n.t('config.display.showEmojiReaction')}
toggleShowEmojiReaction()} @@ -350,10 +350,10 @@ const EmojiConfig = () => { }; return ( -
+
@@ -415,7 +415,7 @@ const EmojiConfig = () => { class="flex w-full flex-col items-center gap-1 rounded p-2 hover:bg-bg-tertiary/20 hover:shadow" onClick={() => popup.open()} > - }> + }> {() => (
{shortcode} @@ -456,8 +456,8 @@ const EmojiImport = () => { }; return ( -
-

{i18n()('config.customEmoji.emojiImportDescription')}

+
+

{i18n.t('config.customEmoji.emojiImportDescription')}