Align time unit strings (#3622)

* Align time unit strings

* Apply suggestions from code review

* dedup

* Rebuild i18n
This commit is contained in:
Jaco Greeff 2020-09-06 11:05:45 +02:00 committed by GitHub
parent 67e5ffbc4b
commit f127e829bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 50 additions and 62 deletions

View File

@ -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 {{قيمة }}"

View File

@ -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"
}

View File

@ -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)": ""

View File

@ -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."

View File

@ -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)"

View File

@ -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)"

View File

@ -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アドレスでサインしてください"
}

View File

@ -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)"

View File

@ -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}} дней)"

View File

@ -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)"

View File

@ -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';

View File

@ -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<string>('{{days}} days', { replace: { days } }) : t<string>('1 day') : null,
hours ? (hours > 1) ? t<string>('{{hours}} hrs', { replace: { hours } }) : t<string>('1 hr') : null,
minutes ? (minutes > 1) ? t<string>('{{minutes}} mins', { replace: { minutes } }) : t<string>('1 min') : null,
seconds ? (seconds > 1) ? t<string>('{{seconds}} s', { replace: { seconds } }) : t<string>('1 s') : null
]
.filter((value): value is string => !!value)
.slice(0, 2)
.join(' ');
}

View File

@ -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<string>('{{days}} days', { replace: { days } }) : t<string>('1 day') : null,
hours ? (hours > 1) ? t<string>('{{hours}} hrs', { replace: { hours } }) : t<string>('1 hr') : null,
minutes ? (minutes > 1) ? t<string>('{{minutes}} mins', { replace: { minutes } }) : t<string>('1 min') : null,
seconds ? (seconds > 1) ? t<string>('{{seconds}} s', { replace: { seconds } }) : t<string>('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]