From 3ff255b3f75d3c2d860ccd84aa06032f840ce0e6 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Mon, 13 Jun 2022 21:08:22 +0200 Subject: refactor: Introduce templated translation string for getting logged time today string --- apps/projects/src/app/lib/i18n/en/index.ts | 3 +-- apps/projects/src/app/lib/i18n/i18n-types.ts | 26 ++++++++++---------------- apps/projects/src/app/lib/i18n/nb/index.ts | 3 +-- apps/projects/src/app/pages/home.svelte | 28 +++++++++++++++------------- 4 files changed, 27 insertions(+), 33 deletions(-) (limited to 'apps/projects/src') diff --git a/apps/projects/src/app/lib/i18n/en/index.ts b/apps/projects/src/app/lib/i18n/en/index.ts index 9d74481..a85af7b 100644 --- a/apps/projects/src/app/lib/i18n/en/index.ts +++ b/apps/projects/src/app/lib/i18n/en/index.ts @@ -101,13 +101,12 @@ const en: BaseTranslation = { use: "Use", }, home: { - hourSingleChar: "h", - minSingleChar: "m", confirmDeleteEntry: "Are you sure you want to delete this entry?", newEntry: "New entry", editEntry: "Edit entry", deleteEntry: "Delete entry", loggedTimeToday: "Logged time today", + loggedTimeTodayString: "{hours}h{minutes}m", currentTime: "Current time", loading: "Loading", stopwatch: "Stopwatch", diff --git a/apps/projects/src/app/lib/i18n/i18n-types.ts b/apps/projects/src/app/lib/i18n/i18n-types.ts index b0031f6..acba223 100644 --- a/apps/projects/src/app/lib/i18n/i18n-types.ts +++ b/apps/projects/src/app/lib/i18n/i18n-types.ts @@ -343,14 +343,6 @@ type RootTranslation = { use: string } home: { - /** - * h - */ - hourSingleChar: string - /** - * m - */ - minSingleChar: string /** * Are you sure you want to delete this entry? */ @@ -371,6 +363,12 @@ type RootTranslation = { * Logged time today */ loggedTimeToday: string + /** + * {hours}h{minutes}m + * @param {unknown} hours + * @param {unknown} minutes + */ + loggedTimeTodayString: RequiredParams<'hours' | 'minutes'> /** * Current time */ @@ -748,14 +746,6 @@ export type TranslationFunctions = { use: () => LocalizedString } home: { - /** - * h - */ - hourSingleChar: () => LocalizedString - /** - * m - */ - minSingleChar: () => LocalizedString /** * Are you sure you want to delete this entry? */ @@ -776,6 +766,10 @@ export type TranslationFunctions = { * Logged time today */ loggedTimeToday: () => LocalizedString + /** + * {hours}h{minutes}m + */ + loggedTimeTodayString: (arg: { hours: unknown, minutes: unknown }) => LocalizedString /** * Current time */ diff --git a/apps/projects/src/app/lib/i18n/nb/index.ts b/apps/projects/src/app/lib/i18n/nb/index.ts index 28e4bc1..1638345 100644 --- a/apps/projects/src/app/lib/i18n/nb/index.ts +++ b/apps/projects/src/app/lib/i18n/nb/index.ts @@ -101,8 +101,7 @@ const nb: Translation = { use: "Bruk", }, home: { - hourSingleChar: "t", - minSingleChar: "m", + loggedTimeTodayString: "{hours}t{minutes}m", confirmDeleteEntry: "Er du sikker på at du vil slette denne raden?", newEntry: "Ny tidsoppføring", editEntry: "Rediger rad", diff --git a/apps/projects/src/app/pages/home.svelte b/apps/projects/src/app/pages/home.svelte index ff52275..145ae66 100644 --- a/apps/projects/src/app/pages/home.svelte +++ b/apps/projects/src/app/pages/home.svelte @@ -1,25 +1,26 @@