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