From 9ec8fabd3470153c324a7b0f680bc648812a2ac7 Mon Sep 17 00:00:00 2001 From: WhiteEgg Date: Tue, 13 Oct 2020 19:01:16 +0800 Subject: [PATCH] feature: use same system of units use same system of units as hostui fix https://github.com/TRON-US/btfs-webui/issues/16 --- public/locales/ar/status.json | 2 +- public/locales/cs/status.json | 2 +- public/locales/da/status.json | 2 +- public/locales/de/status.json | 2 +- public/locales/en/status.json | 2 +- public/locales/es/status.json | 2 +- public/locales/fr/status.json | 2 +- public/locales/it/status.json | 2 +- public/locales/ja-JP/status.json | 2 +- public/locales/ko-KR/status.json | 2 +- public/locales/nl/status.json | 2 +- public/locales/no/status.json | 2 +- public/locales/pt/status.json | 2 +- public/locales/sk/status.json | 2 +- public/locales/sv/status.json | 2 +- public/locales/zh-CN/status.json | 2 +- public/locales/zh-TW/status.json | 2 +- src/status/StatusConnected.js | 5 ++--- 18 files changed, 19 insertions(+), 20 deletions(-) diff --git a/public/locales/ar/status.json b/public/locales/ar/status.json index a3d6e0ca..467627a2 100644 --- a/public/locales/ar/status.json +++ b/public/locales/ar/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, zero {{percent}% ({count} الأقران)} one {{percent}% ({count} Peer)} two {{percent}% ({count} Peers)} few {{percent}% ({count} Peers)} many {{percent}% ({count} Peers)} other {{percent}% ({count} Peers)}}", "countMore": "و... {count} اكثر", "StatusConnected": { - "paragraph1": "استضافة <0>{repoSize} الملفات ", + "paragraph1": "استضافة <0>{repoSize} GB الملفات ", "paragraph2": "{count, plural, zero {Discovered <0>{peersCount} peers} one {Discovered <0>1 peer} two {Discovered <0>1 peer} few {Discovered <0>1 peer} many {المكتشفة <0>1 الأقران} other {المكتشفة <0>{peersCount} الأقران}}" }, "customApiConfig": "تكوين JSON المخصص", diff --git a/public/locales/cs/status.json b/public/locales/cs/status.json index 55031645..bf0f6675 100644 --- a/public/locales/cs/status.json +++ b/public/locales/cs/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Uzel)} few {{percent}% ({count} Uzlů)} many {{percent}% ({count} Uzlů)} other {{percent}% ({count} Uzlů)}}", "countMore": "... a {count} více", "StatusConnected": { - "paragraph1": "Hosting <0>{repoSize} souborů", + "paragraph1": "Hosting <0>{repoSize} GB souborů", "paragraph2": "{count, plural, one {Objeven <0>1 peer} few {Objeveny <0>{peersCount} peery} many {Objeveno <0>{peersCount} peerů} other {Objeveno <0>{peersCount} uzlů}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/public/locales/da/status.json b/public/locales/da/status.json index ef57c4c2..da230fa9 100644 --- a/public/locales/da/status.json +++ b/public/locales/da/status.json @@ -30,7 +30,7 @@ "revision": "Udgave", "StatusConnected": { "header1": "Forbundet til BTFS", - "paragraph1": "Hoster<0>{repoSize} af filer", + "paragraph1": "Hoster<0>{repoSize} GB af filer", "paragraph2": "{count, plural, one {Fandt<0>1 klient} other {Fandt<0>{peersCount} klienter}}" }, "StatusNotConnected": { diff --git a/public/locales/de/status.json b/public/locales/de/status.json index ff1b324d..27e5249c 100644 --- a/public/locales/de/status.json +++ b/public/locales/de/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Peer)} other {{percent}% ({count} Peers)}}", "countMore": "...und {count} weitere", "StatusConnected": { - "paragraph1": "<0>{repoSize} an Dateien gehostet", + "paragraph1": "<0>{repoSize} GB an Dateien gehostet", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {<0>{peersCount} Peers entdeckt}}" }, "customApiConfig": "Benutzerdefinierte JSON-Konfiguration", diff --git a/public/locales/en/status.json b/public/locales/en/status.json index 064f93a3..98b031bd 100644 --- a/public/locales/en/status.json +++ b/public/locales/en/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Peer)} other {{percent}% ({count} Peers)}}", "countMore": "...and {count} more", "StatusConnected": { - "paragraph1": "Hosting <0>{repoSize} of files", + "paragraph1": "Hosting <0>{repoSize} GB of files", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {Discovered <0>{peersCount} peers}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/public/locales/es/status.json b/public/locales/es/status.json index c2a66af7..9ae76b8e 100644 --- a/public/locales/es/status.json +++ b/public/locales/es/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Peer)} other {{percent}% ({count} Peers)}}", "countMore": "...y {count} más", "StatusConnected": { - "paragraph1": "Hospedaje <0>{repoSize} de archivos", + "paragraph1": "Hospedaje <0>{repoSize} GB de archivos", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {Discovered <0>{peersCount} peers}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/public/locales/fr/status.json b/public/locales/fr/status.json index 9f5b177f..0d737d29 100644 --- a/public/locales/fr/status.json +++ b/public/locales/fr/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Pair)} other {{percent}% ({count} Pairs)}}", "countMore": "...et {count} de plus", "StatusConnected": { - "paragraph1": "<0>{repoSize} de fichiers hébergés", + "paragraph1": "<0>{repoSize} GB de fichiers hébergés", "paragraph2": "{count, plural, one {<0>1 pair découvert} other {<0>{peersCount} pairs découverts}}" }, "customApiConfig": "JSON de configuration personnalisée", diff --git a/public/locales/it/status.json b/public/locales/it/status.json index 62fcfac0..a587aa05 100644 --- a/public/locales/it/status.json +++ b/public/locales/it/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, one {{percent}% ({count} Peer)} other {{percent}% ({count} Peer)}}", "countMore": "... e {count} in più", "StatusConnected": { - "paragraph1": "Ospiti <0>{repoSize} di file", + "paragraph1": "Ospiti <0>{repoSize} GB di file", "paragraph2": "{count, plural, one {Trovato <0>1 Peer} other {Trovati <0>{peersCount} peer}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/public/locales/ja-JP/status.json b/public/locales/ja-JP/status.json index 024ffbe4..79b4bb00 100644 --- a/public/locales/ja-JP/status.json +++ b/public/locales/ja-JP/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, other {{percent}%({count} ピア)}}", "countMore": "ほか{count}項目", "StatusConnected": { - "paragraph1": "<0>{repoSize}個のファイルをホスティング中", + "paragraph1": "<0>{repoSize} GB個のファイルをホスティング中", "paragraph2": "{count, plural, other {<0>{peersCount}個のピアと通信中}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/public/locales/ko-KR/status.json b/public/locales/ko-KR/status.json index 6efbd473..32682f1f 100644 --- a/public/locales/ko-KR/status.json +++ b/public/locales/ko-KR/status.json @@ -30,7 +30,7 @@ "revision": "개정", "StatusConnected": { "header1": "Connected to BTFS", - "paragraph1": "Hosting <0>{repoSize} of files", + "paragraph1": "Hosting <0>{repoSize} GB of files", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {Discovered <0>{peersCount} peers}}" }, "StatusNotConnected": { diff --git a/public/locales/nl/status.json b/public/locales/nl/status.json index 2024a6b8..26fc5be1 100644 --- a/public/locales/nl/status.json +++ b/public/locales/nl/status.json @@ -30,7 +30,7 @@ "revision": "Revisie", "StatusConnected": { "header1": "Verbind met BTFS", - "paragraph1": "Hosting <0>{repoSize} of files", + "paragraph1": "Hosting <0>{repoSize} GB of files", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {Discovered <0>{peersCount} peers}}" }, "StatusNotConnected": { diff --git a/public/locales/no/status.json b/public/locales/no/status.json index ed629e28..9a4b53a6 100644 --- a/public/locales/no/status.json +++ b/public/locales/no/status.json @@ -30,7 +30,7 @@ "revision": "Revisjon", "StatusConnected": { "header1": "Koblet til BTFS", - "paragraph1": "Hoster <0>{repoSize} filer", + "paragraph1": "Hoster <0>{repoSize} GB filer", "paragraph2": "{count, plural, one {Oppdaget <0>1 peer} other {Oppdaget <0>{peersCount} peers}}" }, "StatusNotConnected": { diff --git a/public/locales/pt/status.json b/public/locales/pt/status.json index 1507c237..0979536c 100644 --- a/public/locales/pt/status.json +++ b/public/locales/pt/status.json @@ -30,7 +30,7 @@ "revision": "Revisão", "StatusConnected": { "header1": "Conectado ao BTFS", - "paragraph1": "A hospedar <0>{repoSize}em ficheiros", + "paragraph1": "A hospedar <0>{repoSize} GB em ficheiros", "paragraph2": "{count, plural, one {Encontrado <0>1 par} other {Encontrados <0>{peersCount}pares}}" }, "StatusNotConnected": { diff --git a/public/locales/sk/status.json b/public/locales/sk/status.json index a93d9313..0c651bc7 100644 --- a/public/locales/sk/status.json +++ b/public/locales/sk/status.json @@ -30,7 +30,7 @@ "revision": "Revízia", "StatusConnected": { "header1": "Pripojené k BTFS", - "paragraph1": "Hostuje <0>{repoSize} súborov", + "paragraph1": "Hostuje <0>{repoSize} GB súborov", "paragraph2": "{count, plural, one {Objavený <0>1 uzol} few {Objavených <0>{peersCount} uzlov} many {Objavených <0>{peersCount} uzlov} other {Objavených <0>{peersCount} uzlov}}" }, "StatusNotConnected": { diff --git a/public/locales/sv/status.json b/public/locales/sv/status.json index 55a81751..ebbf257f 100644 --- a/public/locales/sv/status.json +++ b/public/locales/sv/status.json @@ -30,7 +30,7 @@ "revision": "Revision", "StatusConnected": { "header1": "Connected to BTFS", - "paragraph1": "Hosting <0>{repoSize} of files", + "paragraph1": "Hosting <0>{repoSize} GB of files", "paragraph2": "{count, plural, one {Discovered <0>1 peer} other {Discovered <0>{peersCount} peers}}" }, "StatusNotConnected": { diff --git a/public/locales/zh-CN/status.json b/public/locales/zh-CN/status.json index 8ac937d2..df8057e7 100644 --- a/public/locales/zh-CN/status.json +++ b/public/locales/zh-CN/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, other {{percent}% ({count} 节点)}}", "countMore": "...{count} 更多", "StatusConnected": { - "paragraph1": "已托管 <0>{repoSize} 文件", + "paragraph1": "已托管 <0>{repoSize} GB 文件", "paragraph2": "{count, plural, other {已发现 <0>{peersCount} 节点}}" }, "customApiConfig": "自定义JSON配置", diff --git a/public/locales/zh-TW/status.json b/public/locales/zh-TW/status.json index d2079ac6..ef3a9757 100644 --- a/public/locales/zh-TW/status.json +++ b/public/locales/zh-TW/status.json @@ -9,7 +9,7 @@ "pieChartLabel": "{count, plural, other {{percent}% ({count} 節點)}}", "countMore": "...{count} 更多", "StatusConnected": { - "paragraph1": "託管 <0>{repoSize} 文件", + "paragraph1": "託管 <0>{repoSize} GB 文件", "paragraph2": "{count, plural, other {發現 <0>{peersCount} 節點}}" }, "customApiConfig": "Custom JSON configuration", diff --git a/src/status/StatusConnected.js b/src/status/StatusConnected.js index af30372c..706fcb98 100644 --- a/src/status/StatusConnected.js +++ b/src/status/StatusConnected.js @@ -1,10 +1,9 @@ import React from 'react' import { withTranslation, Trans } from 'react-i18next' import { connect } from 'redux-bundler-react' -import filesize from 'filesize' export const StatusConnected = ({ t, peersCount, repoSize }) => { - const humanRepoSize = filesize(repoSize || 0, { round: 1 }) + const humanRepoSize = Math.floor(repoSize/Math.pow(1e3,3)) || 0 return (

@@ -14,7 +13,7 @@ export const StatusConnected = ({ t, peersCount, repoSize }) => { ?]} />