chore(gui): update HumanDuration.js (#9710)

Relevant changes:

ko: Use correct names for month and hour in Korean (465eaed)
Hide unit count if 2 in Arabic (f90d847)
This commit is contained in:
Ross Smith II 2024-09-15 01:21:18 -07:00 committed by GitHub
parent a156e88eef
commit 1704827d04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,6 +41,7 @@
* @prop {string} [delimiter]
* @prop {DigitReplacements} [_digitReplacements]
* @prop {boolean} [_numberFirst]
* @prop {boolean} [_hideCountIf2]
*/
/**
@ -116,6 +117,7 @@
// minute -> د stands for "دقيقة"
// second -> ث stands for "ثانية"
ar: assign(language("س", "ش", "أ", "ي", "س", "د", "ث", "م ث", ","), {
_hideCountIf2: true,
_digitReplacements: ["۰", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"]
}),
// български (Bulgarian)
@ -177,7 +179,7 @@
// ಕನ್ನಡ (Kannada)
kn: language("ವ", "ತ", "ವ", "ದ", "ಗಂ", "ನಿ", "ಸೆ", "ಮಿಸೆ"),
// 한국어 (Korean)
ko: language("년", "", "주", "일", "시", "분", "초", "밀리초"),
ko: language("년", "", "주", "일", "시", "분", "초", "밀리초"),
// Kurdî (Kurdish)
ku: language("sal", "m", "h", "r", "s", "d", "ç", "ms", ","),
// ລາວ (Lao)
@ -464,19 +466,25 @@
: Math.floor(unitCount * Math.pow(10, maxDecimalPoints)) /
Math.pow(10, maxDecimalPoints);
var countStr = normalizedUnitCount.toString();
if (digitReplacements) {
if (language._hideCountIf2 && unitCount === 2) {
formattedCount = "";
for (var i = 0; i < countStr.length; i++) {
var char = countStr[i];
if (char === ".") {
formattedCount += decimal;
} else {
// @ts-ignore because `char` should always be 0-9 at this point.
formattedCount += digitReplacements[char];
}
}
spacer = "";
} else {
formattedCount = countStr.replace(".", decimal);
if (digitReplacements) {
formattedCount = "";
for (var i = 0; i < countStr.length; i++) {
var char = countStr[i];
if (char === ".") {
formattedCount += decimal;
} else {
// @ts-ignore because `char` should always be 0-9 at this point.
formattedCount += digitReplacements[char];
}
}
} else {
formattedCount = countStr.replace(".", decimal);
}
}
var languageWord = language[unitName];