Skip to content

Commit

Permalink
refactor(i18n): improve translation strings formatting and consistency (
Browse files Browse the repository at this point in the history
#988)

* fix: auth to authz

Signed-off-by: viktoriabakun <viktoriabakun00@gmail.com>

* refactor: join translation strings

Signed-off-by: viktoriabakun <viktoriabakun00@gmail.com>

* feat: sync translation keys

Signed-off-by: viktoriabakun <viktoriabakun00@gmail.com>

* fix: lowercase 'show inactive' checkbox

Signed-off-by: viktoriabakun <viktoriabakun00@gmail.com>

---------

Signed-off-by: viktoriabakun <viktoriabakun00@gmail.com>
  • Loading branch information
viktoriabakun authored and olegshilov committed Nov 6, 2024
1 parent 8aab93b commit e1b574a
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 30 deletions.
138 changes: 131 additions & 7 deletions apps/shell/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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}} <span>out of {{total}}</span>",
"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",
Expand Down
14 changes: 7 additions & 7 deletions libs/authz/src/lib/authz-grants-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
];
Expand Down
16 changes: 8 additions & 8 deletions libs/main/src/lib/components/my-account-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ function StakingBalancePopup({
<div className="flex flex-row items-center gap-[4px]">
<CoinIcon />
<div className="text-[14px] leading-[22px] text-white">
{t('available', 'Available')}
{': '}
{formatNumber(balances.availableForStake)}
{t('available-for-stake', 'Available: {amount}', {
amount: formatNumber(balances.availableForStake),
})}
</div>
</div>
</div>
Expand All @@ -419,11 +419,11 @@ function StakingBalancePopup({
<div className="flex flex-row items-center gap-[4px]">
<LockIcon />
<div className="text-[14px] leading-[22px] text-white">
{t('locked', 'Locked')}
{': '}
{isLiquidStaking
? formatNumber(stIslmBalance + balances.locked)
: formatNumber(balances.locked)}
{t('locked', 'Locked: {amount}', {
amount: isLiquidStaking
? formatNumber(stIslmBalance + balances.locked)
: formatNumber(balances.locked),
})}
</div>
</div>

Expand Down
16 changes: 11 additions & 5 deletions libs/main/src/lib/components/statistics-block.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -79,10 +79,16 @@ export function StatisticsBlock() {
<div className="font-guise inline-flex space-x-[5px] text-[12px] font-[500] leading-[20px] sm:text-[13px]">
{!isFetching && (
<div>
{valsActive}
<span className="text-white/50">
&nbsp;{t('out of', 'out of')} {valsTotal}
</span>
<T
keyName="active-out-of-total"
ns="main"
defaultValue="{active} <span>out of {total}</span>"
params={{
active: valsActive,
total: valsTotal,
span: <span className="text-white/50" />,
}}
/>
</div>
)}
</div>
Expand Down
6 changes: 5 additions & 1 deletion libs/staking/src/lib/components/staking-stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export function StakingStatsDesktop({
<Tooltip
text={
Number.parseFloat(rewards) < MIN_REWARDS_TO_CLAIM
? `${t('min-amount-to-claim-rewards', 'Minimum amount to claim rewards is')} ${MIN_REWARDS_TO_CLAIM} ISLM`
? t(
'min-amount-to-claim-rewards',
'Minimum amount to claim rewards is {amount} ISLM',
{ amount: MIN_REWARDS_TO_CLAIM },
)
: ''
}
>
Expand Down
6 changes: 5 additions & 1 deletion libs/staking/src/lib/components/validator-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,11 @@ export function ValidatorBlockDesktop({
<Tooltip
text={
rewards < MIN_REWARDS_TO_CLAIM
? `${t('min-amount-to-claim-rewards', 'Minimum amount to claim rewards is')} ${MIN_REWARDS_TO_CLAIM} ISLM`
? t(
'min-amount-to-claim-rewards',
'Minimum amount to claim rewards is {amount} ISLM',
{ amount: MIN_REWARDS_TO_CLAIM },
)
: ''
}
>
Expand Down
2 changes: 1 addition & 1 deletion libs/staking/src/lib/components/validator-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ export function ValidatorList({
</div>
)}

{/* TODO: how to translate such errors if they come from BE?*/}
{status === 'error' && (
// eslint-disable-next-line i18next/no-literal-string
<p>Error: {error?.message ?? 'unknown error'}</p>
)}

Expand Down

0 comments on commit e1b574a

Please sign in to comment.