summaryrefslogtreecommitdiffstats
path: root/apps/projects/src/app/lib
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-06-10 00:35:22 +0200
committerivarlovlie <git@ivarlovlie.no>2022-06-10 00:35:22 +0200
commit21764214c257949844d87e445f1a9f2736a20561 (patch)
tree9fb2369ea92a53c6ba19825424693c73aab7c1e1 /apps/projects/src/app/lib
parentf6156d9137d4c07dd7afc8c3288dc00879db0b73 (diff)
downloadgreatoffice-21764214c257949844d87e445f1a9f2736a20561.tar.xz
greatoffice-21764214c257949844d87e445f1a9f2736a20561.zip
feat: Add translations to stopwatch.svelte
This commit also demonstrates how to do i18n across apps.
Diffstat (limited to 'apps/projects/src/app/lib')
-rw-r--r--apps/projects/src/app/lib/i18n/i18n-types.ts16
-rw-r--r--apps/projects/src/app/lib/i18n/nb/index.ts8
-rw-r--r--apps/projects/src/app/lib/stores/locale.ts21
3 files changed, 20 insertions, 25 deletions
diff --git a/apps/projects/src/app/lib/i18n/i18n-types.ts b/apps/projects/src/app/lib/i18n/i18n-types.ts
index f9fd9cc..b0031f6 100644
--- a/apps/projects/src/app/lib/i18n/i18n-types.ts
+++ b/apps/projects/src/app/lib/i18n/i18n-types.ts
@@ -117,6 +117,10 @@ type RootTranslation = {
* No categories
*/
noCategories: string
+ /**
+ * Categories
+ */
+ categories: string
}
settingsLabelsTile: {
/**
@@ -152,6 +156,10 @@ type RootTranslation = {
* No labels
*/
noLabels: string
+ /**
+ * Labels
+ */
+ labels: string
}
entryForm: {
/**
@@ -516,6 +524,10 @@ export type TranslationFunctions = {
* No categories
*/
noCategories: () => LocalizedString
+ /**
+ * Categories
+ */
+ categories: () => LocalizedString
}
settingsLabelsTile: {
/**
@@ -551,6 +563,10 @@ export type TranslationFunctions = {
* No labels
*/
noLabels: () => LocalizedString
+ /**
+ * Labels
+ */
+ labels: () => LocalizedString
}
entryForm: {
/**
diff --git a/apps/projects/src/app/lib/i18n/nb/index.ts b/apps/projects/src/app/lib/i18n/nb/index.ts
index af3a487..28e4bc1 100644
--- a/apps/projects/src/app/lib/i18n/nb/index.ts
+++ b/apps/projects/src/app/lib/i18n/nb/index.ts
@@ -104,16 +104,16 @@ const nb: Translation = {
hourSingleChar: "t",
minSingleChar: "m",
confirmDeleteEntry: "Er du sikker på at du vil slette denne raden?",
- newEntry: "Ny rad",
+ newEntry: "Ny tidsoppføring",
editEntry: "Rediger rad",
deleteEntry: "Slett rad",
loggedTimeToday: "Registrert tid hittil idag",
currentTime: "Klokken",
loading: "Laster",
stopwatch: "Stoppeklokke",
- todayEntries: "Dagens rader",
- noEntriesToday: "Ingen rader i dag",
- refreshTodayEntries: "Last inn dagens rader på nytt",
+ todayEntries: "Dagens tidsoppføringer",
+ noEntriesToday: "Ingen oppføringer i dag",
+ refreshTodayEntries: "Last inn dagens tidsoppføringer på nytt",
category: "Kategori",
timespan: "Tidsrom",
},
diff --git a/apps/projects/src/app/lib/stores/locale.ts b/apps/projects/src/app/lib/stores/locale.ts
deleted file mode 100644
index 1215c20..0000000
--- a/apps/projects/src/app/lib/stores/locale.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import {base_domain, CookieNames} from "$shared/lib/configuration";
-import {get_cookie, set_cookie} from "$shared/lib/helpers";
-import {writable} from "svelte/store";
-import type {Locales} from "$app/lib/i18n/i18n-types";
-
-export function preffered_or_default(): Locales {
- if (/^en\b/i.test(navigator.language)) {
- return "en";
- }
- if (/^nb\b/i.test(navigator.language) || /^nn\b/i.test(navigator.language)) {
- return "nb";
- }
- return "en";
-}
-
-export const currentLocale = writable<Locales>((get_cookie(CookieNames.locale) ?? preffered_or_default()) as Locales);
-currentLocale.subscribe(locale => {
- //@ts-ignore
- if (locale === "preffered") set_cookie(CookieNames.locale, preffered_or_default(), base_domain());
- set_cookie(CookieNames.locale, locale, base_domain());
-});