1818from summary .core .config import get_settings
1919from summary .core .file_service import FileService , FileServiceException
2020from summary .core .llm_service import LLMException , LLMObservability , LLMService
21+ from summary .core .locales import get_locale
2122from summary .core .prompt import (
2223 FORMAT_NEXT_STEPS ,
2324 FORMAT_PLAN ,
@@ -121,6 +122,7 @@ def process_audio_transcribe_summarize_v2(
121122 recording_time : Optional [str ],
122123 language : Optional [str ],
123124 download_link : Optional [str ],
125+ context_language : Optional [str ] = None ,
124126):
125127 """Process an audio file by transcribing it and generating a summary.
126128
@@ -129,6 +131,19 @@ def process_audio_transcribe_summarize_v2(
129131 2. Transcribes the audio using WhisperX model
130132 3. Sends the results via webhook
131133
134+ Args:
135+ self: Celery task instance (passed on with bind=True)
136+ owner_id: Unique identifier of the recording owner.
137+ filename: Name of the audio file in MinIO storage.
138+ email: Email address of the recording owner.
139+ sub: OIDC subject identifier of the recording owner.
140+ received_at: Unix timestamp when the recording was received.
141+ room: room name where the recording took place.
142+ recording_date: Date of the recording (localized display string).
143+ recording_time: Time of the recording (localized display string).
144+ language: ISO 639-1 language code for transcription.
145+ download_link: URL to download the original recording.
146+ context_language: ISO 639-1 language code of the meeting summary context text.
132147 """
133148 logger .info (
134149 "Notification received | Owner: %s | Room: %s" ,
@@ -145,6 +160,7 @@ def process_audio_transcribe_summarize_v2(
145160 max_retries = settings .whisperx_max_retries ,
146161 )
147162
163+ # Transcription
148164 try :
149165 with (
150166 file_service .prepare_audio_file (filename ) as (audio_file , metadata ),
@@ -183,7 +199,10 @@ def process_audio_transcribe_summarize_v2(
183199
184200 metadata_manager .track_transcription_metadata (task_id , transcription )
185201
186- formatter = TranscriptFormatter ()
202+ # For locale of context, use in decreasing priority context_language,
203+ # language (of meeting), default context language
204+ locale = get_locale (context_language , language )
205+ formatter = TranscriptFormatter (locale )
187206
188207 content , title = formatter .format (
189208 transcription ,
@@ -221,6 +240,7 @@ def process_audio_transcribe_summarize_v2(
221240
222241 metadata_manager .capture (task_id , settings .posthog_event_success )
223242
243+ # LLM Summarization
224244 if (
225245 analytics .is_feature_enabled ("summary-enabled" , distinct_id = owner_id )
226246 and settings .is_summary_enabled
@@ -336,9 +356,7 @@ def summarize_transcription(
336356 summary = tldr + "\n \n " + cleaned_summary + "\n \n " + next_steps
337357
338358 data = {
339- "title" : settings .summary_title_template .format (
340- title = title ,
341- ),
359+ "title" : settings .summary_title_template .format (title = title ),
342360 "content" : summary ,
343361 "email" : email ,
344362 "sub" : sub ,
0 commit comments