diff --git a/apps/api/src/app/frontend.middleware.ts b/apps/api/src/app/frontend.middleware.ts index 03443611e..eb9e5561c 100644 --- a/apps/api/src/app/frontend.middleware.ts +++ b/apps/api/src/app/frontend.middleware.ts @@ -14,6 +14,7 @@ export class FrontendMiddleware implements NestMiddleware { public indexHtmlDe = ''; public indexHtmlEn = ''; public indexHtmlEs = ''; + public indexHtmlFr = ''; public indexHtmlIt = ''; public indexHtmlNl = ''; public indexHtmlPt = ''; @@ -42,6 +43,10 @@ export class FrontendMiddleware implements NestMiddleware { this.getPathOfIndexHtmlFile('es'), 'utf8' ); + this.indexHtmlFr = fs.readFileSync( + this.getPathOfIndexHtmlFile('fr'), + 'utf8' + ); this.indexHtmlIt = fs.readFileSync( this.getPathOfIndexHtmlFile('it'), 'utf8' @@ -109,6 +114,15 @@ export class FrontendMiddleware implements NestMiddleware { rootUrl: this.configurationService.get('ROOT_URL') }) ); + } else if (request.path === '/fr' || request.path.startsWith('/fr/')) { + response.send( + this.interpolate(this.indexHtmlFr, { + featureGraphicPath, + languageCode: 'fr', + path: request.path, + rootUrl: this.configurationService.get('ROOT_URL') + }) + ); } else if (request.path === '/it' || request.path.startsWith('/it/')) { response.send( this.interpolate(this.indexHtmlIt, { diff --git a/apps/client/project.json b/apps/client/project.json index a8d02ce33..f58bb3ae5 100644 --- a/apps/client/project.json +++ b/apps/client/project.json @@ -89,6 +89,10 @@ "baseHref": "/es/", "localize": ["es"] }, + "development-fr": { + "baseHref": "/fr/", + "localize": ["fr"] + }, "development-it": { "baseHref": "/it/", "localize": ["it"] @@ -148,6 +152,9 @@ "development-es": { "browserTarget": "client:build:development-es" }, + "development-fr": { + "browserTarget": "client:build:development-fr" + }, "development-it": { "browserTarget": "client:build:development-it" }, @@ -171,6 +178,7 @@ "targetFiles": [ "messages.de.xlf", "messages.es.xlf", + "messages.fr.xlf", "messages.it.xlf", "messages.nl.xlf", "messages.pt.xlf" @@ -202,6 +210,10 @@ "baseHref": "/es/", "translation": "apps/client/src/locales/messages.es.xlf" }, + "fr": { + "baseHref": "/fr/", + "translation": "apps/client/src/locales/messages.fr.xlf" + }, "it": { "baseHref": "/it/", "translation": "apps/client/src/locales/messages.it.xlf" diff --git a/apps/client/src/app/pages/account/account-page.component.ts b/apps/client/src/app/pages/account/account-page.component.ts index ab1dc6d2d..eafa1333f 100644 --- a/apps/client/src/app/pages/account/account-page.component.ts +++ b/apps/client/src/app/pages/account/account-page.component.ts @@ -55,7 +55,17 @@ export class AccountPageComponent implements OnDestroy, OnInit { public hasPermissionToUpdateViewMode: boolean; public hasPermissionToUpdateUserSettings: boolean; public language = document.documentElement.lang; - public locales = ['de', 'de-CH', 'en-GB', 'en-US', 'es', 'it', 'nl', 'pt']; + public locales = [ + 'de', + 'de-CH', + 'en-GB', + 'en-US', + 'es', + 'fr', + 'it', + 'nl', + 'pt' + ]; public price: number; public priceId: string; public snackBarRef: MatSnackBarRef; diff --git a/apps/client/src/app/pages/account/account-page.html b/apps/client/src/app/pages/account/account-page.html index 29211d93d..7746ba902 100644 --- a/apps/client/src/app/pages/account/account-page.html +++ b/apps/client/src/app/pages/account/account-page.html @@ -135,6 +135,10 @@ >Español (Community) + Italiano (Community)

Multi-Language

- Use Ghostfolio in multiple languages: English, Dutch, German, - Italian, Portuguese + Use Ghostfolio in multiple languages: English, + Dutch, Français, + German, Italian, Portuguese and Spanish are currently supported.

diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index 3ea766e02..29bb4d121 100644 --- a/libs/common/src/lib/helper.ts +++ b/libs/common/src/lib/helper.ts @@ -1,7 +1,7 @@ import * as currencies from '@dinero.js/currencies'; import { DataSource } from '@prisma/client'; import { getDate, getMonth, getYear, parse, subDays } from 'date-fns'; -import { de, es, it, nl, pt } from 'date-fns/locale'; +import { de, es, fr, it, nl, pt } from 'date-fns/locale'; import { ghostfolioScraperApiSymbolPrefix, locale } from './config'; import { Benchmark } from './interfaces'; @@ -79,6 +79,8 @@ export function getDateFnsLocale(aLanguageCode: string) { return de; } else if (aLanguageCode === 'es') { return es; + } else if (aLanguageCode === 'fr') { + return fr; } else if (aLanguageCode === 'it') { return it; } else if (aLanguageCode === 'nl') {