Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(export): localize the own-voice speaker label in transcripts

Henry Subd8dc32055a5
diff --git a/src/helpers/transcriptFormatter.js b/src/helpers/transcriptFormatter.js
index 5432539ed..264528f57 100644
--- a/src/helpers/transcriptFormatter.js
+++ b/src/helpers/transcriptFormatter.js
@@ -3,7 +3,10 @@ const { i18nMain } = require("./i18nMain");
function resolveSpeaker(seg, speakerMappings) {
if (seg.speakerName && !seg.speakerIsPlaceholder) return seg.speakerName;
if (seg.speaker && speakerMappings[seg.speaker]) return speakerMappings[seg.speaker];
- if (seg.speaker === "you") return "You";
+ // Diarization stamps mic segments with "you"; segments it never touched fall
+ // through to the source check below. Both are the speaker, so both resolve
+ // through the same key — otherwise one person renders under two names.
+ if (seg.speaker === "you") return i18nMain.t("transcript.speaker.you");
if (seg.speaker) {
const num = parseInt(seg.speaker.replace("speaker_", ""), 10);
if (!isNaN(num)) return `Speaker ${num + 1}`;
diff --git a/test/helpers/transcriptFormatter.test.js b/test/helpers/transcriptFormatter.test.js
index 1635f473f..225f76604 100644
--- a/test/helpers/transcriptFormatter.test.js
+++ b/test/helpers/transcriptFormatter.test.js
@@ -7,6 +7,7 @@ const {
formatJson,
formatMd,
} = require("../../src/helpers/transcriptFormatter");
+const { changeLanguage } = require("../../src/helpers/i18nMain");
test("TXT and Markdown exports include participant display names", () => {
const note = {
@@ -177,3 +178,53 @@ test("a manually named segment does not absorb the adjacent un-named one", () =>
assert.ok(txtOutput.includes("[00:00:00] Alice:\nAlice said this."));
assert.ok(txtOutput.includes("[00:00:01] You:\nAnd this is me talking."));
});
+
+test("own-voice segments share one label whether or not diarization stamped them", (t) => {
+ // Diarization stamps mic segments with speaker "you"; a transcript saved
+ // before (or without) it keeps the un-stamped shape. Both are the same
+ // person and must render identically under any UI language.
+ changeLanguage("de");
+ t.after(() => changeLanguage("en"));
+
+ const note = { title: "Standup", created_at: "2026-01-01T00:00:00Z" };
+ const segments = [
+ { source: "mic", speaker: "you", timestamp: 0, text: "Guten Morgen." },
+ { source: "mic", timestamp: 3, text: "Noch etwas." },
+ { source: "system", speaker: "speaker_0", timestamp: 8, text: "Hallo." },
+ ];
+
+ const txtOutput = formatTxt(note, segments, {});
+ assert.ok(txtOutput.includes("[00:00:00] Du:\nGuten Morgen."));
+ assert.ok(txtOutput.includes("[00:00:03] Du:\nNoch etwas."));
+ assert.ok(!txtOutput.includes("You:"));
+});
+
+test("the JSON export counts both own-voice segment shapes as one speaker", (t) => {
+ changeLanguage("de");
+ t.after(() => changeLanguage("en"));
+
+ const parsed = JSON.parse(
+ formatJson(
+ { title: "Standup", created_at: "2026-01-01T00:00:00Z" },
+ [
+ { source: "mic", speaker: "you", timestamp: 0, text: "Guten Morgen." },
+ { source: "mic", timestamp: 3, text: "Noch etwas." },
+ { source: "system", speaker: "speaker_0", timestamp: 8, text: "Hallo." },
+ ],
+ {}
+ )
+ );
+
+ assert.deepEqual(parsed.speakers, ["Du", "Speaker 1"]);
+ assert.equal(parsed.metadata.speaker_count, 2);
+});
+
+test("an explicit speaker mapping still overrides the own-voice label", () => {
+ const txtOutput = formatTxt(
+ { title: "Standup", created_at: "2026-01-01T00:00:00Z" },
+ [{ source: "mic", speaker: "you", timestamp: 0, text: "Morning." }],
+ { you: "Ada" }
+ );
+
+ assert.ok(txtOutput.includes("[00:00:00] Ada:\nMorning."));
+});