diff --git a/packages/apps/public/locales/ar/translation.json b/packages/apps/public/locales/ar/translation.json index b68d0e2f3b..709a90d92b 100644 --- a/packages/apps/public/locales/ar/translation.json +++ b/packages/apps/public/locales/ar/translation.json @@ -1264,17 +1264,16 @@ "{{currency}} total": "{{الإجمالي {{العملة", "{{days}} days": "{{أيام {{أيام", "{{done}}/{{total}}, {{progress}}% done": "%تم}}/{{المجموع}} , {{تقدم}}تم}}", - "{{d}} days": "{{أيام {{ي", "{{executionTime}}s execution time": "وقت التنفيذ}} من زمن التنفيذ}}", - "{{h}} hrs": "{{ساعات {{س", - "{{m}} mins": "{{دقائق {{د", + "{{hours}} hrs": "{{ساعات {{س", + "{{minutes}} mins": "{{دقائق {{د", "{{name}} ({{size}} bytes)": "({{الإسم}} ({{الحجم}} من البايتات}}", "{{percentage}} aye": "{{نعم {{النسبة المئوية", "{{percentage}}% of block time": "النسبة المئوية}}% من وقت البلوك}}", "{{percentage}}% turnout": "{{نسبة مئوية}}٪ إقبال", "{{relayDispatchQueueSize}} dispatch messages pending": "حجم ترحيل إرسال قائمة الانتظار}} الرسائل المرسلة المعلقة}}", + "{{seconds}} s": "{{دقائق {{د", "{{step}}. Sign with your ETH address": "{{قم بتسجيل الدخول باستخدام عنوان إيثيريوم الخاص بك {{خطوة", - "{{s}} s": "{{دقائق {{د", "{{threshold}}, not passing": "سقف}}، لا يتم تمريره}}", "{{threshold}}, passing": "سقف}}، يتم تمريره}}", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "({{قفل}} (تاريخ إصدار {{أيام}}x رصيد التصويت، مقفل لـ x {{قيمة }}" diff --git a/packages/apps/public/locales/en/react-query.json b/packages/apps/public/locales/en/react-query.json index e5b2f3f39e..9136f1af6e 100644 --- a/packages/apps/public/locales/en/react-query.json +++ b/packages/apps/public/locales/en/react-query.json @@ -6,8 +6,8 @@ "Unknown": "Unknown", "everything": "everything", "everything{{labelPost}}": "everything{{labelPost}}", - "{{d}} days": "{{d}} days", - "{{h}} hrs": "{{h}} hrs", - "{{m}} mins": "{{m}} mins", - "{{s}} s": "{{s}} s" + "{{days}} days": "{{days}} days", + "{{hours}} hrs": "{{hours}} hrs", + "{{minutes}} mins": "{{minutes}} mins", + "{{seconds}} s": "{{seconds}} s" } \ No newline at end of file diff --git a/packages/apps/public/locales/en/translation.json b/packages/apps/public/locales/en/translation.json index 2ef69274f4..32216cb476 100644 --- a/packages/apps/public/locales/en/translation.json +++ b/packages/apps/public/locales/en/translation.json @@ -1158,15 +1158,15 @@ "{{currency}} rewards": "", "{{currency}} slashed": "", "{{currency}} total": "", + "{{days}} days": "", "{{done}}/{{total}}, {{progress}}% done": "", - "{{d}} days": "", - "{{h}} hrs": "", - "{{m}} mins": "", + "{{hours}} hrs": "", + "{{minutes}} mins": "", "{{name}} ({{size}} bytes)": "", "{{percentage}} aye": "", "{{percentage}}% turnout": "", "{{relayDispatchQueueSize}} dispatch messages pending": "", - "{{s}} s": "", + "{{seconds}} s": "", "{{threshold}}, not passing": "", "{{threshold}}, passing": "", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "" diff --git a/packages/apps/public/locales/es/translation.json b/packages/apps/public/locales/es/translation.json index 9e99b7700e..2b479de129 100644 --- a/packages/apps/public/locales/es/translation.json +++ b/packages/apps/public/locales/es/translation.json @@ -1103,15 +1103,15 @@ "{{currency}} rewards": "{{currency}} ganancias", "{{currency}} slashed": "{{currency}} recortados", "{{currency}} total": "{{currency}} total", + "{{days}} days": "{{days}} días", "{{done}}/{{total}}, {{progress}}% done": "{{done}}/{{total}}, {{progress}}% terminado", - "{{d}} days": "{{d}} días", - "{{h}} hrs": "{{h}} horas", - "{{m}} mins": "{{m}} minutos", + "{{hours}} hrs": "{{hours}} horas", + "{{minutes}} mins": "{{minutes}} minutos", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{percentage}} aye": "{{percentage}} si", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} enviar mensajes pendientes", + "{{seconds}} s": "{{seconds}} segundos", "{{step}}. Sign with your ETH address": "{{step}}. Firme con su dirección de ETH", - "{{s}} s": "{{s}} segundos", "{{threshold}}, not passing": "{{threshold}}, no pasará", "{{threshold}}, passing": "{{threshold}}, de aprobación", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}}x saldo de votos, bloqueado por {{lock}}x sentencia ({{period}} días." diff --git a/packages/apps/public/locales/idn/translation.json b/packages/apps/public/locales/idn/translation.json index b093c49b3c..4984dadb3c 100644 --- a/packages/apps/public/locales/idn/translation.json +++ b/packages/apps/public/locales/idn/translation.json @@ -977,15 +977,14 @@ "{{currency}} slashed": "{{currency}} slash", "{{currency}} total": "{{currency}} total", "{{days}} days": "{{days}} hari", - "{{d}} days": "{{d}} hari", "{{executionTime}}s execution time": "{{executionTime}} waktu eksekusi", - "{{h}} hrs": "{{h}} jam", - "{{m}} mins": "{{m}} menit", + "{{hours}} hrs": "{{hours}} jam", + "{{minutes}} mins": "{{minutes}} menit", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{percentage}} aye": "{{percentage}} aye", "{{percentage}}% of block time": "{{percentage}}% waktu blok", + "{{seconds}} s": "{{seconds}} detik", "{{step}}. Sign with your ETH address": "{{step}}. Tanda tangan dengan alamat ETH anda", - "{{s}} s": "{{s}} detik", "{{threshold}}, not passing": "{{threshold}}, tidak melewati", "{{threshold}}, passing": "{{threshold}}, melewati", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}}x memilih saldo, terkunci untuk {{lock}}x berlaku ({{period}} hari)" diff --git a/packages/apps/public/locales/it/translation.json b/packages/apps/public/locales/it/translation.json index 19dcd56776..8d36ee7418 100644 --- a/packages/apps/public/locales/it/translation.json +++ b/packages/apps/public/locales/it/translation.json @@ -1030,16 +1030,16 @@ "your new password": "la tua nuova password", "{{blocks}} blocks": "{{blocks}} blocchi", "{{count}} key/value pairs encoded for submission": "{{count}} coppie chiave/valore codificate per l'invio", + "{{days}} days": "{{days}} giorni", "{{done}}/{{total}}, {{progress}}% done": "{{done}}/{{total}}, {{progress}}% done", - "{{d}} days": "{{d}} giorni", "{{executionTime}}s execution time": "{{executionTime}}s tempo di esecuzione", - "{{h}} hrs": "{{h}} ore", - "{{m}} mins": "{{m}} minuti", + "{{hours}} hrs": "{{hours}} ore", + "{{minutes}} mins": "{{minutes}} minuti", "{{percentage}} aye": "{{percentage}} Si", "{{percentage}}% of block time": "{percentage}}% di avanzamento del blocco", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} messaggi in coda di implementazione", + "{{seconds}} s": "{{seconds}} secondi", "{{step}}. Sign with your ETH address": "{{step}}. Firma con il tuo indirizzo ETH", - "{{s}} s": "{{s}} secondi", "{{threshold}}, not passing": "{{threshold}}, respinta", "{{threshold}}, passing": "{{threshold}}, approvato", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}} x saldo dei voti, bloccato per {{lock}}x promulgazione {{period}} giorni)" diff --git a/packages/apps/public/locales/ja/translation.json b/packages/apps/public/locales/ja/translation.json index 3c55d571a2..01383c077f 100644 --- a/packages/apps/public/locales/ja/translation.json +++ b/packages/apps/public/locales/ja/translation.json @@ -556,12 +556,12 @@ "your current password": "現在のパスワード", "your new password": "新しいパスワード", "{{count}} key/value pairs encoded for submission": "エンコードされた {count}} キー/値 のペアー", - "{{d}} days": "{{d}}日", + "{{days}} days": "{{days}}日", "{{executionTime}}s execution time": "{{executionTime}} 実行時間", - "{{h}} hrs": "{{h}} 時間", - "{{m}} mins": "{{m}} 分", + "{{hours}} hrs": "{{hours}} 時間", + "{{minutes}} mins": "{{minutes}} 分", "{{percentage}}% of block time": "ブロックタイム {{percentage}} %", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} ディスパッチメッセージペンディング", - "{{step}}. Sign with your ETH address": "{{step}}. ETHアドレスでサインしてください", - "{{s}} s": "{{s}} 秒" + "{{seconds}} s": "{{seconds}} 秒", + "{{step}}. Sign with your ETH address": "{{step}}. ETHアドレスでサインしてください" } \ No newline at end of file diff --git a/packages/apps/public/locales/pt/translation.json b/packages/apps/public/locales/pt/translation.json index 1f2799b170..1167de7782 100644 --- a/packages/apps/public/locales/pt/translation.json +++ b/packages/apps/public/locales/pt/translation.json @@ -1108,17 +1108,17 @@ "{{currency}} rewards": "{{currency}} recompensas", "{{currency}} slashed": "{{currency}} punições", "{{currency}} total": "{{currency}} total", + "{{days}} days": "{{days}} dias", "{{done}}/{{total}}, {{progress}}% done": "{{done}}/{{total}}, {{progress}}% concluído", - "{{d}} days": "{{d}} dias", "{{executionTime}}s execution timetempo de execução de ": "{{ExecutionTime}}", - "{{h}} hrs": "{{h}} hrs", - "{{m}} mins": "{{m}} min", + "{{hours}} hrs": "{{hours}} hrs", + "{{minutes}} mins": "{{minutes}} min", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{percentage}} aye": "{{percent}} sim", "{{percentage}}% of block time": "{{percent}}% de tempo de bloqueio", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} envia mensagens pendentes", + "{{seconds}} s": "{{seconds}} s", "{{step}}. Sign with your ETH address": "{{step}}. Assine com seu endereço ETH", - "{{s}} s": "{{s}} s", "{{threshold}}, not passing": "{{threshold}}, não passando", "{{threshold}}, passing": "{{threshold}}, passando", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}} x saldo de votos, bloqueado por {{lock}} x promulgação ({{period}} dias)" diff --git a/packages/apps/public/locales/ru/translation.json b/packages/apps/public/locales/ru/translation.json index 8c07135631..bd9fd158e4 100644 --- a/packages/apps/public/locales/ru/translation.json +++ b/packages/apps/public/locales/ru/translation.json @@ -1121,15 +1121,15 @@ "{{currency}} rewards": "{{currency}} вознаграждения", "{{currency}} slashed": "{{currency}} слэш", "{{currency}} total": "{{currency}} всего", + "{{days}} days": "{{days}} д.", "{{done}}/{{total}}, {{progress}}% done": "{{done}}/{{total}}, {{progress}}% закончено", - "{{d}} days": "{{d}} д.", - "{{h}} hrs": "{{h}} ч", - "{{m}} mins": "{{m}} мин.", + "{{hours}} hrs": "{{hours}} ч", + "{{minutes}} mins": "{{minutes}} мин.", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{percentage}} aye": "{{percentage}} да", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} сообщений в очереди", + "{{seconds}} s": "{{seconds}} с", "{{step}}. Sign with your ETH address": "{{step}}. Подпишите Вашим адресом Ethereum", - "{{s}} s": "{{s}} с", "{{threshold}}, not passing": "{{threshold}}, не проходит", "{{threshold}}, passing": "{{threshold}}, проходит", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}}x баланс голосования, заблокировано на {{lock}}x ({{period}} дней)" diff --git a/packages/apps/public/locales/zh/translation.json b/packages/apps/public/locales/zh/translation.json index d2a25c8493..0c337f23b1 100644 --- a/packages/apps/public/locales/zh/translation.json +++ b/packages/apps/public/locales/zh/translation.json @@ -1367,17 +1367,16 @@ "{{currency}} total": "{{currency}} 总数", "{{days}} days": "{{days}} 天", "{{done}}/{{total}}, {{progress}}% done": "{{done}}/{{total}}, {{progress}}% done", - "{{d}} days": "{{d}} 天", "{{executionTime}}s execution time": "{{executionTime}}s 执行时间", - "{{h}} hrs": "{{h}} 小时", - "{{m}} mins": "{{m}} 分钟", + "{{hours}} hrs": "{{hours}} 小时", + "{{minutes}} mins": "{{minutes}} 分钟", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{percentage}} aye": "{{percentage}} 是", "{{percentage}}% of block time": "{{percentage}}% 区块时间", "{{percentage}}% turnout": "{{percentage}}% 结果", "{{relayDispatchQueueSize}} dispatch messages pending": "{{relayDispatchQueueSize}} 调度信息待定", + "{{seconds}} s": "{{seconds}} s", "{{step}}. Sign with your ETH address": "{{step}}. 用你的以太坊地址签名", - "{{s}} s": "{{s}} s", "{{threshold}}, not passing": "{{threshold}},没有通过", "{{threshold}}, passing": "{{threshold}}, 通过", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}}x投票余额,锁定 {{lock}}x 执行 ({{period}} days)" diff --git a/packages/react-components/src/util/index.ts b/packages/react-components/src/util/index.ts index d50781119c..98f270bc12 100644 --- a/packages/react-components/src/util/index.ts +++ b/packages/react-components/src/util/index.ts @@ -9,6 +9,5 @@ export { default as getAddressName } from './getAddressName'; export { default as getAddressTags } from './getAddressTags'; export { default as getContractAbi } from './getContractAbi'; export { default as isTreasuryProposalVote } from './isTreasuryProposalVote'; -export { default as timeToString } from './timeToString'; export { default as toAddress } from './toAddress'; export { default as toShortAddress } from './toShortAddress'; diff --git a/packages/react-components/src/util/timeToString.ts b/packages/react-components/src/util/timeToString.ts deleted file mode 100644 index 5295dcc582..0000000000 --- a/packages/react-components/src/util/timeToString.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017-2020 @polkadot/react-components authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import { TFunction } from 'i18next'; -import { Time } from '@polkadot/util/types'; - -export default function timeToString (t: TFunction, { days, hours, minutes, seconds }: Time): string { - return [ - days ? (days > 1) ? t('{{days}} days', { replace: { days } }) : t('1 day') : null, - hours ? (hours > 1) ? t('{{hours}} hrs', { replace: { hours } }) : t('1 hr') : null, - minutes ? (minutes > 1) ? t('{{minutes}} mins', { replace: { minutes } }) : t('1 min') : null, - seconds ? (seconds > 1) ? t('{{seconds}} s', { replace: { seconds } }) : t('1 s') : null - ] - .filter((value): value is string => !!value) - .slice(0, 2) - .join(' '); -} diff --git a/packages/react-hooks/src/useBlockTime.ts b/packages/react-hooks/src/useBlockTime.ts index 6044d0d6fb..8c9e29c228 100644 --- a/packages/react-hooks/src/useBlockTime.ts +++ b/packages/react-hooks/src/useBlockTime.ts @@ -4,9 +4,9 @@ import BN from 'bn.js'; import { useMemo } from 'react'; -import { timeToString } from '@polkadot/react-components/util'; import { useApi } from '@polkadot/react-hooks'; import { BN_ONE, extractTime } from '@polkadot/util'; + import { useTranslation } from './translate'; type Result = [number, string]; @@ -25,10 +25,20 @@ export default function useBlockTime (blocks = BN_ONE): Result { api.consts.timestamp?.minimumPeriod.muln(2) || DEFAULT_TIME ); + const { days, hours, minutes, seconds } = extractTime(blockTime.mul(blocks).toNumber()); + const timeStr = [ + days ? (days > 1) ? t('{{days}} days', { replace: { days } }) : t('1 day') : null, + hours ? (hours > 1) ? t('{{hours}} hrs', { replace: { hours } }) : t('1 hr') : null, + minutes ? (minutes > 1) ? t('{{minutes}} mins', { replace: { minutes } }) : t('1 min') : null, + seconds ? (seconds > 1) ? t('{{seconds}} s', { replace: { seconds } }) : t('1 s') : null + ] + .filter((value): value is string => !!value) + .slice(0, 2) + .join(' '); return [ blockTime.toNumber(), - timeToString(t, extractTime(blockTime.mul(blocks).toNumber())) + timeStr ]; }, [api, blocks, t]