Browse Source
			
			
			Feature/setup espanol (#1293)
			
				* Setup Español
* Update changelog
			
			
				pull/1297/head
			
			
		 
		
			
				
					
						 Thomas Kaul
					
					3 years ago
						Thomas Kaul
					
					3 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 7 changed files with 
39 additions and 
4 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					angular.json
				
- 
					
					
					 
					apps/api/src/app/frontend.middleware.ts
				
- 
					
					
					 
					apps/client/src/app/pages/account/account-page.component.ts
				
- 
					
					
					 
					apps/client/src/app/pages/account/account-page.html
				
- 
					
					
					 
					apps/client/src/app/pages/features/features-page.html
				
- 
					
					
					 
					libs/common/src/lib/helper.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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 Español (`es`) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ## 1.198.0 - 25.09.2022 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Added | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -136,6 +136,10 @@ | 
			
		
	
		
			
				
					|  |  |  |               "baseHref": "/en/", | 
			
		
	
		
			
				
					|  |  |  |               "localize": ["en"] | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
		
			
				
					|  |  |  |             "development-es": { | 
			
		
	
		
			
				
					|  |  |  |               "baseHref": "/es/", | 
			
		
	
		
			
				
					|  |  |  |               "localize": ["es"] | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
		
			
				
					|  |  |  |             "development-it": { | 
			
		
	
		
			
				
					|  |  |  |               "baseHref": "/it/", | 
			
		
	
		
			
				
					|  |  |  |               "localize": ["it"] | 
			
		
	
	
		
			
				
					|  |  | @ -188,6 +192,9 @@ | 
			
		
	
		
			
				
					|  |  |  |             "development-en": { | 
			
		
	
		
			
				
					|  |  |  |               "browserTarget": "client:build:development-en" | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
		
			
				
					|  |  |  |             "development-es": { | 
			
		
	
		
			
				
					|  |  |  |               "browserTarget": "client:build:development-es" | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
		
			
				
					|  |  |  |             "development-it": { | 
			
		
	
		
			
				
					|  |  |  |               "browserTarget": "client:build:development-it" | 
			
		
	
		
			
				
					|  |  |  |             }, | 
			
		
	
	
		
			
				
					|  |  | @ -207,6 +214,7 @@ | 
			
		
	
		
			
				
					|  |  |  |             "outputPath": "src/locales", | 
			
		
	
		
			
				
					|  |  |  |             "targetFiles": [ | 
			
		
	
		
			
				
					|  |  |  |               "messages.de.xlf", | 
			
		
	
		
			
				
					|  |  |  |               "messages.es.xlf", | 
			
		
	
		
			
				
					|  |  |  |               "messages.it.xlf", | 
			
		
	
		
			
				
					|  |  |  |               "messages.nl.xlf" | 
			
		
	
		
			
				
					|  |  |  |             ] | 
			
		
	
	
		
			
				
					|  |  | @ -233,6 +241,10 @@ | 
			
		
	
		
			
				
					|  |  |  |             "baseHref": "/de/", | 
			
		
	
		
			
				
					|  |  |  |             "translation": "apps/client/src/locales/messages.de.xlf" | 
			
		
	
		
			
				
					|  |  |  |           }, | 
			
		
	
		
			
				
					|  |  |  |           "es": { | 
			
		
	
		
			
				
					|  |  |  |             "baseHref": "/es/", | 
			
		
	
		
			
				
					|  |  |  |             "translation": "apps/client/src/locales/messages.es.xlf" | 
			
		
	
		
			
				
					|  |  |  |           }, | 
			
		
	
		
			
				
					|  |  |  |           "it": { | 
			
		
	
		
			
				
					|  |  |  |             "baseHref": "/it/", | 
			
		
	
		
			
				
					|  |  |  |             "translation": "apps/client/src/locales/messages.it.xlf" | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -11,6 +11,7 @@ import { NextFunction, Request, Response } from 'express'; | 
			
		
	
		
			
				
					|  |  |  | export class FrontendMiddleware implements NestMiddleware { | 
			
		
	
		
			
				
					|  |  |  |   public indexHtmlDe = ''; | 
			
		
	
		
			
				
					|  |  |  |   public indexHtmlEn = ''; | 
			
		
	
		
			
				
					|  |  |  |   public indexHtmlEs = ''; | 
			
		
	
		
			
				
					|  |  |  |   public indexHtmlIt = ''; | 
			
		
	
		
			
				
					|  |  |  |   public indexHtmlNl = ''; | 
			
		
	
		
			
				
					|  |  |  |   public isProduction: boolean; | 
			
		
	
	
		
			
				
					|  |  | @ -34,6 +35,10 @@ export class FrontendMiddleware implements NestMiddleware { | 
			
		
	
		
			
				
					|  |  |  |         this.getPathOfIndexHtmlFile(DEFAULT_LANGUAGE_CODE), | 
			
		
	
		
			
				
					|  |  |  |         'utf8' | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |       this.indexHtmlEs = fs.readFileSync( | 
			
		
	
		
			
				
					|  |  |  |         this.getPathOfIndexHtmlFile('es'), | 
			
		
	
		
			
				
					|  |  |  |         'utf8' | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |       this.indexHtmlIt = fs.readFileSync( | 
			
		
	
		
			
				
					|  |  |  |         this.getPathOfIndexHtmlFile('it'), | 
			
		
	
		
			
				
					|  |  |  |         'utf8' | 
			
		
	
	
		
			
				
					|  |  | @ -71,6 +76,15 @@ export class FrontendMiddleware implements NestMiddleware { | 
			
		
	
		
			
				
					|  |  |  |           rootUrl: this.configurationService.get('ROOT_URL') | 
			
		
	
		
			
				
					|  |  |  |         }) | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |     } else if (req.path === '/es' || req.path.startsWith('/es/')) { | 
			
		
	
		
			
				
					|  |  |  |       res.send( | 
			
		
	
		
			
				
					|  |  |  |         this.interpolate(this.indexHtmlIt, { | 
			
		
	
		
			
				
					|  |  |  |           featureGraphicPath, | 
			
		
	
		
			
				
					|  |  |  |           languageCode: 'es', | 
			
		
	
		
			
				
					|  |  |  |           path: req.path, | 
			
		
	
		
			
				
					|  |  |  |           rootUrl: this.configurationService.get('ROOT_URL') | 
			
		
	
		
			
				
					|  |  |  |         }) | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |     } else if (req.path === '/it' || req.path.startsWith('/it/')) { | 
			
		
	
		
			
				
					|  |  |  |       res.send( | 
			
		
	
		
			
				
					|  |  |  |         this.interpolate(this.indexHtmlIt, { | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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', 'it', 'nl']; | 
			
		
	
		
			
				
					|  |  |  |   public locales = ['de', 'de-CH', 'en-GB', 'en-US', 'es', 'it', 'nl']; | 
			
		
	
		
			
				
					|  |  |  |   public price: number; | 
			
		
	
		
			
				
					|  |  |  |   public priceId: string; | 
			
		
	
		
			
				
					|  |  |  |   public snackBarRef: MatSnackBarRef<TextOnlySnackBar>; | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -132,6 +132,7 @@ | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option [value]="null"></mat-option> | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option value="de">Deutsch</mat-option> | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option value="en">English</mat-option> | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option value="es">Español</mat-option> | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option value="it">Italiano</mat-option> | 
			
		
	
		
			
				
					|  |  |  |                       <mat-option value="nl">Nederlands</mat-option> | 
			
		
	
		
			
				
					|  |  |  |                     </mat-select> | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -197,8 +197,8 @@ | 
			
		
	
		
			
				
					|  |  |  |             <div class="flex-grow-1"> | 
			
		
	
		
			
				
					|  |  |  |               <h4>Multi-Language</h4> | 
			
		
	
		
			
				
					|  |  |  |               <p class="m-0"> | 
			
		
	
		
			
				
					|  |  |  |                 Use Ghostfolio in multiple languages: English, German and | 
			
		
	
		
			
				
					|  |  |  |                 Italian are currently supported. | 
			
		
	
		
			
				
					|  |  |  |                 Use Ghostfolio in multiple languages: English, Dutch, German, | 
			
		
	
		
			
				
					|  |  |  |                 Italian and Spanish are currently supported. | 
			
		
	
		
			
				
					|  |  |  |               </p> | 
			
		
	
		
			
				
					|  |  |  |             </div> | 
			
		
	
		
			
				
					|  |  |  |           </mat-card> | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -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, it, nl } from 'date-fns/locale'; | 
			
		
	
		
			
				
					|  |  |  | import { de, es, it, nl } 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 === 'es') { | 
			
		
	
		
			
				
					|  |  |  |     return es; | 
			
		
	
		
			
				
					|  |  |  |   } else if (aLanguageCode === 'it') { | 
			
		
	
		
			
				
					|  |  |  |     return it; | 
			
		
	
		
			
				
					|  |  |  |   } else if (aLanguageCode === 'nl') { | 
			
		
	
	
		
			
				
					|  |  | 
 |