From 63273ae0189213aa6d09e4698c70317e02c76dda Mon Sep 17 00:00:00 2001 From: samin-z Date: Fri, 27 Mar 2026 11:04:26 +0100 Subject: [PATCH] video recording in selected language Signed-off-by: samin-z --- src/hooks/useRecording.ts | 5 +++-- src/stores/useLangStore.ts | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/hooks/useRecording.ts b/src/hooks/useRecording.ts index c6b03cab..76e82bf1 100644 --- a/src/hooks/useRecording.ts +++ b/src/hooks/useRecording.ts @@ -13,7 +13,7 @@ import { generateUrl } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' import type { CollaborationSocket } from '../types/collaboration' import type { RecordingHookState, RecordingState, RecordingUser } from '../types/recording' -import { t } from '@nextcloud/l10n' +import { getLanguage, t } from '@nextcloud/l10n' interface UseRecordingProps { fileId: number @@ -388,7 +388,8 @@ export function useRecording({ fileId }: UseRecordingProps): RecordingHookState // Generate recording URL using existing JWT (absolute URL for Puppeteer) const relativeUrl = generateUrl(`apps/whiteboard/recording/${fileId}/${jwtPayload.userid}`) - const recordingUrl = `${window.location.origin}${relativeUrl}?token=${jwt}` + const language = encodeURIComponent(getLanguage() || 'en') + const recordingUrl = `${window.location.origin}${relativeUrl}?token=${jwt}&lang=${language}` // Tell Node.js to start recording with the URL and existing JWT updateState({ startingPhase: 'initializing' }) diff --git a/src/stores/useLangStore.ts b/src/stores/useLangStore.ts index 00e21c6d..1d955df0 100644 --- a/src/stores/useLangStore.ts +++ b/src/stores/useLangStore.ts @@ -35,6 +35,15 @@ function mapNextcloudToExcalidrawLang(nextcloudLang: string): string { return 'en' } +function getLangFromQuery(): string | null { + if (typeof window === 'undefined') { + return null + } + + const queryLang = new URLSearchParams(window.location.search).get('lang') + return queryLang?.trim() || null +} + interface ExcalidrawLangStore { lang: string updateLang: () => void @@ -42,10 +51,10 @@ interface ExcalidrawLangStore { } export const useLangStore = create()((set) => ({ - lang: mapNextcloudToExcalidrawLang(getLanguage()), + lang: mapNextcloudToExcalidrawLang(getLangFromQuery() || getLanguage()), updateLang: () => { - const nextcloudLang = getLanguage() + const nextcloudLang = getLangFromQuery() || getLanguage() set({ lang: mapNextcloudToExcalidrawLang(nextcloudLang) }) },