summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/web-shared/src/components/stopwatch.svelte28
-rw-r--r--apps/web-shared/src/lib/i18n/en/index.ts7
-rw-r--r--apps/web-shared/src/lib/i18n/i18n-types.ts28
-rw-r--r--apps/web-shared/src/lib/i18n/nb/index.ts4
4 files changed, 51 insertions, 16 deletions
diff --git a/apps/web-shared/src/components/stopwatch.svelte b/apps/web-shared/src/components/stopwatch.svelte
index 1c602c8..0e641e8 100644
--- a/apps/web-shared/src/components/stopwatch.svelte
+++ b/apps/web-shared/src/components/stopwatch.svelte
@@ -1,14 +1,13 @@
<script lang="ts">
import Button from "$shared/components/button.svelte";
- import {Textarea} from "$shared/components/form";
- import {StorageKeys} from "$shared/lib/configuration";
- import {TranslationFunctions} from "$shared/lib/i18n/i18n-types";
- import {loadLocaleAsync} from "$shared/lib/i18n/i18n-util.async";
- import {i18nObject} from "$shared/lib/i18n/i18n-util";
- import {currentLocale} from "$shared/lib/locale";
- import {StoreType, writable_persistent} from "$shared/lib/persistent-store";
- import {Temporal} from "@js-temporal/polyfill";
- import {createEventDispatcher, onMount} from "svelte";
+ import { Textarea } from "$shared/components/form";
+ import { StorageKeys } from "$shared/lib/configuration";
+ import { loadLocaleAsync } from "$shared/lib/i18n/i18n-util.async";
+ import { i18nObject } from "$shared/lib/i18n/i18n-util";
+ import { currentLocale, preffered_or_default } from "$shared/lib/locale";
+ import { StoreType, writable_persistent } from "$shared/lib/persistent-store";
+ import { Temporal } from "@js-temporal/polyfill";
+ import { createEventDispatcher, onMount } from "svelte";
const state = writable_persistent({
initialState: {
@@ -38,9 +37,10 @@
timeString = "--:--:--";
}
- currentLocale.subscribe(async val => {
- await loadLocaleAsync(val);
- LL = i18nObject(val);
+ currentLocale.subscribe(async locale => {
+ if (locale === "preffered") locale = preffered_or_default();
+ await loadLocaleAsync(locale);
+ LL = i18nObject(locale);
});
onMount(async () => {
@@ -158,8 +158,8 @@
<pre class="text-xxl padding-y-sm">{timeString}</pre>
</div>
<div class="col-6 flex align-bottom flex-column text-xs">
- <Button title="{$state.isRunning ? 'Stop' : 'Start'}"
- text="{$state.isRunning ? 'Stop' : 'Start'}"
+ <Button title="{$state.isRunning ? LL.stopwatch.stop() : LL.stopwatch.start()}"
+ text="{$state.isRunning ? LL.stopwatch.stop() : LL.stopwatch.start()}"
variant="link"
on:click={on_start_stop}/>
diff --git a/apps/web-shared/src/lib/i18n/en/index.ts b/apps/web-shared/src/lib/i18n/en/index.ts
index 65fc0df..9db1759 100644
--- a/apps/web-shared/src/lib/i18n/en/index.ts
+++ b/apps/web-shared/src/lib/i18n/en/index.ts
@@ -6,7 +6,12 @@ const en: BaseTranslation = {
roundDown: "Round down",
createEntry: "Create entry",
whatsYourFocus: "What's your focus?",
- reset: "Reset"
+ reset: "Reset",
+ start: "Start",
+ stop: "Stop",
+ },
+ localeSwitcher: {
+ language: "Language"
}
};
diff --git a/apps/web-shared/src/lib/i18n/i18n-types.ts b/apps/web-shared/src/lib/i18n/i18n-types.ts
index 2048802..62a13dd 100644
--- a/apps/web-shared/src/lib/i18n/i18n-types.ts
+++ b/apps/web-shared/src/lib/i18n/i18n-types.ts
@@ -35,6 +35,20 @@ type RootTranslation = {
* Reset
*/
reset: string
+ /**
+ * Start
+ */
+ start: string
+ /**
+ * Stop
+ */
+ stop: string
+ }
+ localeSwitcher: {
+ /**
+ * Language
+ */
+ language: string
}
}
@@ -60,6 +74,20 @@ export type TranslationFunctions = {
* Reset
*/
reset: () => LocalizedString
+ /**
+ * Start
+ */
+ start: () => LocalizedString
+ /**
+ * Stop
+ */
+ stop: () => LocalizedString
+ }
+ localeSwitcher: {
+ /**
+ * Language
+ */
+ language: () => LocalizedString
}
}
diff --git a/apps/web-shared/src/lib/i18n/nb/index.ts b/apps/web-shared/src/lib/i18n/nb/index.ts
index d7f557d..a1d5f53 100644
--- a/apps/web-shared/src/lib/i18n/nb/index.ts
+++ b/apps/web-shared/src/lib/i18n/nb/index.ts
@@ -6,7 +6,9 @@ const nb: Translation = {
roundDown: "Rund ned",
createEntry: "Opprett tidsoppføring",
whatsYourFocus: "Hva skal du fokusere på?",
- reset: "Tilbakestill"
+ reset: "Tilbakestill",
+ start: "Start",
+ stop: "Stopp",
}
};