This commit is contained in:
2025-10-31 12:28:28 +08:00
parent f5bb1ca507
commit b69dcbb52c
44 changed files with 648 additions and 163 deletions

View File

@@ -6,6 +6,7 @@ import z from "zod";
import { TextSpeakerItemSchema } from "@/interfaces";
import IconClick from "@/components/IconClick";
import IMAGES from "@/config/images";
import { useTranslations } from "next-intl";
interface TextCardProps {
item: z.infer<typeof TextSpeakerItemSchema>;
@@ -47,6 +48,7 @@ interface SaveListProps {
handleUse: (item: z.infer<typeof TextSpeakerItemSchema>) => void;
}
export default function SaveList({ show = false, handleUse }: SaveListProps) {
const t = useTranslations("text-speaker");
const [data, setData] = useState(getTextSpeakerData());
const handleDel = (item: z.infer<typeof TextSpeakerItemSchema>) => {
const current_data = getTextSpeakerData();
@@ -61,7 +63,7 @@ export default function SaveList({ show = false, handleUse }: SaveListProps) {
setData(getTextSpeakerData());
};
const handleDeleteAll = () => {
const yesorno = prompt("确定删光吗?(Y/N)")?.trim();
const yesorno = prompt(t("confirmDeleteAll"))?.trim();
if (yesorno && (yesorno === "Y" || yesorno === "y")) {
setTextSpeakerData([]);
refresh();

View File

@@ -15,8 +15,10 @@ import { TextSpeakerItemSchema } from "@/interfaces";
import z from "zod";
import { Navbar } from "@/components/Navbar";
import { VOICES } from "@/config/locales";
import { useTranslations } from "next-intl";
export default function TextSpeaker() {
const t = useTranslations("text-speaker");
const textareaRef = useRef<HTMLTextAreaElement>(null);
const [showSpeedAdjust, setShowSpeedAdjust] = useState(false);
const [showSaveList, setShowSaveList] = useState(false);
@@ -320,7 +322,7 @@ export default function TextSpeaker() {
selected={ipaEnabled}
onClick={() => setIPAEnabled(!ipaEnabled)}
>
IPA
{t("generateIPA")}
</LightButton>
<LightButton
onClick={() => {
@@ -328,7 +330,7 @@ export default function TextSpeaker() {
}}
selected={showSaveList}
>
{t("viewSavedItems")}
</LightButton>
</div>
</div>