Browse Source

Setup italiano

pull/1276/head
Thomas 3 years ago
parent
commit
641046e0eb
  1. 14
      apps/api/src/app/frontend.middleware.ts
  2. 2
      apps/client/src/app/pages/account/account-page.component.ts
  3. 1
      apps/client/src/app/pages/account/account-page.html
  4. 4
      libs/common/src/lib/helper.ts

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

@ -11,6 +11,7 @@ import { NextFunction, Request, Response } from 'express';
export class FrontendMiddleware implements NestMiddleware { export class FrontendMiddleware implements NestMiddleware {
public indexHtmlDe = ''; public indexHtmlDe = '';
public indexHtmlEn = ''; public indexHtmlEn = '';
public indexHtmlIt = '';
public isProduction: boolean; public isProduction: boolean;
public constructor( public constructor(
@ -32,6 +33,10 @@ export class FrontendMiddleware implements NestMiddleware {
this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE),
'utf8' 'utf8'
); );
this.indexHtmlIt = fs.readFileSync(
this.getPathOfIndexHtmlFile('it'),
'utf8'
);
} catch {} } catch {}
} }
@ -61,6 +66,15 @@ export class FrontendMiddleware implements NestMiddleware {
rootUrl: this.configurationService.get('ROOT_URL') rootUrl: this.configurationService.get('ROOT_URL')
}) })
); );
} else if (req.path === '/it' || req.path.startsWith('/it/')) {
res.send(
this.interpolate(this.indexHtmlIt, {
featureGraphicPath,
languageCode: 'it',
path: req.path,
rootUrl: this.configurationService.get('ROOT_URL')
})
);
} else { } else {
res.send( res.send(
this.interpolate(this.indexHtmlEn, { this.interpolate(this.indexHtmlEn, {

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

@ -54,7 +54,7 @@ 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']; public locales = ['de', 'de-CH', 'en-GB', 'en-US', 'it'];
public price: number; public price: number;
public priceId: string; public priceId: string;
public snackBarRef: MatSnackBarRef<TextOnlySnackBar>; public snackBarRef: MatSnackBarRef<TextOnlySnackBar>;

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

@ -126,6 +126,7 @@
<mat-option [value]="null"></mat-option> <mat-option [value]="null"></mat-option>
<mat-option value="de">Deutsch</mat-option> <mat-option value="de">Deutsch</mat-option>
<mat-option value="en">English</mat-option> <mat-option value="en">English</mat-option>
<mat-option value="it">Italiano</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</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 } from 'date-fns/locale'; import { de, it } from 'date-fns/locale';
import { ghostfolioScraperApiSymbolPrefix, locale } from './config'; import { ghostfolioScraperApiSymbolPrefix, locale } from './config';
import { Benchmark } from './interfaces'; import { Benchmark } from './interfaces';
@ -75,6 +75,8 @@ export function getCssVariable(aCssVariable: string) {
export function getDateFnsLocale(aLanguageCode: string) { export function getDateFnsLocale(aLanguageCode: string) {
if (aLanguageCode === 'de') { if (aLanguageCode === 'de') {
return de; return de;
} else if (aLanguageCode === 'it') {
return it;
} }
return undefined; return undefined;

Loading…
Cancel
Save