From 576380e9a09f986aada3537b53b510d5b09b7100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joe=20K=C3=BCng?= Date: Sat, 14 Mar 2026 15:02:00 +0100 Subject: [PATCH] fix(front-end): seo translated --- frontend/src/app/app.routes.ts | 54 +++--- .../src/app/core/layout/footer.component.html | 12 +- .../src/app/core/layout/footer.component.ts | 7 +- .../src/app/core/layout/navbar.component.html | 33 ++-- .../src/app/core/layout/navbar.component.ts | 2 +- .../core/services/language.service.spec.ts | 11 ++ .../src/app/core/services/language.service.ts | 25 +++ .../src/app/core/services/seo.service.spec.ts | 135 +++++++++++++ frontend/src/app/core/services/seo.service.ts | 182 +++++++++++++++--- .../src/app/features/about/about.routes.ts | 5 +- .../features/calculator/calculator.routes.ts | 10 +- .../upload-form/upload-form.component.html | 6 +- .../upload-form/upload-form.component.ts | 2 + .../user-details/user-details.component.html | 12 +- .../user-details/user-details.component.ts | 4 +- .../features/checkout/checkout.component.html | 20 +- .../features/checkout/checkout.component.ts | 4 +- .../contact-form/contact-form.component.html | 18 +- .../contact-form/contact-form.component.ts | 2 +- .../app/features/contact/contact.routes.ts | 5 +- .../src/app/features/home/home.component.html | 60 ++++-- .../src/app/features/home/home.component.ts | 2 + .../src/app/features/legal/legal.routes.ts | 10 +- .../src/app/features/order/order.component.ts | 4 +- .../features/shop/product-detail.component.ts | 2 +- .../features/shop/shop-page.component.html | 5 +- .../app/features/shop/shop-page.component.ts | 4 +- frontend/src/app/features/shop/shop.routes.ts | 14 +- .../app-locations.component.html | 5 +- .../app-locations/app-locations.component.ts | 4 +- frontend/src/assets/i18n/de.json | 117 +++++++++++ frontend/src/assets/i18n/en.json | 117 +++++++++++ frontend/src/assets/i18n/fr.json | 117 +++++++++++ frontend/src/assets/i18n/it.json | 69 +++++++ 34 files changed, 944 insertions(+), 135 deletions(-) create mode 100644 frontend/src/app/core/services/seo.service.spec.ts diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts index 3f246d2..0830d96 100644 --- a/frontend/src/app/app.routes.ts +++ b/frontend/src/app/app.routes.ts @@ -15,18 +15,8 @@ const appChildRoutes: Routes = [ loadComponent: () => import('./features/home/home.component').then((m) => m.HomeComponent), data: { - seoTitleByLang: { - it: 'Stampa 3D su misura in Ticino | Prototipi, ricambi e piccole serie - 3D Fab', - en: 'Custom 3D Printing in Switzerland | Prototypes, Spare Parts & Short Runs - 3D Fab', - de: '3D-Druck in Zürich | Prototypen, Ersatzteile und Kleinserien - 3D Fab', - fr: 'Impression 3D à Bienne | Prototypes, pièces et petites séries - 3D Fab', - }, - seoDescriptionByLang: { - it: 'Servizio di stampa 3D in Ticino per prototipi, pezzi di ricambio e piccole serie. Shop tecnico e supporto CAD, con preventivo rapido da file STL.', - en: 'Swiss-based 3D printing service for prototypes, spare parts and short production runs. Technical shop and CAD support, with fast quotes from STL files.', - de: '3D-Druckservice in Zürich für Prototypen, Ersatzteile und Kleinserien. Technischer Shop und CAD-Service, mit schneller Angebotsanfrage aus STL-Dateien.', - fr: "Service d'impression 3D à Bienne pour prototypes, pièces de rechange et petites séries. Boutique technique et support CAD, avec devis rapide depuis un fichier STL.", - }, + seoTitleKey: 'SEO.ROUTES.HOME.TITLE', + seoDescriptionKey: 'SEO.ROUTES.HOME.DESCRIPTION', }, }, { @@ -36,9 +26,8 @@ const appChildRoutes: Routes = [ (m) => m.CALCULATOR_ROUTES, ), data: { - seoTitle: 'Calcolatore preventivo stampa 3D | 3D fab', - seoDescription: - 'Carica il file 3D e ottieni prezzo e tempi in pochi secondi con slicing reale.', + seoTitleKey: 'SEO.ROUTES.CALCULATOR.TITLE', + seoDescriptionKey: 'SEO.ROUTES.CALCULATOR.DESCRIPTION', }, }, { @@ -46,9 +35,8 @@ const appChildRoutes: Routes = [ loadChildren: () => import('./features/shop/shop.routes').then((m) => m.SHOP_ROUTES), data: { - seoTitle: 'Shop 3D fab', - seoDescription: - 'Catalogo prodotti stampati in 3D e soluzioni tecniche pronte all uso.', + seoTitleKey: 'SEO.ROUTES.SHOP.TITLE', + seoDescriptionKey: 'SEO.ROUTES.SHOP.DESCRIPTION', }, }, { @@ -56,9 +44,8 @@ const appChildRoutes: Routes = [ loadChildren: () => import('./features/about/about.routes').then((m) => m.ABOUT_ROUTES), data: { - seoTitle: 'Chi siamo | 3D fab', - seoDescription: - 'Scopri il team 3D fab e il laboratorio di stampa 3D con sedi in Ticino e Bienne.', + seoTitleKey: 'SEO.ROUTES.ABOUT.TITLE', + seoDescriptionKey: 'SEO.ROUTES.ABOUT.DESCRIPTION', }, }, /* { @@ -68,9 +55,8 @@ const appChildRoutes: Routes = [ (m) => m.MaterialsPageComponent, ), data: { - seoTitle: 'Qualita e Materiali | 3D fab', - seoDescription: - 'Confronta materiali di stampa 3D con radar chart interattivo, proprieta tecniche e fonti citate.', + seoTitleKey: 'SEO.ROUTES.MATERIALS.TITLE', + seoDescriptionKey: 'SEO.ROUTES.MATERIALS.DESCRIPTION', }, },*/ { @@ -78,9 +64,8 @@ const appChildRoutes: Routes = [ loadChildren: () => import('./features/contact/contact.routes').then((m) => m.CONTACT_ROUTES), data: { - seoTitle: 'Contatti | 3D fab', - seoDescription: - 'Contatta 3D fab per preventivi, supporto tecnico e richieste personalizzate di stampa 3D.', + seoTitleKey: 'SEO.ROUTES.CONTACT.TITLE', + seoDescriptionKey: 'SEO.ROUTES.CONTACT.DESCRIPTION', }, }, { @@ -90,7 +75,8 @@ const appChildRoutes: Routes = [ (m) => m.CheckoutComponent, ), data: { - seoTitle: 'Checkout | 3D fab', + seoTitleKey: 'SEO.ROUTES.CHECKOUT.TITLE', + seoDescriptionKey: 'SEO.ROUTES.CHECKOUT.DESCRIPTION', seoRobots: 'noindex, nofollow', }, }, @@ -101,7 +87,8 @@ const appChildRoutes: Routes = [ (m) => m.CheckoutComponent, ), data: { - seoTitle: 'Checkout | 3D fab', + seoTitleKey: 'SEO.ROUTES.CHECKOUT.TITLE', + seoDescriptionKey: 'SEO.ROUTES.CHECKOUT.DESCRIPTION', seoRobots: 'noindex, nofollow', }, }, @@ -110,7 +97,8 @@ const appChildRoutes: Routes = [ loadComponent: () => import('./features/order/order.component').then((m) => m.OrderComponent), data: { - seoTitle: 'Ordine | 3D fab', + seoTitleKey: 'SEO.ROUTES.ORDER.TITLE', + seoDescriptionKey: 'SEO.ROUTES.ORDER.DESCRIPTION', seoRobots: 'noindex, nofollow', }, }, @@ -119,7 +107,8 @@ const appChildRoutes: Routes = [ loadComponent: () => import('./features/order/order.component').then((m) => m.OrderComponent), data: { - seoTitle: 'Ordine | 3D fab', + seoTitleKey: 'SEO.ROUTES.ORDER.TITLE', + seoDescriptionKey: 'SEO.ROUTES.ORDER.DESCRIPTION', seoRobots: 'noindex, nofollow', }, }, @@ -133,7 +122,8 @@ const appChildRoutes: Routes = [ loadChildren: () => import('./features/admin/admin.routes').then((m) => m.ADMIN_ROUTES), data: { - seoTitle: 'Admin | 3D fab', + seoTitleKey: 'SEO.ROUTES.ADMIN.TITLE', + seoDescriptionKey: 'SEO.ROUTES.ADMIN.DESCRIPTION', seoRobots: 'noindex, nofollow', }, }, diff --git a/frontend/src/app/core/layout/footer.component.html b/frontend/src/app/core/layout/footer.component.html index 4092c69..2e3116c 100644 --- a/frontend/src/app/core/layout/footer.component.html +++ b/frontend/src/app/core/layout/footer.component.html @@ -6,9 +6,15 @@
diff --git a/frontend/src/app/core/layout/footer.component.ts b/frontend/src/app/core/layout/footer.component.ts index cbd9b69..deaeedd 100644 --- a/frontend/src/app/core/layout/footer.component.ts +++ b/frontend/src/app/core/layout/footer.component.ts @@ -1,6 +1,7 @@ -import { Component } from '@angular/core'; +import { Component, inject } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { RouterLink } from '@angular/router'; +import { LanguageService } from '../services/language.service'; @Component({ selector: 'app-footer', @@ -9,4 +10,6 @@ import { RouterLink } from '@angular/router'; templateUrl: './footer.component.html', styleUrls: ['./footer.component.scss'], }) -export class FooterComponent {} +export class FooterComponent { + readonly languageService = inject(LanguageService); +} diff --git a/frontend/src/app/core/layout/navbar.component.html b/frontend/src/app/core/layout/navbar.component.html index 944ca86..fbbfd90 100644 --- a/frontend/src/app/core/layout/navbar.component.html +++ b/frontend/src/app/core/layout/navbar.component.html @@ -1,6 +1,8 @@