From cee7e78ea635bd3a55cdda714227d84e6b680ab0 Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Thu, 9 Jul 2026 15:42:29 -0700 Subject: [PATCH] Fix RTL layout in debug log and other popup windows --- ts/util/setDocumentLocale.dom.ts | 14 ++++++++++++++ ts/windows/about/app.dom.tsx | 3 +++ ts/windows/calldiagnostic/app.dom.tsx | 3 +++ ts/windows/debuglog/app.dom.tsx | 3 +++ ts/windows/permissions/app.dom.tsx | 3 +++ ts/windows/screenShare/app.dom.tsx | 3 +++ 6 files changed, 29 insertions(+) create mode 100644 ts/util/setDocumentLocale.dom.ts diff --git a/ts/util/setDocumentLocale.dom.ts b/ts/util/setDocumentLocale.dom.ts new file mode 100644 index 0000000000..14dfb3210d --- /dev/null +++ b/ts/util/setDocumentLocale.dom.ts @@ -0,0 +1,14 @@ +// Copyright 2026 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +export function setDocumentLocale(document: Document): void { + document.documentElement.setAttribute( + 'lang', + window.SignalContext.getResolvedMessagesLocale().split(/[-_]/)[0] + ); + + document.documentElement.setAttribute( + 'dir', + window.SignalContext.getResolvedMessagesLocaleDirection() + ); +} diff --git a/ts/windows/about/app.dom.tsx b/ts/windows/about/app.dom.tsx index 62be7cc61d..506ef4654e 100644 --- a/ts/windows/about/app.dom.tsx +++ b/ts/windows/about/app.dom.tsx @@ -7,10 +7,13 @@ import '../sandboxedInit.dom.ts'; import { About } from '../../components/About.dom.tsx'; import { strictAssert } from '../../util/assert.std.ts'; import { AppProvider } from '../AppProvider.dom.tsx'; +import { setDocumentLocale } from '../../util/setDocumentLocale.dom.ts'; const { AboutWindowProps } = window.Signal; const { i18n } = window.SignalContext; +setDocumentLocale(document); + strictAssert(AboutWindowProps, 'window values not provided'); const app = document.getElementById('app'); diff --git a/ts/windows/calldiagnostic/app.dom.tsx b/ts/windows/calldiagnostic/app.dom.tsx index 13c9c85d2d..245d6e3815 100644 --- a/ts/windows/calldiagnostic/app.dom.tsx +++ b/ts/windows/calldiagnostic/app.dom.tsx @@ -7,12 +7,15 @@ import '../sandboxedInit.dom.ts'; import { CallDiagnosticWindow } from '../../components/CallDiagnosticWindow.dom.tsx'; import { strictAssert } from '../../util/assert.std.ts'; import { AppProvider } from '../AppProvider.dom.tsx'; +import { setDocumentLocale } from '../../util/setDocumentLocale.dom.ts'; const { CallDiagnosticWindowProps } = window.Signal; strictAssert(CallDiagnosticWindowProps, 'window values not provided'); const { subscribe, getSnapshot } = CallDiagnosticWindowProps; const { i18n } = window.SignalContext; +setDocumentLocale(document); + function App(): JSX.Element | null { const diagnosticData = useSyncExternalStore(subscribe, getSnapshot); diff --git a/ts/windows/debuglog/app.dom.tsx b/ts/windows/debuglog/app.dom.tsx index 7906d763de..d5d2098f45 100644 --- a/ts/windows/debuglog/app.dom.tsx +++ b/ts/windows/debuglog/app.dom.tsx @@ -6,10 +6,13 @@ import '../sandboxedInit.dom.ts'; import { DebugLogWindow } from '../../components/DebugLogWindow.dom.tsx'; import { strictAssert } from '../../util/assert.std.ts'; import { AppProvider } from '../AppProvider.dom.tsx'; +import { setDocumentLocale } from '../../util/setDocumentLocale.dom.ts'; const { DebugLogWindowProps } = window.Signal; const { i18n } = window.SignalContext; +setDocumentLocale(document); + strictAssert(DebugLogWindowProps, 'window values not provided'); const app = document.getElementById('app'); diff --git a/ts/windows/permissions/app.dom.tsx b/ts/windows/permissions/app.dom.tsx index 58ccf167de..6ba5c26930 100644 --- a/ts/windows/permissions/app.dom.tsx +++ b/ts/windows/permissions/app.dom.tsx @@ -5,10 +5,13 @@ import '../sandboxedInit.dom.ts'; import { PermissionsPopup } from '../../components/PermissionsPopup.dom.tsx'; import { strictAssert } from '../../util/assert.std.ts'; import { AppProvider } from '../AppProvider.dom.tsx'; +import { setDocumentLocale } from '../../util/setDocumentLocale.dom.ts'; const { PermissionsWindowProps } = window.Signal; const { i18n } = window.SignalContext; +setDocumentLocale(document); + strictAssert(PermissionsWindowProps, 'window values not provided'); const { forCalling, forCamera } = PermissionsWindowProps; diff --git a/ts/windows/screenShare/app.dom.tsx b/ts/windows/screenShare/app.dom.tsx index a0bda65f44..5200d8f611 100644 --- a/ts/windows/screenShare/app.dom.tsx +++ b/ts/windows/screenShare/app.dom.tsx @@ -7,10 +7,13 @@ import { strictAssert } from '../../util/assert.std.ts'; import { drop } from '../../util/drop.std.ts'; import { parseEnvironment, setEnvironment } from '../../environment.std.ts'; import { AppProvider } from '../AppProvider.dom.tsx'; +import { setDocumentLocale } from '../../util/setDocumentLocale.dom.ts'; const { ScreenShareWindowProps } = window.Signal; const { i18n } = window.SignalContext; +setDocumentLocale(document); + strictAssert(ScreenShareWindowProps, 'window values not provided'); setEnvironment(