feat(i18n): expand catalog runtime and developer tooling

- add Intl-backed locale definitions, formatters, catalog loaders, and runtime hooks\n- compile hashed production catalogs from package-scoped catalog sources\n- drive Lingui extraction and compilation directly from project JSON config\n- redesign the devtool with localized controls, draggable persistence, settings, navigation, copy actions, ANSI output, and fullscreen support\n- extend repository APIs, CLI coverage, documentation, and runtime tests
This commit is contained in:
Maofeng
2026-07-30 14:47:42 +08:00
parent 0d0aad1d47
commit 0768e8fa29
55 changed files with 7553 additions and 495 deletions
@@ -0,0 +1,58 @@
import { LanguagesIcon } from "lucide-react"
import { useDevtoolLocalization } from "./devtool-localization"
import { useFloatingTrigger } from "./use-floating-trigger"
export interface I18nDevtoolTriggerProps {
controls?: string
open?: boolean
onOpen: () => void
storageKey?: string
}
export function I18nDevtoolTrigger({
controls = "i18n-devtool-panel",
open = false,
onOpen,
storageKey,
}: I18nDevtoolTriggerProps) {
const floatingTrigger = useFloatingTrigger({ storageKey })
const { messages } = useDevtoolLocalization()
return (
<button
type="button"
aria-controls={controls}
aria-expanded={open}
aria-label={messages.trigger.open}
className="i18n-devtool__trigger"
data-collapsed={floatingTrigger.isCollapsed || undefined}
data-dock={floatingTrigger.dockEdge}
data-dragging={floatingTrigger.isDragging || undefined}
hidden={open}
ref={floatingTrigger.triggerRef}
style={floatingTrigger.style}
onBlur={floatingTrigger.handleBlur}
onClick={(event) => {
if (floatingTrigger.handleClick()) {
event.preventDefault()
return
}
onOpen()
}}
onFocus={floatingTrigger.handleFocus}
onPointerCancel={floatingTrigger.handlePointerCancel}
onPointerDown={floatingTrigger.handlePointerDown}
onPointerEnter={floatingTrigger.handlePointerEnter}
onPointerLeave={floatingTrigger.handlePointerLeave}
onPointerMove={floatingTrigger.handlePointerMove}
onPointerUp={floatingTrigger.handlePointerUp}
>
<span className="i18n-devtool__trigger-icon" aria-hidden="true">
<LanguagesIcon />
</span>
<span className="i18n-devtool__trigger-label">i18n</span>
</button>
)
}