feat: localize voice guidance
This commit is contained in:
@ -1,6 +1,11 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"language": "Deutsch - German",
|
||||
"language": {
|
||||
"name": "Deutsch - German",
|
||||
"tts": "de",
|
||||
"speechSynthesis": "de-DE",
|
||||
"valhalla": "de"
|
||||
},
|
||||
"saved": {
|
||||
"home": "Heim",
|
||||
"school": "Schule",
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"language": "English",
|
||||
"language": {
|
||||
"name": "English",
|
||||
"tts": "en",
|
||||
"speechSynthesis": "en-US",
|
||||
"valhalla": "en"
|
||||
},
|
||||
"save": "Save",
|
||||
"cancel": "Cancel",
|
||||
"loading": "Loading...",
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
<div id="languages">
|
||||
{#each locales as locale, _index (locale)}
|
||||
{#if locale == getLocale()}
|
||||
<SettingsButton text={m.language()} icon={CheckIcon} disabled />
|
||||
<SettingsButton text={m["language.name"]()} icon={CheckIcon} disabled />
|
||||
{:else}
|
||||
<SettingsButton
|
||||
text={m.language({}, { locale })}
|
||||
text={m["language.name"]({}, { locale })}
|
||||
icon={LanguagesIcon}
|
||||
onclick={() => {
|
||||
setLocale(locale);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { duck, unduck } from "tauri-plugin-duck-api";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { m } from "$lang/messages";
|
||||
|
||||
export let tts: "tauri" | "web" | null = null;
|
||||
|
||||
@ -23,14 +24,14 @@ export default async function say(text: string) {
|
||||
duck();
|
||||
if (tts !== "web") {
|
||||
try {
|
||||
await invoke("plugin:tts|speak", { text });
|
||||
await invoke("plugin:tts|speak", { text, lang: m["language.tts"]() });
|
||||
} catch (e) {
|
||||
console.error("Error speaking text", e);
|
||||
alert(e);
|
||||
}
|
||||
} else {
|
||||
const utterance = new SpeechSynthesisUtterance(text);
|
||||
utterance.lang = "de-DE";
|
||||
utterance.lang = m["language.speechSynthesis"]();
|
||||
window.speechSynthesis.speak(utterance);
|
||||
}
|
||||
unduck();
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { m } from "$lang/messages";
|
||||
import type {
|
||||
ValhallaCosting,
|
||||
ValhallaCostingOptions,
|
||||
@ -63,7 +64,7 @@ export function createValhallaRequest(
|
||||
costing,
|
||||
units: "kilometers",
|
||||
alternates: 2,
|
||||
language: "de-DE",
|
||||
language: m["language.valhalla"](),
|
||||
costing_options: costingOptions,
|
||||
turn_lanes: true,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user