From 8441f7509c16f03e5d1610664da1ba8a965e9933 Mon Sep 17 00:00:00 2001 From: kayyrod21 Date: Sat, 14 Mar 2026 20:02:54 -0400 Subject: [PATCH] feat(graphs): extract hardcoded chart labels to $localize for i18n support - Replace string literals in legend and series names - Use explicit equality checks instead of .includes() - Fix mode switching regression in block fees/subsidy graph - Align tooltip construction with localized labels fix(i18n): localize block rewards graph legend and tooltip strings Localizes: - "Rewards BTC" - "Rewards {currency}" - "* On average around block X" Includes correct $localize placeholder metadata. Closes #3334 fix(i18n): Correct localized placeholder metadata --- .../block-rewards-graph.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts b/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts index 3f2786504..3c39bc7ce 100644 --- a/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts +++ b/frontend/src/app/components/block-rewards-graph/block-rewards-graph.component.ts @@ -170,7 +170,7 @@ export class BlockRewardsGraphComponent implements OnInit { } } - tooltip += `* On average around block ${data[0].data[2]}`; + tooltip += `${$localize`:@@graphs.blockRewards.avgBlock:* On average around block ${data[0].data[2]}:BLOCK:`}`; return tooltip; }.bind(this) }, @@ -185,7 +185,7 @@ export class BlockRewardsGraphComponent implements OnInit { legend: data.blockRewards.length === 0 ? undefined : { data: [ { - name: 'Rewards BTC', + name: $localize`:@@graphs.blockRewards.rewardsBtc:Rewards BTC`, inactiveColor: 'rgb(110, 112, 121)', textStyle: { color: 'white', @@ -193,7 +193,7 @@ export class BlockRewardsGraphComponent implements OnInit { icon: 'roundRect', }, { - name: 'Rewards ' + this.currency, + name: $localize`:@@graphs.blockRewards.rewardsFiat:Rewards ${this.currency}:currency:`, inactiveColor: 'rgb(110, 112, 121)', textStyle: { color: 'white', @@ -250,7 +250,7 @@ export class BlockRewardsGraphComponent implements OnInit { legendHoverLink: false, zlevel: 0, yAxisIndex: 0, - name: 'Rewards BTC', + name: $localize`:@@graphs.blockRewards.rewardsBtc:Rewards BTC`, data: data.blockRewards, type: 'line', smooth: 0.25, @@ -260,7 +260,7 @@ export class BlockRewardsGraphComponent implements OnInit { legendHoverLink: false, zlevel: 1, yAxisIndex: 1, - name: 'Rewards ' + this.currency, + name: $localize`:@@graphs.blockRewards.rewardsFiat:Rewards ${this.currency}:currency:`, data: data.blockRewardsFiat, type: 'line', smooth: 0.25,