Skip to content

Commit efa6163

Browse files
committed
feat: add internationalization support for date selection and year input placeholders
1 parent ed41a75 commit efa6163

File tree

5 files changed

+600
-190
lines changed

5 files changed

+600
-190
lines changed

src/components/editor/Field.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"use client";
22
import { useState, useEffect, useMemo } from "react";
33
import { motion } from "framer-motion";
4-
import { CalendarIcon } from "lucide-react";
4+
import { CalendarIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
55
import { useRouter } from "next/navigation";
66
import { useTranslations } from "next-intl";
7-
import { ChevronUpIcon, ChevronDownIcon } from "lucide-react";
8-
import { format } from "date-fns";
97
import { toast } from "sonner";
108

119
import { cn } from "@/lib/utils";
@@ -159,15 +157,19 @@ const Field = ({
159157
)}
160158
>
161159
<CalendarIcon className="mr-2 h-4 w-4" />
162-
{currentDate ? formatDate(currentDate) : <span>选择日期</span>}
160+
{currentDate ? (
161+
formatDate(currentDate)
162+
) : (
163+
<span>{t("field.selectDate")}</span>
164+
)}
163165
</Button>
164166
</PopoverTrigger>
165167
<PopoverContent className="w-auto p-0">
166168
<div className="p-3 border-b">
167169
<div className="relative">
168170
<Input
169171
type="number"
170-
placeholder="输入年份"
172+
placeholder={t("field.enterYear")}
171173
className="w-full pr-8 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
172174
value={yearInput}
173175
onChange={handleYearInput}

0 commit comments

Comments
 (0)