ipa convert
This commit is contained in:
@@ -363,7 +363,7 @@ export const CONVERSATION_PRESETS = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const IPA_MAPPING = {
|
export const IPA_MAPPING: { [key: string]: string } = {
|
||||||
p: "p",
|
p: "p",
|
||||||
b: "b",
|
b: "b",
|
||||||
t: "t",
|
t: "t",
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import { useEffect, useState, useContext } from "react";
|
import { useEffect, useState, useContext } from "react";
|
||||||
import { MediaPlayerProviderContext } from "@renderer/context";
|
import { MediaPlayerProviderContext } from "@renderer/context";
|
||||||
import cloneDeep from "lodash/cloneDeep";
|
import cloneDeep from "lodash/cloneDeep";
|
||||||
import {
|
import { Button, toast, ScrollArea, Separator } from "@renderer/components/ui";
|
||||||
Button,
|
|
||||||
toast,
|
|
||||||
ScrollArea,
|
|
||||||
Separator,
|
|
||||||
} from "@renderer/components/ui";
|
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import { LanguagesIcon, SpeechIcon } from "lucide-react";
|
import { LanguagesIcon, SpeechIcon } from "lucide-react";
|
||||||
import { Timeline } from "echogarden/dist/utilities/Timeline.d.js";
|
import { Timeline } from "echogarden/dist/utilities/Timeline.d.js";
|
||||||
@@ -356,7 +351,11 @@ export const MediaCaption = () => {
|
|||||||
{displayIpa && (
|
{displayIpa && (
|
||||||
<div className="text-muted-foreground">
|
<div className="text-muted-foreground">
|
||||||
{caption.timeline[index].timeline
|
{caption.timeline[index].timeline
|
||||||
.map((t) => t.timeline.map((s) => s.text).join(""))
|
.map((t) =>
|
||||||
|
t.timeline
|
||||||
|
.map((s) => IPA_MAPPING[s.text] || s.text)
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
.join(" · ")}
|
.join(" · ")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -381,7 +380,11 @@ export const MediaCaption = () => {
|
|||||||
{displayIpa && (
|
{displayIpa && (
|
||||||
<div className="text-muted-foreground">
|
<div className="text-muted-foreground">
|
||||||
{w.timeline
|
{w.timeline
|
||||||
.map((t) => t.timeline.map((s) => s.text).join(""))
|
.map((t) =>
|
||||||
|
t.timeline
|
||||||
|
.map((s) => IPA_MAPPING[s.text] || s.text)
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
.join(" · ")}
|
.join(" · ")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -413,9 +416,24 @@ export const MediaCaption = () => {
|
|||||||
{word.text}
|
{word.text}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm text-serif text-muted-foreground">
|
<div className="text-sm text-serif text-muted-foreground">
|
||||||
{word.timeline
|
<span className="mr-2">
|
||||||
.map((t) => t.timeline.map((s) => s.text).join(""))
|
/
|
||||||
.join(" · ")}
|
{word.timeline
|
||||||
|
.map((t) =>
|
||||||
|
t.timeline
|
||||||
|
.map((s) => IPA_MAPPING[s.text] || s.text)
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
|
.join(" · ")}
|
||||||
|
/,
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
/
|
||||||
|
{word.timeline
|
||||||
|
.map((t) => t.timeline.map((s) => s.text).join(""))
|
||||||
|
.join(" · ")}
|
||||||
|
/
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user