WindowTitle: fix speed update and remove from translation

This commit is contained in:
Jesse Chan
2020-10-27 13:02:19 +08:00
parent b2a37146ec
commit 067057cb2f
3 changed files with 25 additions and 59 deletions
@@ -9,47 +9,36 @@ const WindowTitle: React.FC = () => {
const {transferSummary: summary} = TransferDataStore;
const intl = useIntl();
React.useEffect(() => {
let title = 'Flood';
let title = 'Flood';
if (summary != null && Object.keys(summary).length > 0) {
const down = compute(summary.downRate);
const up = compute(summary.upRate);
if (summary != null && Object.keys(summary).length > 0) {
const down = compute(summary.downRate);
const up = compute(summary.upRate);
const formattedDownSpeed = intl.formatNumber(down.value);
const formattedUpSpeed = intl.formatNumber(up.value);
const formattedDownSpeed = intl.formatNumber(down.value);
const formattedUpSpeed = intl.formatNumber(up.value);
const translatedDownUnit = intl.formatMessage(
{
id: 'unit.speed',
},
{
baseUnit: intl.formatMessage({id: getTranslationString(down.unit)}),
},
);
const translatedUpUnit = intl.formatMessage(
{
id: 'unit.speed',
},
{
baseUnit: intl.formatMessage({id: getTranslationString(up.unit)}),
},
);
const translatedDownUnit = intl.formatMessage(
{
id: 'unit.speed',
},
{
baseUnit: intl.formatMessage({id: getTranslationString(down.unit)}),
},
);
const translatedUpUnit = intl.formatMessage(
{
id: 'unit.speed',
},
{
baseUnit: intl.formatMessage({id: getTranslationString(up.unit)}),
},
);
title = intl.formatMessage(
{
id: 'window.title',
// \u2193 and \u2191 are down and up arrows, respectively
},
{
down: `${formattedDownSpeed} ${translatedDownUnit}`,
up: `${formattedUpSpeed} ${translatedUpUnit}`,
},
);
}
title = `${formattedDownSpeed} ${translatedDownUnit}${formattedUpSpeed} ${translatedUpUnit} - Flood`;
}
document.title = title;
}, [intl, summary]);
document.title = title;
return null;
};
@@ -2498,27 +2498,5 @@
"type": 0,
"value": "yr"
}
],
"window.title": [
{
"type": 0,
"value": "↓ "
},
{
"type": 1,
"value": "down"
},
{
"type": 0,
"value": " ↑ "
},
{
"type": 1,
"value": "up"
},
{
"type": 0,
"value": " - Flood"
}
]
}
-1
View File
@@ -352,7 +352,6 @@
"status.diskusage.total": "Total",
"locale.language.auto": "Automatic",
"locale.language.translate": "Start to translate",
"window.title": "↓ {down} ↑ {up} - Flood",
"dependency.loading.notifications": "Notifications",
"dependency.loading.torrent.taxonomy": "Torrent Taxonomy",
"dependency.loading.transfer.rate.details": "Data Transfer Rate Details",