Browse Source

Setup pt

pull/1439/head
Thomas 3 years ago
parent
commit
201198c55f
  1. 14
      apps/api/src/app/frontend.middleware.ts
  2. 14
      apps/client/project.json
  3. 2
      apps/client/src/app/pages/account/account-page.component.ts
  4. 4
      apps/client/src/app/pages/account/account-page.html
  5. 2
      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

@ -16,6 +16,7 @@ export class FrontendMiddleware implements NestMiddleware {
public indexHtmlEs = '';
public indexHtmlIt = '';
public indexHtmlNl = '';
public indexHtmlPt = '';
public isProduction: boolean;
public constructor(
@ -49,6 +50,10 @@ export class FrontendMiddleware implements NestMiddleware {
this.getPathOfIndexHtmlFile('nl'),
'utf8'
);
this.indexHtmlPt = fs.readFileSync(
this.getPathOfIndexHtmlFile('pt'),
'utf8'
);
} catch {}
}
@ -126,6 +131,15 @@ export class FrontendMiddleware implements NestMiddleware {
rootUrl: this.configurationService.get('ROOT_URL')
})
);
} else if (req.path === '/pt' || req.path.startsWith('/pt/')) {
res.send(
this.interpolate(this.indexHtmlPt, {
featureGraphicPath,
languageCode: 'pt',
path: req.path,
rootUrl: this.configurationService.get('ROOT_URL')
})
);
} else {
response.send(
this.interpolate(this.indexHtmlEn, {

14
apps/client/project.json

@ -97,6 +97,10 @@
"baseHref": "/nl/",
"localize": ["nl"]
},
"development-pt": {
"baseHref": "/pt/",
"localize": ["pt"]
},
"production": {
"fileReplacements": [
{
@ -150,6 +154,9 @@
"development-nl": {
"browserTarget": "client:build:development-nl"
},
"development-pt": {
"browserTarget": "client:build:development-pt"
},
"production": {
"browserTarget": "client:build:production"
}
@ -165,7 +172,8 @@
"messages.de.xlf",
"messages.es.xlf",
"messages.it.xlf",
"messages.nl.xlf"
"messages.nl.xlf",
"messages.pt.xlf"
]
}
},
@ -201,6 +209,10 @@
"nl": {
"baseHref": "/nl/",
"translation": "apps/client/src/locales/messages.nl.xlf"
},
"pt": {
"baseHref": "/pt/",
"translation": "apps/client/src/locales/messages.pt.xlf"
}
},
"sourceLocale": "en"

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

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

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

@ -143,6 +143,10 @@
>Nederlands (<ng-container i18n>Community</ng-container
>)</mat-option
>
<!--<mat-option value="pt"
>Português (<ng-container i18n>Community</ng-container
>)</mat-option
>-->
</mat-select>
</mat-form-field>
</div>

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

@ -198,7 +198,7 @@
<h4>Multi-Language</h4>
<p class="m-0">
Use Ghostfolio in multiple languages: English, Dutch, German,
Italian and Spanish are currently supported.
Italian, Portuguese and Spanish are currently supported.
</p>
</div>
</mat-card>

4
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 } from 'date-fns/locale';
import { de, es, it, nl, pt } from 'date-fns/locale';
import { ghostfolioScraperApiSymbolPrefix, locale } from './config';
import { Benchmark } from './interfaces';
@ -83,6 +83,8 @@ export function getDateFnsLocale(aLanguageCode: string) {
return it;
} else if (aLanguageCode === 'nl') {
return nl;
} else if (aLanguageCode === 'pt') {
return pt;
}
return undefined;

Loading…
Cancel
Save