diff --git a/src/helpers/hourToSalutation.test.ts b/src/helpers/hourToSalutation.test.ts index ba153019c..3297f71bc 100644 --- a/src/helpers/hourToSalutation.test.ts +++ b/src/helpers/hourToSalutation.test.ts @@ -11,23 +11,23 @@ const dateWithHour = (hours: number): Date => { describe('Salutation', () => { it('shows the right salutation in the night', () => { const salutation = hourToSalutation(dateWithHour(4)) - expect(salutation).toBe('Night') + expect(salutation).toBe('home.welcomeNight') }) it('shows the right salutation in the morning', () => { const salutation = hourToSalutation(dateWithHour(8)) - expect(salutation).toBe('Morning') + expect(salutation).toBe('home.welcomeMorning') }) it('shows the right salutation in the day', () => { const salutation = hourToSalutation(dateWithHour(13)) - expect(salutation).toBe('Day') + expect(salutation).toBe('home.welcomeDay') }) it('shows the right salutation in the night', () => { const salutation = hourToSalutation(dateWithHour(20)) - expect(salutation).toBe('Evening') + expect(salutation).toBe('home.welcomeEvening') }) it('shows the right salutation in the night again', () => { const salutation = hourToSalutation(dateWithHour(23)) - expect(salutation).toBe('Night') + expect(salutation).toBe('home.welcomeNight') }) }) diff --git a/src/helpers/hourToSalutation.ts b/src/helpers/hourToSalutation.ts index b05762db1..96eca46cc 100644 --- a/src/helpers/hourToSalutation.ts +++ b/src/helpers/hourToSalutation.ts @@ -1,21 +1,23 @@ +const TRANSLATION_KEY_PREFIX = 'home.welcome' + export function hourToSalutation(now: Date = new Date()): String { const hours = new Date(now).getHours() if (hours < 5) { - return 'Night' + return `${TRANSLATION_KEY_PREFIX}Night` } if (hours < 11) { - return 'Morning' + return `${TRANSLATION_KEY_PREFIX}Morning` } if (hours < 18) { - return 'Day' + return `${TRANSLATION_KEY_PREFIX}Day` } if (hours < 23) { - return 'Evening' + return `${TRANSLATION_KEY_PREFIX}Evening` } - return 'Night' + return `${TRANSLATION_KEY_PREFIX}Night` } diff --git a/src/views/Home.vue b/src/views/Home.vue index 7696349e9..bb1449221 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,7 +1,7 @@