# feat(i18n): Hebrew locale + full RTL support ## Summary This PR adds full Hebrew (he) locale support to the UI, including a complete translation of all user-facing strings and comprehensive RTL layout support across all components. ## What was done ### Hebrew translation - Full translation of all i18n message files for the `he` locale (17 translation files) - Registered the language in the i18n system and the language picker ### RTL support - Automatic direction detection (`dir="rtl"`) when Hebrew is selected - Replaced physical CSS properties (`left`/`right`) with logical equivalents (`inline-start`/`inline-end`) across the project - Fixed resize direction, file path alignment, and textarea padding - Fixed navigation button positioning in textarea for RTL - Fixed scrollbar direction in RTL - Fixed code block direction and selector alignment - Fixed Monaco editor direction in the file viewer - Auto-detect text direction in reasoning block (`dir="auto"` + `unicode-bidi: plaintext`) ### Adapted components - `session-layout` — sidebar and resize handle - `prompt-input` — text direction and buttons - `message-base` — message blocks and reasoning - `message-timeline` — timeline bar - `right-panel` — right side panel - `tool-call` — tool call display - `settings-screen` — settings page - `selector` — selection component - `instance-shell` — main shell ## New files ``` packages/ui/src/lib/i18n/messages/he/ advancedSettings.ts app.ts commands.ts dialogs.ts filesystem.ts folderSelection.ts index.ts instance.ts loadingScreen.ts logs.ts markdown.ts messaging.ts remoteAccess.ts session.ts settings.ts time.ts toolCall.ts ``` ## Suggested testing - Switch language to Hebrew and verify all strings are translated - Verify RTL layout is correct across all screens (session, settings, file viewer) - Verify that English text inside a reasoning block is displayed LTR - Switch back to English and verify everything returns to LTR --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Shantur Rathore <i@shantur.com>
116 lines
3.4 KiB
TypeScript
116 lines
3.4 KiB
TypeScript
import { createSignal, onCleanup, type Accessor, type Setter } from "solid-js"
|
|
|
|
import { useGlobalPointerDrag } from "./useGlobalPointerDrag"
|
|
|
|
type DrawerResizeSide = "left" | "right"
|
|
|
|
type DrawerResizeOptions = {
|
|
sessionSidebarWidth: Accessor<number>
|
|
rightDrawerWidth: Accessor<number>
|
|
setSessionSidebarWidth: Setter<number>
|
|
setRightDrawerWidth: Setter<number>
|
|
clampLeft: (width: number) => number
|
|
clampRight: (width: number) => number
|
|
measureDrawerHost: () => void
|
|
}
|
|
|
|
type DrawerResizeApi = {
|
|
handleDrawerResizeMouseDown: (side: DrawerResizeSide) => (event: MouseEvent) => void
|
|
handleDrawerResizeTouchStart: (side: DrawerResizeSide) => (event: TouchEvent) => void
|
|
}
|
|
|
|
export function useDrawerResize(options: DrawerResizeOptions): DrawerResizeApi {
|
|
const [activeResizeSide, setActiveResizeSide] = createSignal<DrawerResizeSide | null>(null)
|
|
const [resizeStartX, setResizeStartX] = createSignal(0)
|
|
const [resizeStartWidth, setResizeStartWidth] = createSignal(0)
|
|
|
|
const scheduleDrawerMeasure = () => {
|
|
if (typeof window === "undefined") {
|
|
options.measureDrawerHost()
|
|
return
|
|
}
|
|
requestAnimationFrame(() => options.measureDrawerHost())
|
|
}
|
|
|
|
const applyDrawerWidth = (side: DrawerResizeSide, width: number) => {
|
|
if (side === "left") {
|
|
options.setSessionSidebarWidth(width)
|
|
} else {
|
|
options.setRightDrawerWidth(width)
|
|
}
|
|
scheduleDrawerMeasure()
|
|
}
|
|
|
|
const handleDrawerPointerMove = (clientX: number) => {
|
|
const side = activeResizeSide()
|
|
if (!side) return
|
|
const startWidth = resizeStartWidth()
|
|
const clamp = side === "left" ? options.clampLeft : options.clampRight
|
|
const isRtl = typeof document !== "undefined" && document.documentElement.dir === "rtl"
|
|
const rawDelta = side === "left" ? clientX - resizeStartX() : resizeStartX() - clientX
|
|
const delta = isRtl ? -rawDelta : rawDelta
|
|
const nextWidth = clamp(startWidth + delta)
|
|
applyDrawerWidth(side, nextWidth)
|
|
}
|
|
|
|
function drawerMouseMove(event: MouseEvent) {
|
|
event.preventDefault()
|
|
handleDrawerPointerMove(event.clientX)
|
|
}
|
|
|
|
function drawerMouseUp() {
|
|
stopDrawerResize()
|
|
}
|
|
|
|
function drawerTouchMove(event: TouchEvent) {
|
|
const touch = event.touches[0]
|
|
if (!touch) return
|
|
event.preventDefault()
|
|
handleDrawerPointerMove(touch.clientX)
|
|
}
|
|
|
|
function drawerTouchEnd() {
|
|
stopDrawerResize()
|
|
}
|
|
|
|
const drawerPointerDrag = useGlobalPointerDrag({
|
|
onMouseMove: drawerMouseMove,
|
|
onMouseUp: drawerMouseUp,
|
|
onTouchMove: drawerTouchMove,
|
|
onTouchEnd: drawerTouchEnd,
|
|
})
|
|
|
|
function stopDrawerResize() {
|
|
setActiveResizeSide(null)
|
|
drawerPointerDrag.stop()
|
|
}
|
|
|
|
const startDrawerResize = (side: DrawerResizeSide, clientX: number) => {
|
|
setActiveResizeSide(side)
|
|
setResizeStartX(clientX)
|
|
setResizeStartWidth(side === "left" ? options.sessionSidebarWidth() : options.rightDrawerWidth())
|
|
drawerPointerDrag.start()
|
|
}
|
|
|
|
const handleDrawerResizeMouseDown = (side: DrawerResizeSide) => (event: MouseEvent) => {
|
|
event.preventDefault()
|
|
startDrawerResize(side, event.clientX)
|
|
}
|
|
|
|
const handleDrawerResizeTouchStart = (side: DrawerResizeSide) => (event: TouchEvent) => {
|
|
const touch = event.touches[0]
|
|
if (!touch) return
|
|
event.preventDefault()
|
|
startDrawerResize(side, touch.clientX)
|
|
}
|
|
|
|
onCleanup(() => {
|
|
stopDrawerResize()
|
|
})
|
|
|
|
return {
|
|
handleDrawerResizeMouseDown,
|
|
handleDrawerResizeTouchStart,
|
|
}
|
|
}
|