fix(i18n): use English runtime text and localize system UI

This commit is contained in:
Arthur Koba
2026-10-25 19:44:15 +03:00
parent ada0550571
commit 65a96670d5
289 changed files with 8092 additions and 3426 deletions
+14 -7
View File
@@ -43,28 +43,35 @@ func Bytes2Size(num int64) string {
return numStr + " " + unit
}
// Seconds2Time converts a number of seconds to a human-readable Chinese duration string.
// Seconds2Time converts a number of seconds to a human-readable English duration string.
func Seconds2Time(num int) (time string) {
if num/secondsPerYear > 0 {
time += strconv.Itoa(num/secondsPerYear) + " 年 "
time += durationPart(num/secondsPerYear, "year") + " "
num %= secondsPerYear
}
if num/secondsPerMonth > 0 {
time += strconv.Itoa(num/secondsPerMonth) + " 个月 "
time += durationPart(num/secondsPerMonth, "month") + " "
num %= secondsPerMonth
}
if num/secondsPerDay > 0 {
time += strconv.Itoa(num/secondsPerDay) + " 天 "
time += durationPart(num/secondsPerDay, "day") + " "
num %= secondsPerDay
}
if num/secondsPerHour > 0 {
time += strconv.Itoa(num/secondsPerHour) + " 小时 "
time += durationPart(num/secondsPerHour, "hour") + " "
num %= secondsPerHour
}
if num/secondsPerMinute > 0 {
time += strconv.Itoa(num/secondsPerMinute) + " 分钟 "
time += durationPart(num/secondsPerMinute, "minute") + " "
num %= secondsPerMinute
}
time += strconv.Itoa(num) + " 秒"
time += durationPart(num, "second")
return
}
func durationPart(value int, unit string) string {
if value != 1 {
unit += "s"
}
return strconv.Itoa(value) + " " + unit
}