Browse Source

Setup fr

pull/1571/head
Thomas 3 years ago
parent
commit
23e62ff9a6
  1. 14
      apps/api/src/app/frontend.middleware.ts
  2. 12
      apps/client/project.json
  3. 12
      apps/client/src/app/pages/account/account-page.component.ts
  4. 4
      apps/client/src/app/pages/account/account-page.html
  5. 7
      apps/client/src/app/pages/features/features-page.html
  6. 4
      libs/common/src/lib/helper.ts

14
apps/api/src/app/frontend.middleware.ts

@ -14,6 +14,7 @@ export class FrontendMiddleware implements NestMiddleware {
public indexHtmlDe = ''; public indexHtmlDe = '';
public indexHtmlEn = ''; public indexHtmlEn = '';
public indexHtmlEs = ''; public indexHtmlEs = '';
public indexHtmlFr = '';
public indexHtmlIt = ''; public indexHtmlIt = '';
public indexHtmlNl = ''; public indexHtmlNl = '';
public indexHtmlPt = ''; public indexHtmlPt = '';
@ -42,6 +43,10 @@ export class FrontendMiddleware implements NestMiddleware {
this.getPathOfIndexHtmlFile('es'), this.getPathOfIndexHtmlFile('es'),
'utf8' 'utf8'
); );
this.indexHtmlFr = fs.readFileSync(
this.getPathOfIndexHtmlFile('fr'),
'utf8'
);
this.indexHtmlIt = fs.readFileSync( this.indexHtmlIt = fs.readFileSync(
this.getPathOfIndexHtmlFile('it'), this.getPathOfIndexHtmlFile('it'),
'utf8' 'utf8'
@ -109,6 +114,15 @@ export class FrontendMiddleware implements NestMiddleware {
rootUrl: this.configurationService.get('ROOT_URL') 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/')) { } else if (request.path === '/it' || request.path.startsWith('/it/')) {
response.send( response.send(
this.interpolate(this.indexHtmlIt, { this.interpolate(this.indexHtmlIt, {

12
apps/client/project.json

@ -89,6 +89,10 @@
"baseHref": "/es/", "baseHref": "/es/",
"localize": ["es"] "localize": ["es"]
}, },
"development-fr": {
"baseHref": "/fr/",
"localize": ["fr"]
},
"development-it": { "development-it": {
"baseHref": "/it/", "baseHref": "/it/",
"localize": ["it"] "localize": ["it"]
@ -148,6 +152,9 @@
"development-es": { "development-es": {
"browserTarget": "client:build:development-es" "browserTarget": "client:build:development-es"
}, },
"development-fr": {
"browserTarget": "client:build:development-fr"
},
"development-it": { "development-it": {
"browserTarget": "client:build:development-it" "browserTarget": "client:build:development-it"
}, },
@ -171,6 +178,7 @@
"targetFiles": [ "targetFiles": [
"messages.de.xlf", "messages.de.xlf",
"messages.es.xlf", "messages.es.xlf",
"messages.fr.xlf",
"messages.it.xlf", "messages.it.xlf",
"messages.nl.xlf", "messages.nl.xlf",
"messages.pt.xlf" "messages.pt.xlf"
@ -202,6 +210,10 @@
"baseHref": "/es/", "baseHref": "/es/",
"translation": "apps/client/src/locales/messages.es.xlf" "translation": "apps/client/src/locales/messages.es.xlf"
}, },
"fr": {
"baseHref": "/fr/",
"translation": "apps/client/src/locales/messages.fr.xlf"
},
"it": { "it": {
"baseHref": "/it/", "baseHref": "/it/",
"translation": "apps/client/src/locales/messages.it.xlf" "translation": "apps/client/src/locales/messages.it.xlf"

12
apps/client/src/app/pages/account/account-page.component.ts

@ -55,7 +55,17 @@ export class AccountPageComponent implements OnDestroy, OnInit {
public hasPermissionToUpdateViewMode: boolean; public hasPermissionToUpdateViewMode: boolean;
public hasPermissionToUpdateUserSettings: boolean; public hasPermissionToUpdateUserSettings: boolean;
public language = document.documentElement.lang; 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 price: number;
public priceId: string; public priceId: string;
public snackBarRef: MatSnackBarRef<TextOnlySnackBar>; public snackBarRef: MatSnackBarRef<TextOnlySnackBar>;

4
apps/client/src/app/pages/account/account-page.html

@ -135,6 +135,10 @@
>Español (<ng-container i18n>Community</ng-container >Español (<ng-container i18n>Community</ng-container
>)</mat-option >)</mat-option
> >
<!--<mat-option value="fr"
>Français (<ng-container i18n>Community</ng-container
>)</mat-option
>-->
<mat-option value="it" <mat-option value="it"
>Italiano (<ng-container i18n>Community</ng-container >Italiano (<ng-container i18n>Community</ng-container
>)</mat-option >)</mat-option

7
apps/client/src/app/pages/features/features-page.html

@ -197,8 +197,11 @@
<div class="flex-grow-1"> <div class="flex-grow-1">
<h4>Multi-Language</h4> <h4>Multi-Language</h4>
<p class="m-0"> <p class="m-0">
Use Ghostfolio in multiple languages: English, Dutch, German, Use Ghostfolio in multiple languages: English,
Italian<ng-container *ngIf="false">, Portuguese</ng-container> Dutch<ng-container *ngIf="false">, Français</ng-container>,
German, Italian<ng-container *ngIf="false"
>, Portuguese</ng-container
>
and Spanish are currently supported. and Spanish are currently supported.
</p> </p>
</div> </div>

4
libs/common/src/lib/helper.ts

@ -1,7 +1,7 @@
import * as currencies from '@dinero.js/currencies'; import * as currencies from '@dinero.js/currencies';
import { DataSource } from '@prisma/client'; import { DataSource } from '@prisma/client';
import { getDate, getMonth, getYear, parse, subDays } from 'date-fns'; 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 { ghostfolioScraperApiSymbolPrefix, locale } from './config';
import { Benchmark } from './interfaces'; import { Benchmark } from './interfaces';
@ -79,6 +79,8 @@ export function getDateFnsLocale(aLanguageCode: string) {
return de; return de;
} else if (aLanguageCode === 'es') { } else if (aLanguageCode === 'es') {
return es; return es;
} else if (aLanguageCode === 'fr') {
return fr;
} else if (aLanguageCode === 'it') { } else if (aLanguageCode === 'it') {
return it; return it;
} else if (aLanguageCode === 'nl') { } else if (aLanguageCode === 'nl') {

Loading…
Cancel
Save