fix(i18n): use English runtime text and localize system UI

This commit is contained in:
Arthur Koba
2026-10-25 19:44:15 +03:00
parent ada0550571
commit 65a96670d5
289 changed files with 8092 additions and 3426 deletions
+7 -1
View File
@@ -1,6 +1,8 @@
'use client';
import * as React from 'react';
import { useLocale } from 'next-intl';
import { enUS, zhCN } from 'date-fns/locale';
import {
ChevronDownIcon,
ChevronLeftIcon,
@@ -19,14 +21,18 @@ function Calendar({
buttonVariant = 'ghost',
formatters,
components,
locale: localeOverride,
...props
}: React.ComponentProps<typeof DayPicker> & {
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
}) {
const uiLocale = useLocale();
const locale = localeOverride ?? (uiLocale === 'zh-CN' ? zhCN : enUS);
const defaultClassNames = getDefaultClassNames();
return (
<DayPicker
locale={locale}
showOutsideDays={showOutsideDays}
className={cn(
'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
@@ -37,7 +43,7 @@ function Calendar({
captionLayout={captionLayout}
formatters={{
formatMonthDropdown: (date) =>
date.toLocaleString('default', { month: 'short' }),
date.toLocaleString(locale.code ?? uiLocale, { month: 'short' }),
...formatters,
}}
classNames={{
+6 -2
View File
@@ -1,5 +1,6 @@
'use client';
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { X } from 'lucide-react';
@@ -25,13 +26,16 @@ function normalizeTag(raw: string) {
function TagsInput({
value,
onChange,
placeholder = '输入后按 Enter 添加',
placeholder = undefined,
disabled = false,
className,
id,
validateTag,
'aria-invalid': ariaInvalid,
}: TagsInputProps) {
const rt = useTranslations('runtime');
placeholder ??= rt('type_and_press_enter_to_add_e30b7b5f');
const [draft, setDraft] = React.useState('');
const inputRef = React.useRef<HTMLInputElement>(null);
@@ -128,7 +132,7 @@ function TagsInput({
<button
type='button'
className='hover:bg-muted rounded-sm p-0.5 outline-none focus-visible:ring-1 focus-visible:ring-ring'
aria-label={`移除 ${tag}`}
aria-label={rt('remove_value0_30c2158a', { value0: tag })}
disabled={disabled}
onClick={(event) => {
event.stopPropagation();