Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/hooks/useRecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' })
Expand Down
13 changes: 11 additions & 2 deletions src/stores/useLangStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,26 @@ 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
setLang: (lang: string) => void
}

export const useLangStore = create<ExcalidrawLangStore>()((set) => ({
lang: mapNextcloudToExcalidrawLang(getLanguage()),
lang: mapNextcloudToExcalidrawLang(getLangFromQuery() || getLanguage()),

updateLang: () => {
const nextcloudLang = getLanguage()
const nextcloudLang = getLangFromQuery() || getLanguage()
set({ lang: mapNextcloudToExcalidrawLang(nextcloudLang) })
},

Expand Down
Loading