From 03f11391606b8d8ed8d49354e1faee38cce897f4 Mon Sep 17 00:00:00 2001 From: Viktoryia Date: Wed, 6 Nov 2024 07:58:36 +0100 Subject: [PATCH] refactor(i18n): improve translation strings formatting and consistency (#988) * fix: auth to authz Signed-off-by: viktoriabakun * refactor: join translation strings Signed-off-by: viktoriabakun * feat: sync translation keys Signed-off-by: viktoriabakun * fix: lowercase 'show inactive' checkbox Signed-off-by: viktoriabakun --------- Signed-off-by: viktoriabakun --- apps/shell/messages/en.json | 138 +++++++++++++++++- libs/authz/src/lib/authz-grants-actions.tsx | 14 +- .../src/lib/components/my-account-block.tsx | 16 +- .../src/lib/components/statistics-block.tsx | 16 +- .../src/lib/components/staking-stats.tsx | 6 +- .../src/lib/components/validator-info.tsx | 6 +- .../src/lib/components/validator-list.tsx | 2 +- 7 files changed, 168 insertions(+), 30 deletions(-) diff --git a/apps/shell/messages/en.json b/apps/shell/messages/en.json index 718a23c92..cc9c9d7de 100644 --- a/apps/shell/messages/en.json +++ b/apps/shell/messages/en.json @@ -28,7 +28,8 @@ "six-months": "6 months", "one-year": "1 year", "five-years": "5 years", - "hundred-years": "100 years" + "hundred-years": "100 years", + "granter": "Granter" }, "common": { "address-label": "Address", @@ -37,13 +38,28 @@ "connect-wallet-message": "You should connect wallet first", "connect-wallet-button": "Connect wallet", "governance": "Governance", - "staking": "Staking", "delegate": "Delegate", - "undelegate": "Undelegate", - "redelegate": "Redelegate", "cancel-button": "Cancel", "confirm-button": "Confirm", - "send-button": "Send" + "address": "Address", + "add-your-memo": "Add your memo", + "balance": "Balance", + "connect-wallet-btn": "Connect wallet", + "governance-title": "Governance", + "grant-access": "Grant access", + "grantee-address": "Grantee address", + "grant-loading": "Grant in progress", + "grant-period": "Grant period", + "grant-success": "Grant successful", + "grant-type": "Grant type", + "invalid-grantee-wallet-message": "You should enter valid grantee wallet to see info", + "memo": "Memo", + "nothing-found": "Nothing found", + "redelegate": "Redelegate", + "selected-grantee": "Selected grantee", + "send-button": "Send", + "staking": "Staking", + "undelegate": "Undelegate" }, "governance": { "add-memo": "Add memo", @@ -90,10 +106,118 @@ "voting-end": "Voting end", "your-balance": "Your balance: {{balance}} {{symbol}}" }, - "main": {}, + "main": { + "available-for-stake": "Available: {{amount}}", + "locked": "Locked: {{amount}}", + "active-out-of-total": "{{active}} out of {{total}}", + "accounts": "Accounts", + "active-validators": "Active validators", + "available-staking": "Available for staking", + "fee": "Fee", + "fetching-proposals": "Fetching proposals", + "fetching-validators": "Fetching validators list", + "latest-proposals": "Latest proposals", + "link-to-governance": "Go to Governance", + "link-to-staking": "Go to Staking", + "liquid-stacked": "Liquid STAKED", + "my-account": "My account", + "my-delegations": "My delegations", + "name": "Name", + "no-delegations": "You don't have any active delegations", + "regular-stacked": "Regular STAKED", + "rewards": "Rewards", + "shell-title": "Shell", + "staked": "Staked", + "staking-balance-popup-message": "In regular staking you can use coins in liquid staking", + "status": "Status", + "total-stacked": "Total staked", + "total-supply": "Total supply", + "voting-power": "Voting power" + }, "staking": { "attention-withdrawal-warning": "Attention! If in the future you want to withdraw the staked funds, it will take {{count}} day{count, plural, one {} other {s}}", - "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}" + "funds-undelegated-in-days": "The funds will be undelegated within {count, plural, one {# day} other {# days}}", + "min-amount-to-claim-rewards": "Minimum amount to claim rewards is {{amount}} ISLM", + "active-status": "Active", + "add-memo": "Add memo", + "address": "Address", + "amount-error-min": "Bellow minimal value", + "amount-error-more-than-delegation": "More than your delegation", + "amount-error-more-than-have": "More than you have", + "annualized-yield": "Annual percentage yield", + "apy": "APY", + "available": "Available", + "claim-all-rewards": "Claim all rewards", + "comission": "Commission", + "commission": "Commission", + "confirm-delegation": "Confirm delegation", + "confirm-redelegation": "Confirm redelegation", + "confirm-undelegation": "Confirm undelegation", + "current": "Current", + "delegate": "Delegate", + "delegate-title": "Delegate", + "delegation-declined": "Delegation declined", + "delegation-progress": "Delegation in progress", + "delegation-success": "Delegation successful", + "description": "Description", + "email": "E-mail", + "estimated-fee": "Estimated fee", + "explorer-link": "Explorer link", + "fee": "Fee", + "fee-asc": "By fee (a-z)", + "fee-desc": "By fee (z-a)", + "fetching-validators-message": "Fetching validators list", + "get-my-rewards": "Get my rewards", + "get-rewards": "Get rewards", + "inactive-status": "Inactive", + "info": "Info", + "jailed-status": "Jailed", + "liquid-staking": "Liquid staking", + "max": "Max", + "max-change": "Max Change", + "memo-placeholder": "Add your memo", + "my-balance": "My balance", + "my-delegation": "My delegation", + "my-delegations": "My delegations", + "my-rewards": "My rewards", + "my-stake": "My stake", + "name": "Name", + "name-asc": "By name (a-z)", + "name-desc": "By name (z-a)", + "power-asc": "By power (a-z)", + "power-desc": "By power (z-a)", + "random": "Random", + "redelegate": "Redelegate", + "redelegate-amount": "Redelegation amount", + "redelegate-progress": "Redelegate in progress", + "redelegate-success": "Redelegation successful", + "regular-staking": "Regular staking", + "reward": "Reward", + "rewards": "Rewards", + "rewards-claimed": "Rewards claimed", + "rewards-claim-in-progress": "Rewards claim in progress", + "rewards-progress": "Rewards claim in progress", + "select-new-validator": "Select new validator", + "show-inactive": "Show inactive", + "sort-by": "Sorting by", + "stacked": "Staked", + "staked": "Staked", + "status": "Status", + "stISLM-in-ISLM": "stISLM in ISLM", + "stride-address-required": "Stride address is required to delegate", + "unbonding": "Unbonding", + "undelegate": "Undelegate", + "undelegate-process": "Undelegate in process", + "undelegation-declined": "Undelegation declined", + "undelegation-progress": "Undelegation in progress", + "undelegation-success": "Undelegation successful", + "validator": "Validator", + "validator-inactive-warning": "While the validator is inactive, you will not be able to receive a reward.", + "validator-info-loading": "Fetching validator information", + "validators": "Validators", + "voting-power": "Voting power", + "website": "Website", + "you-will-get": "What you'll get:" }, "uc-dao": { "dao-page-title": "UnitedContributors DAO", diff --git a/libs/authz/src/lib/authz-grants-actions.tsx b/libs/authz/src/lib/authz-grants-actions.tsx index bb3042385..4a7ab2355 100644 --- a/libs/authz/src/lib/authz-grants-actions.tsx +++ b/libs/authz/src/lib/authz-grants-actions.tsx @@ -76,31 +76,31 @@ export function AuthzGrantsActions() { const GRANT_PERIOD_OPTIONS = [ { - label: t('one-week', '1 Week', { ns: 'auth' }), + label: t('one-week', '1 Week', { ns: 'authz' }), value: '1w', }, { - label: t('one-month', '1 Month', { ns: 'auth' }), + label: t('one-month', '1 Month', { ns: 'authz' }), value: '1m', }, { - label: t('three-months', '3 Months', { ns: 'auth' }), + label: t('three-months', '3 Months', { ns: 'authz' }), value: '3m', }, { - label: t('six-months', '6 Months', { ns: 'auth' }), + label: t('six-months', '6 Months', { ns: 'authz' }), value: '6m', }, { - label: t('one-year', '1 Year', { ns: 'auth' }), + label: t('one-year', '1 Year', { ns: 'authz' }), value: '1y', }, { - label: t('five-years', '5 Years', { ns: 'auth' }), + label: t('five-years', '5 Years', { ns: 'authz' }), value: '5y', }, { - label: t('hundred-years', '100 Years', { ns: 'auth' }), + label: t('hundred-years', '100 Years', { ns: 'authz' }), value: '100y', }, ]; diff --git a/libs/main/src/lib/components/my-account-block.tsx b/libs/main/src/lib/components/my-account-block.tsx index c3976b2ec..8db0ff056 100644 --- a/libs/main/src/lib/components/my-account-block.tsx +++ b/libs/main/src/lib/components/my-account-block.tsx @@ -408,9 +408,9 @@ function StakingBalancePopup({
- {t('available', 'Available')} - {': '} - {formatNumber(balances.availableForStake)} + {t('available-for-stake', 'Available: {amount}', { + amount: formatNumber(balances.availableForStake), + })}
@@ -419,11 +419,11 @@ function StakingBalancePopup({
- {t('locked', 'Locked')} - {': '} - {isLiquidStaking - ? formatNumber(stIslmBalance + balances.locked) - : formatNumber(balances.locked)} + {t('locked', 'Locked: {amount}', { + amount: isLiquidStaking + ? formatNumber(stIslmBalance + balances.locked) + : formatNumber(balances.locked), + })}
diff --git a/libs/main/src/lib/components/statistics-block.tsx b/libs/main/src/lib/components/statistics-block.tsx index a09f5fc88..1ecf28959 100644 --- a/libs/main/src/lib/components/statistics-block.tsx +++ b/libs/main/src/lib/components/statistics-block.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { useTranslate } from '@tolgee/react'; +import { T, useTranslate } from '@tolgee/react'; import { useChainStatsQuery } from '@haqq/shell-shared'; import { formatNumber, formatPercents } from '@haqq/shell-ui-kit/server'; @@ -79,10 +79,16 @@ export function StatisticsBlock() {
{!isFetching && (
- {valsActive} - -  {t('out of', 'out of')} {valsTotal} - + , + }} + />
)}
diff --git a/libs/staking/src/lib/components/staking-stats.tsx b/libs/staking/src/lib/components/staking-stats.tsx index 5872fe576..eaf21acc1 100644 --- a/libs/staking/src/lib/components/staking-stats.tsx +++ b/libs/staking/src/lib/components/staking-stats.tsx @@ -110,7 +110,11 @@ export function StakingStatsDesktop({ diff --git a/libs/staking/src/lib/components/validator-info.tsx b/libs/staking/src/lib/components/validator-info.tsx index 6542635bc..6076f6b4d 100644 --- a/libs/staking/src/lib/components/validator-info.tsx +++ b/libs/staking/src/lib/components/validator-info.tsx @@ -908,7 +908,11 @@ export function ValidatorBlockDesktop({ diff --git a/libs/staking/src/lib/components/validator-list.tsx b/libs/staking/src/lib/components/validator-list.tsx index ec5b89c3f..a3ba87e81 100644 --- a/libs/staking/src/lib/components/validator-list.tsx +++ b/libs/staking/src/lib/components/validator-list.tsx @@ -171,8 +171,8 @@ export function ValidatorList({ )} - {/* TODO: how to translate such errors if they come from BE?*/} {status === 'error' && ( + // eslint-disable-next-line i18next/no-literal-string

Error: {error?.message ?? 'unknown error'}

)}