From 79fdea592af0cb2f286e730ae0354eb9959e0804 Mon Sep 17 00:00:00 2001 From: rohit Date: Mon, 21 Jul 2025 10:32:12 +0530 Subject: [PATCH] feat(i18n): add localization for Regional Market Cluster Risks (#5107) --- .../asia-pacific.ts | 18 +++++++++--------- .../emerging-markets.ts | 16 ++++++++-------- .../regional-market-cluster-risk/europe.ts | 16 ++++++++-------- .../regional-market-cluster-risk/japan.ts | 16 ++++++++-------- .../north-america.ts | 16 ++++++++-------- apps/client/src/app/pages/i18n/i18n-page.html | 3 --- 6 files changed, 41 insertions(+), 44 deletions(-) diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts b/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts index 616a56b78..c72a3b807 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/asia-pacific.ts @@ -33,23 +33,23 @@ export class RegionalMarketClusterRiskAsiaPacific extends Rule { if (asiaPacificMarketValueRatio > ruleSettings.thresholdMax) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskAsiaPacific.false.max', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), valueRatio: (asiaPacificMarketValueRatio * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) - } + }, }), value: false }; } else if (asiaPacificMarketValueRatio < ruleSettings.thresholdMin) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskAsiaPacific.false.min', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), valueRatio: (asiaPacificMarketValueRatio * 100).toPrecision(3), - thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3) } }), value: false @@ -58,12 +58,12 @@ export class RegionalMarketClusterRiskAsiaPacific extends Rule { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskAsiaPacific.true', + languageCode: this.getLanguageCode(), placeholders: { - valueRatio: (asiaPacificMarketValueRatio * 100).toPrecision(3), + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) + valueRatio: (asiaPacificMarketValueRatio * 100).toPrecision(3), } }), value: true @@ -89,8 +89,8 @@ export class RegionalMarketClusterRiskAsiaPacific extends Rule { public getName() { return this.i18nService.getTranslation({ + id: 'rule.regionalMarketClusterRiskAsiaPacific', languageCode: this.getLanguageCode(), - id: 'rule.regionalMarketClusterRiskAsiaPacific' }); } diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts b/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts index 6b164603d..8469d7f61 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/emerging-markets.ts @@ -35,11 +35,11 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule { if (emergingMarketsValueRatio > ruleSettings.thresholdMax) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEmergingMarkets.false.max', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), valueRatio: (emergingMarketsValueRatio * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) } }), value: false @@ -47,11 +47,11 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule { } else if (emergingMarketsValueRatio < ruleSettings.thresholdMin) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEmergingMarkets.false.min', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), valueRatio: (emergingMarketsValueRatio * 100).toPrecision(3), - thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3) } }), value: false @@ -60,12 +60,12 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEmergingMarkets.true', + languageCode: this.getLanguageCode(), placeholders: { - valueRatio: (emergingMarketsValueRatio * 100).toPrecision(3), + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) + valueRatio: (emergingMarketsValueRatio * 100).toPrecision(3), } }), value: true @@ -91,8 +91,8 @@ export class RegionalMarketClusterRiskEmergingMarkets extends Rule { public getName() { return this.i18nService.getTranslation({ + id: 'rule.regionalMarketClusterRiskEmergingMarkets', languageCode: this.getLanguageCode(), - id: 'rule.regionalMarketClusterRiskEmergingMarkets' }); } diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts b/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts index 55ac3ffb2..a910c441b 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/europe.ts @@ -33,11 +33,11 @@ export class RegionalMarketClusterRiskEurope extends Rule { if (europeMarketValueRatio > ruleSettings.thresholdMax) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEurope.false.max', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), valueRatio: (europeMarketValueRatio * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) } }), value: false @@ -45,11 +45,11 @@ export class RegionalMarketClusterRiskEurope extends Rule { } else if (europeMarketValueRatio < ruleSettings.thresholdMin) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEurope.false.min', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), valueRatio: (europeMarketValueRatio * 100).toPrecision(3), - thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3) } }), value: false @@ -58,12 +58,12 @@ export class RegionalMarketClusterRiskEurope extends Rule { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskEurope.true', + languageCode: this.getLanguageCode(), placeholders: { - valueRatio: (europeMarketValueRatio * 100).toPrecision(3), + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) + valueRatio: (europeMarketValueRatio * 100).toPrecision(3), } }), value: true @@ -89,8 +89,8 @@ export class RegionalMarketClusterRiskEurope extends Rule { public getName() { return this.i18nService.getTranslation({ + id: 'rule.regionalMarketClusterRiskEurope', languageCode: this.getLanguageCode(), - id: 'rule.regionalMarketClusterRiskEurope' }); } diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts b/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts index 6107a4826..38be7b5fc 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/japan.ts @@ -33,11 +33,11 @@ export class RegionalMarketClusterRiskJapan extends Rule { if (japanMarketValueRatio > ruleSettings.thresholdMax) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskJapan.false.max', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), valueRatio: (japanMarketValueRatio * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) } }), value: false @@ -45,11 +45,11 @@ export class RegionalMarketClusterRiskJapan extends Rule { } else if (japanMarketValueRatio < ruleSettings.thresholdMin) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskJapan.false.min', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), valueRatio: (japanMarketValueRatio * 100).toPrecision(3), - thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3) } }), value: false @@ -58,12 +58,12 @@ export class RegionalMarketClusterRiskJapan extends Rule { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskJapan.true', + languageCode: this.getLanguageCode(), placeholders: { - valueRatio: (japanMarketValueRatio * 100).toPrecision(3), + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) + valueRatio: (japanMarketValueRatio * 100).toPrecision(3), } }), value: true @@ -89,8 +89,8 @@ export class RegionalMarketClusterRiskJapan extends Rule { public getName() { return this.i18nService.getTranslation({ + id: 'rule.regionalMarketClusterRiskJapan', languageCode: this.getLanguageCode(), - id: 'rule.regionalMarketClusterRiskJapan' }); } diff --git a/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts b/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts index 62dd197cd..69e56bb15 100644 --- a/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts +++ b/apps/api/src/models/rules/regional-market-cluster-risk/north-america.ts @@ -33,11 +33,11 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule { if (northAmericaMarketValueRatio > ruleSettings.thresholdMax) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskNorthAmerica.false.max', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), valueRatio: (northAmericaMarketValueRatio * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) } }), value: false @@ -45,11 +45,11 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule { } else if (northAmericaMarketValueRatio < ruleSettings.thresholdMin) { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskNorthAmerica.false.min', + languageCode: this.getLanguageCode(), placeholders: { + thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), valueRatio: (northAmericaMarketValueRatio * 100).toPrecision(3), - thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3) } }), value: false @@ -58,12 +58,12 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule { return { evaluation: this.i18nService.getTranslation({ - languageCode: this.getLanguageCode(), id: 'rule.regionalMarketClusterRiskNorthAmerica.true', + languageCode: this.getLanguageCode(), placeholders: { - valueRatio: (northAmericaMarketValueRatio * 100).toPrecision(3), + thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3), thresholdMin: (ruleSettings.thresholdMin * 100).toPrecision(3), - thresholdMax: (ruleSettings.thresholdMax * 100).toPrecision(3) + valueRatio: (northAmericaMarketValueRatio * 100).toPrecision(3), } }), value: true @@ -89,8 +89,8 @@ export class RegionalMarketClusterRiskNorthAmerica extends Rule { public getName() { return this.i18nService.getTranslation({ + id: 'rule.regionalMarketClusterRiskNorthAmerica', languageCode: this.getLanguageCode(), - id: 'rule.regionalMarketClusterRiskNorthAmerica' }); } diff --git a/apps/client/src/app/pages/i18n/i18n-page.html b/apps/client/src/app/pages/i18n/i18n-page.html index 4f153490b..e848ce4e4 100644 --- a/apps/client/src/app/pages/i18n/i18n-page.html +++ b/apps/client/src/app/pages/i18n/i18n-page.html @@ -26,7 +26,6 @@ (${valueRatio}%) is within the range of ${thresholdMin}% and ${thresholdMax}% -
  • Emerging Markets
  • @@ -43,7 +42,6 @@ (${valueRatio}%) is within the range of ${thresholdMin}% and ${thresholdMax}% -
  • Europe
  • The Europe market contribution of your current investment @@ -58,7 +56,6 @@ (${valueRatio}%) is within the range of ${thresholdMin}% and ${thresholdMax}%
  • -
  • Japan
  • The Japan market contribution of your current investment