Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/refactor sitemap module (part 2) (#4985)
Thomas Kaul314b12158418
diff --git a/apps/api/src/app/endpoints/sitemap/sitemap.module.ts b/apps/api/src/app/endpoints/sitemap/sitemap.module.tsindex abf2e370e6..73b5d78b02 100644--- a/apps/api/src/app/endpoints/sitemap/sitemap.module.ts+++ b/apps/api/src/app/endpoints/sitemap/sitemap.module.ts@@ -1,4 +1,5 @@import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module';+import { I18nModule } from '@ghostfolio/api/services/i18n/i18n.module';import { Module } from '@nestjs/common';@@ -7,7 +8,7 @@ import { SitemapService } from './sitemap.service';@Module({controllers: [SitemapController],- imports: [ConfigurationModule],+ imports: [ConfigurationModule, I18nModule],providers: [SitemapService]})export class SitemapModule {}diff --git a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts b/apps/api/src/app/endpoints/sitemap/sitemap.service.tsindex e56dc57a8a..6daeeaa546 100644--- a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts+++ b/apps/api/src/app/endpoints/sitemap/sitemap.service.ts@@ -1,42 +1,39 @@+import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';+import { SUPPORTED_LANGUAGE_CODES } from '@ghostfolio/common/config';import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools';import { Injectable } from '@nestjs/common';@Injectable()export class SitemapService {+ public constructor(private readonly i18nService: I18nService) {}+public getPersonalFinanceTools({ currentDate }: { currentDate: string }) {return personalFinanceTools.map(({ alias, key }) => {- return [- '<url>',- ` <loc>https://ghostfol.io/de/ressourcen/personal-finance-tools/open-source-alternative-zu-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/en/resources/personal-finance-tools/open-source-alternative-to-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/es/recursos/personal-finance-tools/alternativa-de-software-libre-a-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/fr/ressources/personal-finance-tools/alternative-open-source-a-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/it/risorse/personal-finance-tools/alternativa-open-source-a-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/nl/bronnen/personal-finance-tools/open-source-alternatief-voor-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>',- '<url>',- ` <loc>https://ghostfol.io/pt/recursos/personal-finance-tools/alternativa-de-software-livre-ao-${alias ?? key}</loc>`,- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,- '</url>'- ].join('\n');+ return SUPPORTED_LANGUAGE_CODES.map((languageCode) => {+ const resourcesPath = this.i18nService.getTranslation({+ languageCode,+ id: 'routes.resources'+ });++ const personalFinanceToolsPath = this.i18nService.getTranslation({+ languageCode,+ id: 'routes.resources.personalFinanceTools'+ });++ const openSourceAlternativeToPath = this.i18nService.getTranslation({+ languageCode,+ id: 'routes.resources.personalFinanceTools.openSourceAlternativeTo'+ });++ return [+ '<url>',+ ` <loc>https://ghostfol.io/${languageCode}/${resourcesPath}/${personalFinanceToolsPath}/${openSourceAlternativeToPath}-${alias ?? key}</loc>`,+ ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,+ '</url>'+ ].join('\n');+ });}).join('\n');}diff --git a/libs/common/src/lib/routes/routes.ts b/libs/common/src/lib/routes/routes.tsindex ab3e5afd09..3604856196 100644--- a/libs/common/src/lib/routes/routes.ts+++ b/libs/common/src/lib/routes/routes.ts@@ -261,13 +261,13 @@ export const publicRoutes = {title: $localize`Registration`},resources: {- path: $localize`:kebab-case:resources`,- routerLink: ['/' + $localize`:kebab-case:resources`],+ path: $localize`:kebab-case@@routes.resources:resources`,+ routerLink: ['/' + $localize`:kebab-case@@routes.resources:resources`],subRoutes: {glossary: {path: $localize`:kebab-case:glossary`,routerLink: [- '/' + $localize`:kebab-case:resources`,+ '/' + $localize`:kebab-case@@routes.resources:resources`,$localize`:kebab-case:glossary`],title: $localize`Glossary`@@ -275,7 +275,7 @@ export const publicRoutes = {guides: {path: $localize`:kebab-case:guides`,routerLink: [- '/' + $localize`:kebab-case:resources`,+ '/' + $localize`:kebab-case@@routes.resources:resources`,$localize`:kebab-case:guides`],title: $localize`Guides`@@ -283,20 +283,20 @@ export const publicRoutes = {markets: {path: $localize`:kebab-case:markets`,routerLink: [- '/' + $localize`:kebab-case:resources`,+ '/' + $localize`:kebab-case@@routes.resources:resources`,$localize`:kebab-case:markets`],title: $localize`Markets`},personalFinanceTools: {- path: 'personal-finance-tools',+ path: $localize`:kebab-case@@routes.resources.personalFinanceTools:personal-finance-tools`,routerLink: [- '/' + $localize`:kebab-case:resources`,- 'personal-finance-tools'+ '/' + $localize`:kebab-case@@routes.resources:resources`,+ $localize`:kebab-case@@routes.resources.personalFinanceTools:personal-finance-tools`],subRoutes: {product: {- path: $localize`:kebab-case:open-source-alternative-to`,+ path: $localize`:kebab-case@@routes.resources.personalFinanceTools.openSourceAlternativeTo:open-source-alternative-to`,title: $localize`Open Source Alternative to`}},