@quenty/clienttranslator 14.18.2 → 14.19.0-canary.544.de8fcee.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
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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
|
-
|
|
6
|
+
# [14.19.0-canary.544.de8fcee.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/clienttranslator@14.18.1...@quenty/clienttranslator@14.19.0-canary.544.de8fcee.0) (2025-04-01)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix existing tests ([655787c](https://github.com/Quenty/NevermoreEngine/commit/655787ced1139136e12f81800e229aa076731561))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/clienttranslator",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.19.0-canary.544.de8fcee.0",
|
|
4
4
|
"description": "Gets local translator for player",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,20 +25,20 @@
|
|
|
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/promisemaid": "
|
|
34
|
-
"@quenty/pseudolocalize": "
|
|
35
|
-
"@quenty/rx": "
|
|
36
|
-
"@quenty/string": "
|
|
37
|
-
"@quenty/table": "
|
|
38
|
-
"@quenty/valueobject": "
|
|
28
|
+
"@quenty/blend": "12.18.0-canary.544.de8fcee.0",
|
|
29
|
+
"@quenty/instanceutils": "13.17.0-canary.544.de8fcee.0",
|
|
30
|
+
"@quenty/loader": "10.8.0",
|
|
31
|
+
"@quenty/maid": "3.4.0",
|
|
32
|
+
"@quenty/promise": "10.10.1",
|
|
33
|
+
"@quenty/promisemaid": "5.10.1",
|
|
34
|
+
"@quenty/pseudolocalize": "3.4.0",
|
|
35
|
+
"@quenty/rx": "13.17.0-canary.544.de8fcee.0",
|
|
36
|
+
"@quenty/string": "3.3.1",
|
|
37
|
+
"@quenty/table": "3.7.1",
|
|
38
|
+
"@quenty/valueobject": "13.17.0-canary.544.de8fcee.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "de8fcee995fcdae464964357b4c770c03f4c7e03"
|
|
44
44
|
}
|
|
@@ -1,110 +1,112 @@
|
|
|
1
|
-
local require = require(
|
|
1
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
2
2
|
|
|
3
|
+
local Jest = require("Jest")
|
|
3
4
|
local NumberLocalizationUtils = require("NumberLocalizationUtils")
|
|
4
5
|
local RoundingBehaviourTypes = require("RoundingBehaviourTypes")
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
local describe = Jest.Globals.describe
|
|
8
|
+
local expect = Jest.Globals.expect
|
|
9
|
+
local it = Jest.Globals.it
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
11
|
+
local function checkLocale(locale, responseMapping)
|
|
12
|
+
for input, output in pairs(responseMapping) do
|
|
13
|
+
expect(NumberLocalizationUtils.localize(input, locale)).toBe(output)
|
|
12
14
|
end
|
|
15
|
+
end
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
local function checkValid_en_zh(locale)
|
|
18
|
+
checkLocale(locale, {
|
|
19
|
+
[0] = "0",
|
|
20
|
+
[1] = "1",
|
|
21
|
+
[25] = "25",
|
|
22
|
+
[364] = "364",
|
|
23
|
+
[4120] = "4,120",
|
|
24
|
+
[57860] = "57,860",
|
|
25
|
+
[624390] = "624,390",
|
|
26
|
+
[7857000] = "7,857,000",
|
|
27
|
+
[-12345678] = "-12,345,678",
|
|
28
|
+
[23987.45678] = "23,987.45678",
|
|
29
|
+
[-12.3456] = "-12.3456",
|
|
30
|
+
[-23987.45678] = "-23,987.45678",
|
|
31
|
+
})
|
|
32
|
+
end
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
describe("NumberLocalizationUtils.localize", function()
|
|
35
|
+
-- it("should default to en-us when locale is not recognized", function()
|
|
36
|
+
-- local logs = Logging.capture(function()
|
|
37
|
+
-- checkValid_en_zh("bad_locale")
|
|
38
|
+
-- end)
|
|
39
|
+
-- expect(string.match(logs.warnings[1], "^Warning: Locale not found:") ~= nil).toBe(true)
|
|
40
|
+
-- end)
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
-- it("should default to en-us when locale is nil", function()
|
|
43
|
+
-- local logs = Logging.capture(function()
|
|
44
|
+
-- checkValid_en_zh(nil)
|
|
45
|
+
-- end)
|
|
46
|
+
-- expect(string.match(logs.warnings[1], "^Warning: Locale not found:") ~= nil).toBe(true)
|
|
47
|
+
-- end)
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
-- it("should default to en-us when locale is empty", function()
|
|
50
|
+
-- local logs = Logging.capture(function()
|
|
51
|
+
-- checkValid_en_zh("")
|
|
52
|
+
-- end)
|
|
53
|
+
-- expect(string.match(logs.warnings[1], "^Warning: Locale not found:") ~= nil).toBe(true)
|
|
54
|
+
-- end)
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
it("should localize correctly. (en-us)", function()
|
|
57
|
+
checkValid_en_zh("en-us")
|
|
58
|
+
end)
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
it("should localize correctly. (en-gb)", function()
|
|
61
|
+
checkValid_en_zh("en-gb")
|
|
62
|
+
end)
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
it("should localize correctly. (zh-cn)", function()
|
|
65
|
+
checkValid_en_zh("zh-cn")
|
|
66
|
+
end)
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
end)
|
|
68
|
+
it("should localize correctly. (zh-tw)", function()
|
|
69
|
+
checkValid_en_zh("zh-tw")
|
|
68
70
|
end)
|
|
71
|
+
end)
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
73
|
+
describe("NumberLocalizationUtils.abbreviate", function()
|
|
74
|
+
it("should round towards zero when using RoundingBehaviourTypes.Truncate", function()
|
|
75
|
+
local roundToZeroMap = {
|
|
76
|
+
[0] = "0",
|
|
77
|
+
[1] = "1",
|
|
78
|
+
[25] = "25",
|
|
79
|
+
[364] = "364",
|
|
80
|
+
[4120] = "4.1K",
|
|
81
|
+
[57860] = "57.8K",
|
|
82
|
+
[624390] = "624K",
|
|
83
|
+
[999999] = "999K",
|
|
84
|
+
[7857000] = "7.8M",
|
|
85
|
+
[8e7] = "80M",
|
|
86
|
+
[9e8] = "900M",
|
|
87
|
+
[1e9] = "1B",
|
|
88
|
+
[1e12] = "1,000B",
|
|
89
|
+
[-0] = "0",
|
|
90
|
+
[-1] = "-1",
|
|
91
|
+
[-25] = "-25",
|
|
92
|
+
[-364] = "-364",
|
|
93
|
+
[-4120] = "-4.1K",
|
|
94
|
+
[-57860] = "-57.8K",
|
|
95
|
+
[-624390] = "-624K",
|
|
96
|
+
[-999999] = "-999K",
|
|
97
|
+
[-7857000] = "-7.8M",
|
|
98
|
+
[-8e7] = "-80M",
|
|
99
|
+
[-9e8] = "-900M",
|
|
100
|
+
[-1e9] = "-1B",
|
|
101
|
+
[-1e12] = "-1,000B",
|
|
102
|
+
[1.1] = "1.1",
|
|
103
|
+
[1499.99] = "1.4K",
|
|
104
|
+
[-1.1] = "-1.1",
|
|
105
|
+
[-1499.99] = "-1.4K",
|
|
106
|
+
}
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
end)
|
|
108
|
+
for input, output in pairs(roundToZeroMap) do
|
|
109
|
+
expect(NumberLocalizationUtils.abbreviate(input, "en-us", RoundingBehaviourTypes.TRUNCATE)).toBe(output)
|
|
110
|
+
end
|
|
109
111
|
end)
|
|
110
|
-
end
|
|
112
|
+
end)
|