mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 08:17:59 +00:00
Utils: simplify for translations
This commit is contained in:
parent
c20a0ef928
commit
527adcba17
1 changed files with 8 additions and 30 deletions
38
js/Utils.js
38
js/Utils.js
|
@ -55,36 +55,14 @@ function ago(epoch) {
|
|||
var now = new Date().getTime() / 1000;
|
||||
var delta = now - epoch;
|
||||
|
||||
if(delta < 60) {
|
||||
if (delta <= 1) {
|
||||
return 1 + " " + qsTr("second ago")
|
||||
} else {
|
||||
return Math.floor(delta) + " " + qsTr("seconds ago")
|
||||
}
|
||||
} else if (delta >= 60 && delta <= 3600) {
|
||||
if(delta >= 60 && delta < 120){
|
||||
return 1 + " " + qsTr("minute ago")
|
||||
} else {
|
||||
return parseInt(Math.floor(delta / 60)) + " " + qsTr("minutes ago")
|
||||
}
|
||||
} else if (delta >= 3600 && delta <= 86400) {
|
||||
if(delta >= 3600 && delta < 7200) {
|
||||
return 1 + " " + qsTr("hour ago")
|
||||
} else {
|
||||
return parseInt(Math.floor(delta / 60 / 60)) + " " + qsTr("hours ago")
|
||||
}
|
||||
} else if (delta >= 86400){
|
||||
if(delta >= 86400 && delta < 172800) {
|
||||
return 1 + " " + qsTr("day ago")
|
||||
} else {
|
||||
var _delta = parseInt(Math.floor(delta / 24 / 60 / 60));
|
||||
if(_delta === 1) {
|
||||
return 1 + " " + qsTr("day ago")
|
||||
} else {
|
||||
return _delta + " " + qsTr("days ago")
|
||||
}
|
||||
}
|
||||
}
|
||||
if(delta < 60)
|
||||
return qsTr("%n second(s) ago", "0", Math.floor(delta))
|
||||
else if (delta >= 60 && delta <= 3600)
|
||||
return qsTr("%n minute(s) ago", "0", Math.floor(delta / 60))
|
||||
else if (delta >= 3600 && delta <= 86400)
|
||||
return qsTr("%n hour(s) ago", "0", Math.floor(delta / 60 / 60))
|
||||
else if (delta >= 86400)
|
||||
return qsTr("%n day(s) ago", "0", Math.floor(delta / 24 / 60 / 60))
|
||||
}
|
||||
|
||||
function netTypeToString(){
|
||||
|
|
Loading…
Reference in a new issue