Display speaker IDs starting from 1 instead of 0#4660
Conversation
Updated all locations where speaker IDs are displayed to users: - transcript_segment.dart: segmentsAsString method - transcript.dart: speaker label in transcript widget - desktop_recording_widget.dart: speaker label in desktop recording - name_speaker_sheet.dart: tag speaker dialog title - desktop_name_speaker_dialog.dart: tag speaker dialog title Also updated tests to expect the new numbering. Backend remains unchanged - speaker IDs are still stored as 0, 1, 2, etc. Only the display layer adds 1 for user-facing representation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request correctly implements the display of speaker IDs starting from 1 instead of 0, which improves user experience. The changes are applied consistently across various UI components. However, I've identified two instances where the 'Speaker' label is hardcoded instead of using the localization framework. This would prevent translation of these labels. I've added comments with suggestions to use the existing l10n keys to ensure full internationalization support.
| speakerName = peopleMap[segment.personId]!; | ||
| } else { | ||
| speakerName = 'Speaker ${segment.speakerId}'; | ||
| speakerName = 'Speaker ${segment.speakerId + 1}'; |
There was a problem hiding this comment.
The string 'Speaker ' is hardcoded, which prevents localization. To ensure the app can be translated into other languages, you should use the internationalization key speakerWithId available through context.l10n.
This method is static and doesn't have access to BuildContext. Consider refactoring segmentsAsString and its callers (getLastTranscript, _processText) to accept a BuildContext to allow for localization.
Once refactored, this line could be:
speakerName = context.l10n.speakerWithId((segment.speakerId + 1).toString());
A similar issue exists on line 197 with the hardcoded string 'User'.
app/lib/widgets/transcript.dart
Outdated
| data.speakerId == omiSpeakerId | ||
| ? 'omi' | ||
| : (person?.name ?? 'Speaker ${data.speakerId + 1}'), |
There was a problem hiding this comment.
The string 'Speaker ' is hardcoded here, which is not ideal for internationalization. You should use the speakerWithId localization key to support multiple languages, similar to how it's used in desktop_recording_widget.dart.
| data.speakerId == omiSpeakerId | |
| ? 'omi' | |
| : (person?.name ?? 'Speaker ${data.speakerId + 1}'), | |
| data.speakerId == omiSpeakerId | |
| ? 'omi' | |
| : (person?.name ?? context.l10n.speakerWithId((data.speakerId + 1).toString())), |
…missing Previously, speaker IDs were displayed by simply adding 1 (speaker 0 → "Speaker 1", speaker 1 → "Speaker 2", etc.). This caused issues when a conversation didn't have speaker 0 at all (e.g., only speakers 1, 2, 3), which would display as "Speaker 2, Speaker 3, Speaker 4" and confuse users. Now, speaker IDs are normalized based on the minimum speaker ID present in each conversation, ensuring they always start from 1: - Speakers [0, 1, 2] → Display [1, 2, 3] (unchanged) - Speakers [1, 2, 3] → Display [1, 2, 3] (normalized) - Speakers [5, 6] → Display [1, 2] (normalized) Changes: - Added TranscriptSegment.getDisplaySpeakerId() helper method that normalizes speaker IDs by finding the minimum speaker ID and adjusting all displays - Updated all locations where speaker IDs are displayed to use the new helper: - transcript.dart: Main transcript display - transcript_segment.dart: Text export functionality - desktop_recording_widget.dart: Desktop live recording view - desktop_name_speaker_dialog.dart: Desktop speaker tagging dialog - name_speaker_sheet.dart: Mobile speaker tagging sheet This change only affects UI display; backend speaker_id values remain unchanged, ensuring speaker assignment functionality continues to work correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
Technical Details
This is a display-only change - no backend modifications required:
Files Changed
app/lib/backend/schema/transcript_segment.dart: segmentsAsString methodapp/lib/widgets/transcript.dart: speaker label in transcript widgetapp/lib/desktop/pages/conversations/widgets/desktop_recording_widget.dart: desktop recording speaker labelsapp/lib/pages/conversation_detail/widgets/name_speaker_sheet.dart: tag speaker dialogapp/lib/desktop/pages/conversations/widgets/desktop_name_speaker_dialog.dart: desktop tag speaker dialogapp/test/widgets/transcript_test.dart: updated test expectationsTest Plan
🤖 Generated with Claude Code