diff --git a/presenter/.env.dist b/presenter/.env.dist index c70cbf337a..155d848885 100644 --- a/presenter/.env.dist +++ b/presenter/.env.dist @@ -16,5 +16,3 @@ PUBLIC_ENV__ENDPOINTS__GRAPHQL_URI=http://localhost:4000/ # META PUBLIC_ENV__META__BASE_URL="http://localhost:3000" PUBLIC_ENV__META__DEFAULT_AUTHOR="DreamMall Verlag GbR" -PUBLIC_ENV__META__DEFAULT_DESCRIPTION="Deine Reichweite Erweitern Alle Möglichkeiten Miteinander Ausschöpfen Lebensqualität Leben" -PUBLIC_ENV__META__DEFAULT_TITLE="DreamMall" diff --git a/presenter/renderer/utils.ts b/presenter/renderer/utils.ts index 72833d5e31..b42bb38f76 100644 --- a/presenter/renderer/utils.ts +++ b/presenter/renderer/utils.ts @@ -1,19 +1,19 @@ import { PageContext } from 'vike/types' -import { META } from '#src/env' +import i18n from '#plugins/i18n' function getTitle(pageContext: PageContext) { // The value exported by /pages/**/+title.js is available at pageContext.config.title const val = pageContext.config.title if (typeof val === 'string') return val if (typeof val === 'function') return String(val(pageContext)) - return META.DEFAULT_TITLE + return i18n.global.t('meta.defaultTitle') } function getDescription(pageContext: PageContext) { const val = pageContext.config.description if (typeof val === 'string') return val if (typeof val === 'function') return val(pageContext) - return META.DEFAULT_DESCRIPTION + return i18n.global.t('meta.defaultDescription') } export { getTitle, getDescription } diff --git a/presenter/src/env.test.ts b/presenter/src/env.test.ts index 8d5ccadf7f..986905b1a4 100644 --- a/presenter/src/env.test.ts +++ b/presenter/src/env.test.ts @@ -7,9 +7,6 @@ describe('env', () => { expect(META).toEqual({ BASE_URL: 'http://localhost:3000', DEFAULT_AUTHOR: 'DreamMall Verlag GbR', - DEFAULT_DESCRIPTION: - 'Deine Reichweite Erweitern Alle Möglichkeiten Miteinander Ausschöpfen Lebensqualität Leben', - DEFAULT_TITLE: 'DreamMall', }) }) }) diff --git a/presenter/src/env.ts b/presenter/src/env.ts index 52124b7ead..7903da73ef 100644 --- a/presenter/src/env.ts +++ b/presenter/src/env.ts @@ -22,9 +22,6 @@ const META = { BASE_URL: (import.meta.env.PUBLIC_ENV__META__BASE_URL ?? 'http://localhost:3000') as string, DEFAULT_AUTHOR: (import.meta.env.PUBLIC_ENV__META__DEFAULT_AUTHOR ?? 'DreamMall Verlag GbR') as string, - DEFAULT_DESCRIPTION: (import.meta.env.PUBLIC_ENV__META__DEFAULT_DESCRIPTION ?? - 'Deine Reichweite Erweitern Alle Möglichkeiten Miteinander Ausschöpfen Lebensqualität Leben') as string, - DEFAULT_TITLE: (import.meta.env.PUBLIC_ENV__META__DEFAULT_TITLE ?? 'DreamMall') as string, } export { AUTH, ENDPOINTS, META } diff --git a/presenter/src/locales/de.json b/presenter/src/locales/de.json index 61a37d02b9..9fd1923ef2 100644 --- a/presenter/src/locales/de.json +++ b/presenter/src/locales/de.json @@ -1,7 +1,8 @@ { "about": {}, "auth": { - "content": "Logge ein..." + "content": "Logge ein...", + "title": "DreamMall {'|'} Authentifizierung" }, "dataProtection": { "euDispute": { @@ -26,7 +27,8 @@ "revocation": { "content": "Nur mit Ihrer ausdrücklichen Einwilligung sind einige Vorgänge der Datenverarbeitung möglich. Ein Widerruf Ihrer bereits erteilten Einwilligung ist jederzeit möglich. Für den Widerruf genügt eine formlose Mitteilung per E-Mail. Die Rechtmäßigkeit der bis zum Widerruf erfolgten Datenverarbeitung bleibt vom Widerruf unberührt.", "headline": "Widerruf Ihrer Einwilligung zur Datenverarbeitung" - } + }, + "title": "DreamMall {'|'} Datenschutz" }, "error": { "404": { @@ -36,7 +38,8 @@ "500": { "h1": "500 Interner Fehler", "text": "Etwas ist schief gegangen." - } + }, + "title": "DreamMall {'|'} Fehler" }, "home": { "aboutSection": { @@ -161,7 +164,8 @@ "content": "Umsatzsteuer-Identifikationsnummer gemäß § 27 a Umsatzsteuergesetz:", "headline": "Umsatzsteuer-ID", "id": "DE356946303" - } + }, + "title": "DreamMall {'|'} Impressum" }, "menu": { "eMail": "E-Mail", @@ -202,6 +206,10 @@ "sitemap": "Sitemap" } }, + "meta": { + "defaultDescription": "Deine Reichweite Erweitern Alle Möglichkeiten Miteinander Ausschöpfen Lebensqualität Leben", + "defaultTitle": "DreamMall" + }, "optin": { "error": { "link": "Erneut eintragen", @@ -209,7 +217,8 @@ }, "success": { "text": "Sie haben Ihr Newsletterabbonoment erfolgreich bestätigt. Sie werden in Kürze auf die Startseite weitergeleitet." - } + }, + "title": "DreamMall {'|'} Newsletter" }, "validation": { "fieldNoEmail": "Dieses Feld muss eine Email-Adresse sein.", diff --git a/presenter/src/locales/en.json b/presenter/src/locales/en.json index 540dfc3f50..52f218f057 100644 --- a/presenter/src/locales/en.json +++ b/presenter/src/locales/en.json @@ -1,7 +1,8 @@ { "about": {}, "auth": { - "content": "Logging in..." + "content": "Logging in...", + "title": "DreamMall {'|'} Authentication" }, "dataProtection": { "euDispute": { @@ -26,7 +27,8 @@ "revocation": { "content": "Some data processing operations are only possible with your express consent. You can withdraw your consent at any time. An informal notification by e-mail is sufficient for the revocation. The legality of the data processing carried out until the revocation remains unaffected by the revocation.", "headline": "Withdrawal of your consent to data processing" - } + }, + "title": "DreamMall {'|'} Privacy Policy" }, "error": { "404": { @@ -36,7 +38,8 @@ "500": { "h1": "500 Internal error", "text": "Something went wrong." - } + }, + "title": "DreamMall {'|'} Error" }, "home": { "aboutSection": { @@ -161,7 +164,8 @@ "content": "Sales tax identification number according to § 27 a sales tax law:", "headline": "Sales tax ID", "id": "DE356946303" - } + }, + "title": "DreamMall {'|'} Imprint" }, "menu": { "eMail": "E-Mail", @@ -202,6 +206,10 @@ "sitemap": "Sitemap" } }, + "meta": { + "defaultDescription": "Expanding your reach making the most of opportunities enhance quality of life together", + "defaultTitle": "DreamMall" + }, "optin": { "error": { "link": "Register again", @@ -209,7 +217,8 @@ }, "success": { "text": "You have successfully confirmed your newsletter subscription. You will be redirected to the start page shortly." - } + }, + "title": "DreamMall {'|'} Newsletter" }, "validation": { "fieldNoEmail": "This field must be an email address", diff --git a/presenter/src/pages/_error/+title.ts b/presenter/src/pages/_error/+title.ts index 17faffcf02..f81d3f43a5 100644 --- a/presenter/src/pages/_error/+title.ts +++ b/presenter/src/pages/_error/+title.ts @@ -1 +1,3 @@ -export const title = 'DreamMall | Fehler' +import i18n from '#plugins/i18n' + +export const title = () => i18n.global.t('error.title') diff --git a/presenter/src/pages/_error/Page.test.ts b/presenter/src/pages/_error/Page.test.ts index a7c4bca7d9..ebca31c190 100644 --- a/presenter/src/pages/_error/Page.test.ts +++ b/presenter/src/pages/_error/Page.test.ts @@ -3,12 +3,14 @@ import { describe, it, expect, beforeEach } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' + import ErrorPage from './+Page.vue' import { title } from './+title' describe('ErrorPage', () => { it('title returns correct title', () => { - expect(title).toBe('DreamMall | Fehler') + expect(title()).toBe(i18n.global.t('error.title')) }) describe('500 Error', () => { const WrapperUndefined = () => { diff --git a/presenter/src/pages/auth/+title.ts b/presenter/src/pages/auth/+title.ts index 111df23145..9a5438414c 100644 --- a/presenter/src/pages/auth/+title.ts +++ b/presenter/src/pages/auth/+title.ts @@ -1 +1,3 @@ -export const title = 'DreamMall | Authentifizierung' +import i18n from '#plugins/i18n' + +export const title = () => i18n.global.t('auth.title') diff --git a/presenter/src/pages/auth/Page.test.ts b/presenter/src/pages/auth/Page.test.ts index 7a5aa8b59f..15602566cf 100644 --- a/presenter/src/pages/auth/Page.test.ts +++ b/presenter/src/pages/auth/Page.test.ts @@ -4,6 +4,7 @@ import { describe, it, expect, beforeEach, vi } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' import { useAuthStore } from '#stores/authStore' import { authService } from '#tests/mock.authService' @@ -51,7 +52,7 @@ describe('AuthPage', () => { }) it('title returns correct title', () => { - expect(title).toBe('DreamMall | Authentifizierung') + expect(title()).toBe(i18n.global.t('auth.title')) }) it('renders', () => { diff --git a/presenter/src/pages/datenschutz/+title.ts b/presenter/src/pages/datenschutz/+title.ts index fe2528e1bb..6940a7f21d 100644 --- a/presenter/src/pages/datenschutz/+title.ts +++ b/presenter/src/pages/datenschutz/+title.ts @@ -1 +1,3 @@ -export const title = 'DreamMall | Datenschutz' +import i18n from '#plugins/i18n' + +export const title = () => i18n.global.t('dataProtection.title') diff --git a/presenter/src/pages/datenschutz/Page.test.ts b/presenter/src/pages/datenschutz/Page.test.ts index 70f3ba834c..4df8247ca8 100644 --- a/presenter/src/pages/datenschutz/Page.test.ts +++ b/presenter/src/pages/datenschutz/Page.test.ts @@ -3,6 +3,8 @@ import { describe, it, expect } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' + import DataPrivacyPage from './+Page.vue' import { title } from './+title' @@ -14,7 +16,7 @@ describe('DataPrivacyPage', () => { }) it('title returns correct title', () => { - expect(title).toBe('DreamMall | Datenschutz') + expect(title()).toBe(i18n.global.t('dataProtection.title')) }) it('renders', () => { diff --git a/presenter/src/pages/impressum/+title.ts b/presenter/src/pages/impressum/+title.ts index 72f7a6bc1e..dd3a776b22 100644 --- a/presenter/src/pages/impressum/+title.ts +++ b/presenter/src/pages/impressum/+title.ts @@ -1 +1,3 @@ -export const title = 'DreamMall | Impressum' +import i18n from '#plugins/i18n' + +export const title = () => i18n.global.t('impress.title') diff --git a/presenter/src/pages/impressum/Page.test.ts b/presenter/src/pages/impressum/Page.test.ts index cb61152e6c..01f56c3e61 100644 --- a/presenter/src/pages/impressum/Page.test.ts +++ b/presenter/src/pages/impressum/Page.test.ts @@ -3,6 +3,8 @@ import { describe, it, expect } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' + import ImpressumPage from './+Page.vue' import { title } from './+title' @@ -14,7 +16,7 @@ describe('ImpressumPage', () => { }) it('title returns correct title', () => { - expect(title).toBe('DreamMall | Impressum') + expect(title()).toBe(i18n.global.t('impress.title')) }) it('renders', () => { diff --git a/presenter/src/pages/index/+title.ts b/presenter/src/pages/index/+title.ts index 125d4b660c..b2c347d335 100644 --- a/presenter/src/pages/index/+title.ts +++ b/presenter/src/pages/index/+title.ts @@ -1,3 +1,3 @@ -import { META } from '#src/env' +import i18n from '#plugins/i18n' -export const title = META.DEFAULT_TITLE +export const title = () => i18n.global.t('meta.defaultTitle') diff --git a/presenter/src/pages/index/Page.test.ts b/presenter/src/pages/index/Page.test.ts index 026c20fd22..609153de51 100644 --- a/presenter/src/pages/index/Page.test.ts +++ b/presenter/src/pages/index/Page.test.ts @@ -3,6 +3,8 @@ import { describe, it, expect } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' + import IndexPage from './+Page.vue' import { title } from './+title' @@ -14,7 +16,7 @@ describe('IndexPage', () => { }) it('title returns default title', () => { - expect(title).toBe('DreamMall') + expect(title()).toBe(i18n.global.t('meta.defaultTitle')) }) it('renders', () => { diff --git a/presenter/src/pages/optin/+title.ts b/presenter/src/pages/optin/+title.ts index 0260dfd2c5..390b93794e 100644 --- a/presenter/src/pages/optin/+title.ts +++ b/presenter/src/pages/optin/+title.ts @@ -1 +1,4 @@ -export const title = 'DreamMall | Newsletter' +import i18n from '#plugins/i18n' + +// 'DreamMall | Newsletter' +export const title = () => i18n.global.t('optin.title') diff --git a/presenter/src/pages/optin/Page.test.ts b/presenter/src/pages/optin/Page.test.ts index d6e131ebc5..97159ceffd 100644 --- a/presenter/src/pages/optin/Page.test.ts +++ b/presenter/src/pages/optin/Page.test.ts @@ -5,6 +5,7 @@ import { Component, h } from 'vue' import { VApp } from 'vuetify/components' import { confirmNewsletter } from '#mutations/confirmNewsletter' +import i18n from '#plugins/i18n' import { mockClient } from '#tests/mock.apolloClient' import OptinPage from './+Page.vue' @@ -45,7 +46,7 @@ describe('OptinPage', () => { }) it('title returns correct title', () => { - expect(title).toBe('DreamMall | Newsletter') + expect(title()).toBe(i18n.global.t('optin.title')) }) it('route returns `/optin/@code', () => { diff --git a/presenter/src/pages/silent-refresh/+title.ts b/presenter/src/pages/silent-refresh/+title.ts index 111df23145..9a5438414c 100644 --- a/presenter/src/pages/silent-refresh/+title.ts +++ b/presenter/src/pages/silent-refresh/+title.ts @@ -1 +1,3 @@ -export const title = 'DreamMall | Authentifizierung' +import i18n from '#plugins/i18n' + +export const title = () => i18n.global.t('auth.title') diff --git a/presenter/src/pages/silent-refresh/Page.test.ts b/presenter/src/pages/silent-refresh/Page.test.ts index 57ce86a8c2..f8e57d06c0 100644 --- a/presenter/src/pages/silent-refresh/Page.test.ts +++ b/presenter/src/pages/silent-refresh/Page.test.ts @@ -4,6 +4,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' import { Component, h } from 'vue' import { VApp } from 'vuetify/components' +import i18n from '#plugins/i18n' import { authService } from '#tests/mock.authService' import SilentRefreshPage from './+Page.vue' @@ -31,7 +32,7 @@ describe('SilentRefreshPage', () => { }) it('title returns correct title', () => { - expect(title).toBe('DreamMall | Authentifizierung') + expect(title()).toBe(i18n.global.t('auth.title')) }) it('renders', () => {