diff --git a/CHANGELOG.md b/CHANGELOG.md index aaac689d..8bc2e7a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Set up the language localization for Italiano (`it`) + ## 1.195.0 - 20.09.2022 ### Changed @@ -195,7 +201,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Set up `ng-extract-i18n-merge` to improve the i18n extraction and merge workflow -- Set up language localization for German (`de`) +- Set up the language localization for German (`de`) - Resolved the feature graphic of the blog post ### Changed diff --git a/apps/api/src/app/frontend.middleware.ts b/apps/api/src/app/frontend.middleware.ts index b650555f..aec14e3e 100644 --- a/apps/api/src/app/frontend.middleware.ts +++ b/apps/api/src/app/frontend.middleware.ts @@ -11,6 +11,7 @@ import { NextFunction, Request, Response } from 'express'; export class FrontendMiddleware implements NestMiddleware { public indexHtmlDe = ''; public indexHtmlEn = ''; + public indexHtmlIt = ''; public isProduction: boolean; public constructor( @@ -32,6 +33,10 @@ export class FrontendMiddleware implements NestMiddleware { this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), 'utf8' ); + this.indexHtmlIt = fs.readFileSync( + this.getPathOfIndexHtmlFile('it'), + 'utf8' + ); } catch {} } @@ -61,6 +66,15 @@ export class FrontendMiddleware implements NestMiddleware { 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 { res.send( this.interpolate(this.indexHtmlEn, { 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 8a04e2b5..3f7ec90d 100644 --- a/apps/client/src/app/pages/account/account-page.component.ts +++ b/apps/client/src/app/pages/account/account-page.component.ts @@ -54,7 +54,7 @@ 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']; + public locales = ['de', 'de-CH', 'en-GB', 'en-US', 'it']; 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 306a9f70..eb0db74b 100644 --- a/apps/client/src/app/pages/account/account-page.html +++ b/apps/client/src/app/pages/account/account-page.html @@ -126,6 +126,7 @@ Deutsch English + Italiano diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index 9547ac3c..693e2183 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 } from 'date-fns/locale'; +import { de, it } from 'date-fns/locale'; import { ghostfolioScraperApiSymbolPrefix, locale } from './config'; import { Benchmark } from './interfaces'; @@ -75,6 +75,8 @@ export function getCssVariable(aCssVariable: string) { export function getDateFnsLocale(aLanguageCode: string) { if (aLanguageCode === 'de') { return de; + } else if (aLanguageCode === 'it') { + return it; } return undefined;