-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add more words i18n #516
base: dev
Are you sure you want to change the base?
Changes from all commits
0bb79b7
8b44e7b
b110d9c
5c9f6f7
d77846b
29e2a6c
5f954b0
3446671
c70e734
e705af7
d32a8dd
95ada34
89cf369
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,5 @@ | ||||||
import { createElement, useCallback } from "react" | ||||||
import { useTranslation } from "react-i18next" | ||||||
|
||||||
import { useModalStack } from "~/components/ui/modal/stacked/hooks" | ||||||
import { getFeedById } from "~/store/feed" | ||||||
|
@@ -7,6 +8,7 @@ import { FeedClaimModalContent } from "./feed-claim-modal" | |||||
|
||||||
export const useFeedClaimModal = ({ feedId }: { feedId?: string }) => { | ||||||
const { present } = useModalStack() | ||||||
const { t } = useTranslation("app") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
return useCallback(() => { | ||||||
if (!feedId) return | ||||||
|
@@ -16,7 +18,7 @@ export const useFeedClaimModal = ({ feedId }: { feedId?: string }) => { | |||||
if (!feed) return | ||||||
|
||||||
present({ | ||||||
title: "Feed Claim", | ||||||
title: t("feed_claim_modal.title"), | ||||||
content: () => createElement(FeedClaimModalContent, { feedId }), | ||||||
modalClassName: "!h-auto !max-h-screen", | ||||||
}) | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ import { zodResolver } from "@hookform/resolvers/zod" | |||||||||||||||
import { useMutation } from "@tanstack/react-query" | ||||||||||||||||
import { Fragment } from "react/jsx-runtime" | ||||||||||||||||
import { useForm } from "react-hook-form" | ||||||||||||||||
import { useTranslation } from "react-i18next" | ||||||||||||||||
import { Trans, useTranslation } from "react-i18next" | ||||||||||||||||
import { z } from "zod" | ||||||||||||||||
|
||||||||||||||||
import { Button } from "~/components/ui/button" | ||||||||||||||||
|
@@ -36,20 +36,22 @@ const formSchema = z.object({ | |||||||||||||||
}), | ||||||||||||||||
}) | ||||||||||||||||
|
||||||||||||||||
const NumberDisplay = ({ value }) => <span className="font-bold text-zinc-800">{value ?? 0}</span> | ||||||||||||||||
|
||||||||||||||||
const list = [ | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
{ | ||||||||||||||||
key: "parsedErrorItems", | ||||||||||||||||
title: "Parsed Error Items", | ||||||||||||||||
jerryc127 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
title: <Trans ns="app" i18nKey="discover.import.parsedErrorItems" />, | ||||||||||||||||
className: "text-red-500", | ||||||||||||||||
}, | ||||||||||||||||
{ | ||||||||||||||||
key: "successfulItems", | ||||||||||||||||
title: "Successful Items", | ||||||||||||||||
title: <Trans ns="app" i18nKey="discover.import.successfulItems" />, | ||||||||||||||||
className: "text-green-500", | ||||||||||||||||
}, | ||||||||||||||||
{ | ||||||||||||||||
key: "conflictItems", | ||||||||||||||||
title: "Conflict Items", | ||||||||||||||||
title: <Trans ns="app" i18nKey="discover.import.conflictItems" />, | ||||||||||||||||
className: "text-yellow-500", | ||||||||||||||||
}, | ||||||||||||||||
] | ||||||||||||||||
|
@@ -89,6 +91,7 @@ export function DiscoverImport() { | |||||||||||||||
function onSubmit(values: z.infer<typeof formSchema>) { | ||||||||||||||||
mutation.mutate(values.file) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
const { t } = useTranslation() | ||||||||||||||||
|
||||||||||||||||
return ( | ||||||||||||||||
|
@@ -100,7 +103,7 @@ export function DiscoverImport() { | |||||||||||||||
name="file" | ||||||||||||||||
render={({ field: { value, onChange, ...fieldProps } }) => ( | ||||||||||||||||
<FormItem> | ||||||||||||||||
<FormLabel>OPML file</FormLabel> | ||||||||||||||||
<FormLabel>{t("discover.import.opml")}</FormLabel> | ||||||||||||||||
<FormControl> | ||||||||||||||||
<label | ||||||||||||||||
className="center flex h-[100px] w-full rounded-md border border-dashed" | ||||||||||||||||
|
@@ -150,26 +153,23 @@ export function DiscoverImport() { | |||||||||||||||
<div className="mt-8 max-w-lg"> | ||||||||||||||||
<Card> | ||||||||||||||||
<CardHeader className="block text-zinc-500"> | ||||||||||||||||
<span className="font-bold text-zinc-800"> | ||||||||||||||||
{mutation.data?.successfulItems.length || 0} | ||||||||||||||||
</span>{" "} | ||||||||||||||||
feeds were successfully imported,{" "} | ||||||||||||||||
<span className="font-bold text-zinc-800"> | ||||||||||||||||
{mutation.data?.conflictItems.length || 0} | ||||||||||||||||
</span>{" "} | ||||||||||||||||
were already subscribed to, and{" "} | ||||||||||||||||
<span className="font-bold text-zinc-800"> | ||||||||||||||||
{mutation.data?.parsedErrorItems.length || 0} | ||||||||||||||||
</span>{" "} | ||||||||||||||||
failed to import. | ||||||||||||||||
<Trans | ||||||||||||||||
ns="app" | ||||||||||||||||
i18nKey="discover.import.result" | ||||||||||||||||
components={{ | ||||||||||||||||
SuccessfulNum: <NumberDisplay value={mutation.data?.successfulItems.length} />, | ||||||||||||||||
ConflictNum: <NumberDisplay value={mutation.data?.conflictItems.length} />, | ||||||||||||||||
ErrorNum: <NumberDisplay value={mutation.data?.parsedErrorItems.length} />, | ||||||||||||||||
}} | ||||||||||||||||
/> | ||||||||||||||||
</CardHeader> | ||||||||||||||||
<CardContent className="space-y-6"> | ||||||||||||||||
{list.map((item) => ( | ||||||||||||||||
<div key={item.key}> | ||||||||||||||||
<div className={cn("mb-4 text-lg font-medium", item.className)}>{item.title}</div> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
<div className="space-y-4"> | ||||||||||||||||
{!mutation.data?.[item.key].length && ( | ||||||||||||||||
<div className="text-zinc-500">No items</div> | ||||||||||||||||
<div className="text-zinc-500">{t("discover.import.noItems")}</div> | ||||||||||||||||
)} | ||||||||||||||||
{mutation.data?.[item.key].map((feed: FeedResponse) => ( | ||||||||||||||||
<FollowSummary className="max-w-[462px]" key={feed.id} feed={feed} /> | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { repository } from "@pkg" | ||
import type { FallbackRender } from "@sentry/react" | ||
import { ErrorBoundary } from "@sentry/react" | ||
import type { FC } from "react" | ||
|
@@ -413,28 +412,20 @@ const NoContent: FC<{ | |
url: string | ||
}> = ({ id, url }) => { | ||
const status = useEntryInReadabilityStatus(id) | ||
const { t } = useTranslation("app") | ||
|
||
if (status !== ReadabilityStatus.INITIAL && status !== ReadabilityStatus.FAILURE) { | ||
return null | ||
} | ||
return ( | ||
<div className="center"> | ||
<div className="space-y-2 text-balance text-center text-sm text-zinc-400"> | ||
{(isWebBuild || status === ReadabilityStatus.FAILURE) && <span>No content</span>} | ||
{(isWebBuild || status === ReadabilityStatus.FAILURE) && ( | ||
<span>{t("entry_content.no_content")}</span> | ||
)} | ||
{isWebBuild && ( | ||
<div> | ||
<span> | ||
Maybe web app doesn't support this content type. But you can{" "} | ||
<a | ||
target="_blank" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why deleted |
||
rel="noreferrer" | ||
className="text-accent underline" | ||
href={`${repository.url}/releases`} | ||
> | ||
download | ||
</a>{" "} | ||
the desktop app. | ||
</span> | ||
<span>{t("entry_content.web_app_notice")}</span> | ||
</div> | ||
)} | ||
{url && window.electron && <ReadabilityAutoToggle url={url} id={id} />} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.