@quenty/clienttranslator 9.2.0 → 9.2.1-canary.434.f7d11a1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +11 -11
- package/src/Client/NumberLocalizationUtils.lua +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.2.1-canary.434.f7d11a1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/clienttranslator@9.2.0...@quenty/clienttranslator@9.2.1-canary.434.f7d11a1.0) (2023-12-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Number localization trims properly to the desired number of decimals instead of just 1 ([05fe6a4](https://github.com/Quenty/NevermoreEngine/commit/05fe6a442d6a2dbece358ed73fedacfaa837b488))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [9.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/clienttranslator@9.1.1...@quenty/clienttranslator@9.2.0) (2023-12-14)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/clienttranslator",
|
|
3
|
-
"version": "9.2.0",
|
|
3
|
+
"version": "9.2.1-canary.434.f7d11a1.0",
|
|
4
4
|
"description": "Gets local translator for player",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/blend": "
|
|
29
|
-
"@quenty/instanceutils": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/maid": "
|
|
32
|
-
"@quenty/promise": "
|
|
33
|
-
"@quenty/pseudolocalize": "
|
|
34
|
-
"@quenty/rx": "
|
|
35
|
-
"@quenty/string": "
|
|
36
|
-
"@quenty/table": "
|
|
28
|
+
"@quenty/blend": "7.2.1-canary.434.f7d11a1.0",
|
|
29
|
+
"@quenty/instanceutils": "8.2.1-canary.434.f7d11a1.0",
|
|
30
|
+
"@quenty/loader": "7.1.0",
|
|
31
|
+
"@quenty/maid": "2.6.0",
|
|
32
|
+
"@quenty/promise": "7.1.0",
|
|
33
|
+
"@quenty/pseudolocalize": "3.2.0",
|
|
34
|
+
"@quenty/rx": "8.2.1-canary.434.f7d11a1.0",
|
|
35
|
+
"@quenty/string": "3.1.0",
|
|
36
|
+
"@quenty/table": "3.4.0"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f7d11a1c05ad6a8c7151952a2b5b89e93bbb5540"
|
|
42
42
|
}
|
|
@@ -307,17 +307,21 @@ function NumberLocalizationUtils.abbreviate(number, locale, roundingBehaviourTyp
|
|
|
307
307
|
-- Round to required significant digits
|
|
308
308
|
local significantQuotient = roundToSignificantDigits(number / baseValue, numSignificantDigits, roundingBehaviourType)
|
|
309
309
|
|
|
310
|
-
-- trim
|
|
310
|
+
-- trim decimal points
|
|
311
|
+
local trimmedQuotientString
|
|
312
|
+
local symbolsAboveDecimal = math.ceil(math.log10(significantQuotient))
|
|
313
|
+
local maxDecimals = math.max(1, numSignificantDigits - symbolsAboveDecimal)
|
|
311
314
|
local trimmedQuotient
|
|
315
|
+
local roundingFactor = 10^maxDecimals
|
|
312
316
|
if roundingBehaviourType == RoundingBehaviourTypes.TRUNCATE then
|
|
313
|
-
trimmedQuotient = math.modf(significantQuotient *
|
|
317
|
+
trimmedQuotient = math.modf(significantQuotient * roundingFactor) / roundingFactor
|
|
314
318
|
elseif roundingBehaviourType == RoundingBehaviourTypes.ROUND_TO_CLOSEST then
|
|
315
|
-
trimmedQuotient = math.floor(significantQuotient *
|
|
319
|
+
trimmedQuotient = math.floor(significantQuotient * roundingFactor + 0.5) / roundingFactor
|
|
316
320
|
else
|
|
317
321
|
error(string.format("[NumberLocalizationUtils.abbreviate] - Unknown roundingBehaviourType %q", tostring(roundingBehaviourType)))
|
|
318
322
|
end
|
|
319
323
|
|
|
320
|
-
|
|
324
|
+
trimmedQuotientString = tostring(trimmedQuotient)
|
|
321
325
|
|
|
322
326
|
-- Split the string into integer and fraction parts
|
|
323
327
|
local decimalPointIndex = findDecimalPointIndex(trimmedQuotientString)
|