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:
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user