Browse Source

CurrencyClusterRiskBaseCurrencyCurrentInvestment localized

pull/5038/head
csehatt741 5 days ago
parent
commit
8af9dc7b11
  1. 37
      apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts
  2. 11
      apps/client/src/app/pages/i18n/i18n-page.html

37
apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts

@ -1,6 +1,7 @@
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { Rule } from '@ghostfolio/api/models/rule';
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';
import { PortfolioPosition, UserSettings } from '@ghostfolio/common/interfaces';
export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Settings> {
@ -8,10 +9,13 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Setti
public constructor(
protected exchangeRateDataService: ExchangeRateDataService,
holdings: PortfolioPosition[]
private i18nService: I18nService,
holdings: PortfolioPosition[],
languageCode: string
) {
super(exchangeRateDataService, {
key: CurrencyClusterRiskBaseCurrencyCurrentInvestment.name
key: CurrencyClusterRiskBaseCurrencyCurrentInvestment.name,
languageCode
});
this.holdings = holdings;
@ -48,17 +52,29 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Setti
if (maxItem?.groupKey !== ruleSettings.baseCurrency) {
return {
evaluation: `The major part of your current investment is not in your base currency (${(
baseCurrencyValueRatio * 100
).toPrecision(3)}% in ${ruleSettings.baseCurrency})`,
evaluation: this.i18nService.getTranslation({
id: 'rule.currencyClusterRiskBaseCurrencyCurrentInvestment.false',
languageCode: this.getLanguageCode(),
placeholders: {
baseCurrencyValueRatio: (baseCurrencyValueRatio * 100).toPrecision(
3
),
baseCurrency: ruleSettings.baseCurrency
}
}),
value: false
};
}
return {
evaluation: `The major part of your current investment is in your base currency (${(
baseCurrencyValueRatio * 100
).toPrecision(3)}% in ${ruleSettings.baseCurrency})`,
evaluation: this.i18nService.getTranslation({
id: 'rule.currencyClusterRiskBaseCurrencyCurrentInvestment.true',
languageCode: this.getLanguageCode(),
placeholders: {
baseCurrencyValueRatio: (baseCurrencyValueRatio * 100).toPrecision(3),
baseCurrency: ruleSettings.baseCurrency
}
}),
value: true
};
}
@ -68,7 +84,10 @@ export class CurrencyClusterRiskBaseCurrencyCurrentInvestment extends Rule<Setti
}
public getName() {
return 'Investment: Base Currency';
return this.i18nService.getTranslation({
id: 'rule.currencyClusterRiskBaseCurrencyCurrentInvestment',
languageCode: this.getLanguageCode()
});
}
public getSettings({ baseCurrency, xRayRules }: UserSettings): Settings {

11
apps/client/src/app/pages/i18n/i18n-page.html

@ -57,6 +57,17 @@
($&#123;fixedIncomeValueRatio&#125;%) is within the range of
$&#123;thresholdMin&#125;% and $&#123;thresholdMax&#125;%
</li>
<li i18n="@@rule.currencyClusterRiskBaseCurrencyCurrentInvestment">
Investment: Base Currency
</li>
<li i18n="@@rule.currencyClusterRiskBaseCurrencyCurrentInvestment.false">
The major part of your current investment is not in your base currency
($&#123;baseCurrencyValueRatio&#125;% in $&#123;baseCurrency&#125;)
</li>
<li i18n="@@rule.currencyClusterRiskBaseCurrencyCurrentInvestment.true">
The major part of your current investment is in your base currency
($&#123;baseCurrencyValueRatio&#125;% in $&#123;baseCurrency&#125;)
</li>
<li i18n="@@rule.emergencyFundSetup">Emergency Fund: Set up</li>
<li i18n="@@rule.emergencyFundSetup.false">
No emergency fund has been set up

Loading…
Cancel
Save