fix: locale toggle shows current language, date inputs respect locale
- Language switcher now displays current locale (中文/English) instead of target - Add lang attribute to date inputs for proper localization of native date picker
This commit is contained in:
@@ -101,7 +101,7 @@ export function Sidebar() {
|
|||||||
style={{ color: "var(--text-muted)", background: "var(--row-hover)", border: "1px solid var(--surface-border)" }}
|
style={{ color: "var(--text-muted)", background: "var(--row-hover)", border: "1px solid var(--surface-border)" }}
|
||||||
>
|
>
|
||||||
<Languages className="h-3.5 w-3.5" />
|
<Languages className="h-3.5 w-3.5" />
|
||||||
<span className="font-medium">{locale === "zh" ? "English" : "中文"}</span>
|
<span className="font-medium">{locale === "zh" ? "中文" : "English"}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Status */}
|
{/* Status */}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useTimeRange } from "@/lib/time-range-context";
|
|||||||
import { useI18n } from "@/lib/i18n";
|
import { useI18n } from "@/lib/i18n";
|
||||||
|
|
||||||
export function TimeRangeSelector() {
|
export function TimeRangeSelector() {
|
||||||
const { t } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const { range, setRange, customStart, customEnd, setCustomStart, setCustomEnd } = useTimeRange();
|
const { range, setRange, customStart, customEnd, setCustomStart, setCustomEnd } = useTimeRange();
|
||||||
const [showPopover, setShowPopover] = useState(false);
|
const [showPopover, setShowPopover] = useState(false);
|
||||||
const [localStart, setLocalStart] = useState(customStart);
|
const [localStart, setLocalStart] = useState(customStart);
|
||||||
@@ -126,6 +126,7 @@ export function TimeRangeSelector() {
|
|||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
|
lang={locale === "zh" ? "zh-CN" : "en-US"}
|
||||||
value={localStart}
|
value={localStart}
|
||||||
onChange={(e) => setLocalStart(e.target.value)}
|
onChange={(e) => setLocalStart(e.target.value)}
|
||||||
className="input-glass w-full rounded-md px-3 py-1.5 text-xs font-[family-name:var(--font-geist-mono)]"
|
className="input-glass w-full rounded-md px-3 py-1.5 text-xs font-[family-name:var(--font-geist-mono)]"
|
||||||
@@ -137,6 +138,7 @@ export function TimeRangeSelector() {
|
|||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
|
lang={locale === "zh" ? "zh-CN" : "en-US"}
|
||||||
value={localEnd}
|
value={localEnd}
|
||||||
onChange={(e) => setLocalEnd(e.target.value)}
|
onChange={(e) => setLocalEnd(e.target.value)}
|
||||||
className="input-glass w-full rounded-md px-3 py-1.5 text-xs font-[family-name:var(--font-geist-mono)]"
|
className="input-glass w-full rounded-md px-3 py-1.5 text-xs font-[family-name:var(--font-geist-mono)]"
|
||||||
|
|||||||
Reference in New Issue
Block a user