@formatjs/intl-getcanonicallocales 1.9.2 → 2.0.3
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/BUILD +116 -0
- package/CHANGELOG.md +290 -0
- package/LICENSE.md +0 -0
- package/README.md +0 -0
- package/index.ts +43 -0
- package/package.json +3 -3
- package/polyfill.ts +23 -0
- package/scripts/aliases.ts +70 -0
- package/scripts/likely-subtags.ts +20 -0
- package/should-polyfill.ts +10 -0
- package/src/aliases.generated.ts +1137 -0
- package/src/canonicalizer.ts +272 -0
- package/src/emitter.ts +39 -0
- package/src/likelySubtags.generated.ts +1870 -0
- package/src/parser.ts +259 -0
- package/src/types.ts +63 -0
- package/tests/index.test.ts +24 -0
- package/tests/parser.test.ts +204 -0
- package/tsconfig.json +5 -0
- package/index.d.ts +0 -6
- package/index.d.ts.map +0 -1
- package/index.js +0 -42
- package/lib/index.d.ts +0 -6
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -31
- package/lib/polyfill.d.ts +0 -2
- package/lib/polyfill.d.ts.map +0 -1
- package/lib/polyfill.js +0 -24
- package/lib/should-polyfill.d.ts +0 -2
- package/lib/should-polyfill.d.ts.map +0 -1
- package/lib/should-polyfill.js +0 -8
- package/lib/src/aliases.generated.d.ts +0 -5
- package/lib/src/aliases.generated.d.ts.map +0 -1
- package/lib/src/aliases.generated.js +0 -1137
- package/lib/src/canonicalizer.d.ts +0 -20
- package/lib/src/canonicalizer.d.ts.map +0 -1
- package/lib/src/canonicalizer.js +0 -219
- package/lib/src/emitter.d.ts +0 -4
- package/lib/src/emitter.d.ts.map +0 -1
- package/lib/src/emitter.js +0 -28
- package/lib/src/likelySubtags.generated.d.ts +0 -2
- package/lib/src/likelySubtags.generated.d.ts.map +0 -1
- package/lib/src/likelySubtags.generated.js +0 -1870
- package/lib/src/parser.d.ts +0 -10
- package/lib/src/parser.d.ts.map +0 -1
- package/lib/src/parser.js +0 -233
- package/lib/src/types.d.ts +0 -33
- package/lib/src/types.d.ts.map +0 -1
- package/lib/src/types.js +0 -1
- package/polyfill.d.ts +0 -2
- package/polyfill.d.ts.map +0 -1
- package/polyfill.iife.js +0 -3526
- package/polyfill.js +0 -26
- package/should-polyfill.d.ts +0 -2
- package/should-polyfill.d.ts.map +0 -1
- package/should-polyfill.js +0 -12
- package/src/aliases.generated.d.ts +0 -5
- package/src/aliases.generated.d.ts.map +0 -1
- package/src/aliases.generated.js +0 -1140
- package/src/canonicalizer.d.ts +0 -20
- package/src/canonicalizer.d.ts.map +0 -1
- package/src/canonicalizer.js +0 -224
- package/src/emitter.d.ts +0 -4
- package/src/emitter.d.ts.map +0 -1
- package/src/emitter.js +0 -33
- package/src/likelySubtags.generated.d.ts +0 -2
- package/src/likelySubtags.generated.d.ts.map +0 -1
- package/src/likelySubtags.generated.js +0 -1873
- package/src/parser.d.ts +0 -10
- package/src/parser.d.ts.map +0 -1
- package/src/parser.js +0 -243
- package/src/types.d.ts +0 -33
- package/src/types.d.ts.map +0 -1
- package/src/types.js +0 -2
package/BUILD
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
|
2
|
+
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
|
|
3
|
+
load("@aspect_rules_js//npm/private:npm_package.bzl", "npm_package")
|
|
4
|
+
load("//tools:index.bzl", "bundle_karma_tests", "check_format", "generate_src_file", "package_json_test", "ts_compile")
|
|
5
|
+
load("//tools:jest.bzl", "jest_test")
|
|
6
|
+
|
|
7
|
+
exports_files([
|
|
8
|
+
"package.json",
|
|
9
|
+
"tsconfig.json",
|
|
10
|
+
])
|
|
11
|
+
|
|
12
|
+
PACKAGE_NAME = "intl-getcanonicallocales"
|
|
13
|
+
|
|
14
|
+
npm_package(
|
|
15
|
+
name = PACKAGE_NAME,
|
|
16
|
+
srcs = [
|
|
17
|
+
"LICENSE.md",
|
|
18
|
+
"README.md",
|
|
19
|
+
"package.json",
|
|
20
|
+
":dist",
|
|
21
|
+
# polyfill-library uses this
|
|
22
|
+
"polyfill.iife.js",
|
|
23
|
+
],
|
|
24
|
+
package = "@formatjs/%s" % PACKAGE_NAME,
|
|
25
|
+
visibility = ["//visibility:public"],
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
SRCS = glob([
|
|
29
|
+
"src/**/*.ts",
|
|
30
|
+
"*.ts",
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
TESTS = glob([
|
|
34
|
+
"tests/*.test.ts",
|
|
35
|
+
])
|
|
36
|
+
|
|
37
|
+
SRC_DEPS = [
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
TEST_DEPS = SRC_DEPS
|
|
41
|
+
|
|
42
|
+
ts_compile(
|
|
43
|
+
name = "dist",
|
|
44
|
+
srcs = SRCS,
|
|
45
|
+
package = "@formatjs/%s" % PACKAGE_NAME,
|
|
46
|
+
skip_esm = False,
|
|
47
|
+
deps = SRC_DEPS,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
jest_test(
|
|
51
|
+
name = "unit",
|
|
52
|
+
srcs = SRCS + TESTS,
|
|
53
|
+
deps = TEST_DEPS,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# aliases
|
|
57
|
+
generate_src_file(
|
|
58
|
+
name = "aliases",
|
|
59
|
+
src = "src/aliases.generated.ts",
|
|
60
|
+
data = [
|
|
61
|
+
"//:node_modules/cldr-core",
|
|
62
|
+
],
|
|
63
|
+
entry_point = "scripts/aliases.ts",
|
|
64
|
+
visibility = ["//:__pkg__"],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
generate_src_file(
|
|
68
|
+
name = "likelySubtags",
|
|
69
|
+
src = "src/likelySubtags.generated.ts",
|
|
70
|
+
data = [
|
|
71
|
+
"//:node_modules/cldr-core",
|
|
72
|
+
],
|
|
73
|
+
entry_point = "scripts/likely-subtags.ts",
|
|
74
|
+
visibility = ["//:__pkg__"],
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# karma tests
|
|
78
|
+
bundle_karma_tests(
|
|
79
|
+
name = "bundled-karma-tests",
|
|
80
|
+
srcs = SRCS,
|
|
81
|
+
tests = TESTS,
|
|
82
|
+
deps = TEST_DEPS,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
write_source_files(
|
|
86
|
+
name = "tsconfig_json",
|
|
87
|
+
files = {"tsconfig.json": "//tools:tsconfig.golden.json"},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
esbuild(
|
|
91
|
+
name = "polyfill.iife",
|
|
92
|
+
entry_point = "lib/polyfill.js",
|
|
93
|
+
target = "es6",
|
|
94
|
+
deps = [
|
|
95
|
+
":dist-esm",
|
|
96
|
+
"//:node_modules/tslib",
|
|
97
|
+
] + SRC_DEPS,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
check_format(
|
|
101
|
+
name = "prettier",
|
|
102
|
+
srcs = glob(
|
|
103
|
+
[
|
|
104
|
+
"**/*",
|
|
105
|
+
],
|
|
106
|
+
exclude = [
|
|
107
|
+
"CHANGELOG.md",
|
|
108
|
+
"**/*.generated.*",
|
|
109
|
+
],
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
package_json_test(
|
|
114
|
+
name = "package_json_test",
|
|
115
|
+
deps = SRC_DEPS,
|
|
116
|
+
)
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [2.0.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@2.0.2...@formatjs/intl-getcanonicallocales@2.0.3) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
9
|
+
|
|
10
|
+
## [2.0.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@2.0.1...@formatjs/intl-getcanonicallocales@2.0.2) (2022-06-06)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
13
|
+
|
|
14
|
+
## [2.0.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@2.0.0...@formatjs/intl-getcanonicallocales@2.0.1) (2022-05-19)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
17
|
+
|
|
18
|
+
# [2.0.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.9.2...@formatjs/intl-getcanonicallocales@2.0.0) (2022-05-19)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **react-intl:** fix type issue with react18, fix [#3550](https://github.com/formatjs/formatjs/issues/3550) ([2567b93](https://github.com/formatjs/formatjs/commit/2567b932c5d18b097a43842563046c20ce0c49f1))
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **@formatjs/cli:** package CLI into a single file ([1760787](https://github.com/formatjs/formatjs/commit/176078792894d18b0af72ce1f413f25835f7eb44)), closes [#3547](https://github.com/formatjs/formatjs/issues/3547)
|
|
27
|
+
|
|
28
|
+
### BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
* **@formatjs/cli:** we push @vue/compiler-core out to `peerDependencies` so if u use vue u should pull this in manuallywip on packaging cli.
|
|
31
|
+
|
|
32
|
+
## [1.9.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.9.1...@formatjs/intl-getcanonicallocales@1.9.2) (2022-03-26)
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **@formatjs/intl-getcanonicallocales:** rm @types/node dep, fix [#3474](https://github.com/formatjs/formatjs/issues/3474) ([587e0f1](https://github.com/formatjs/formatjs/commit/587e0f1a5563a9ba0effceb2801fb11e0061be11))
|
|
37
|
+
|
|
38
|
+
## [1.9.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.9.0...@formatjs/intl-getcanonicallocales@1.9.1) (2022-03-13)
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* **@formatjs/intl-getcanonicallocales:** add peerDependenciesMeta field ([#3415](https://github.com/formatjs/formatjs/issues/3415)) ([d5a7b90](https://github.com/formatjs/formatjs/commit/d5a7b900f806f0ca51007ca86a13a42918db3a1c))
|
|
43
|
+
|
|
44
|
+
# [1.9.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.8.0...@formatjs/intl-getcanonicallocales@1.9.0) (2022-01-09)
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* **@formatjs/intl-getcanonicallocales:** upgrade cldr to v40 ([70f61fc](https://github.com/formatjs/formatjs/commit/70f61fcf5e64b4aa6a34eeae7bdb8af05527ef34))
|
|
49
|
+
|
|
50
|
+
# [1.8.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.7.3...@formatjs/intl-getcanonicallocales@1.8.0) (2021-10-22)
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **@formatjs/intl-getcanonicallocales:** upgrade to TS 4.4 ([8b9b381](https://github.com/formatjs/formatjs/commit/8b9b38121f42d35edb189d94fef4a4f03da0871a))
|
|
55
|
+
|
|
56
|
+
## [1.7.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.7.2...@formatjs/intl-getcanonicallocales@1.7.3) (2021-08-15)
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
59
|
+
|
|
60
|
+
## [1.7.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.7.1...@formatjs/intl-getcanonicallocales@1.7.2) (2021-08-06)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
63
|
+
|
|
64
|
+
## [1.7.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.7.0...@formatjs/intl-getcanonicallocales@1.7.1) (2021-06-26)
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* **@formatjs/intl-getcanonicallocales:** rm json import to be more ESM-friendly, fix [#2961](https://github.com/formatjs/formatjs/issues/2961) ([9d491e2](https://github.com/formatjs/formatjs/commit/9d491e2b0ac4ae50cda39a0c59b991c9c663d565))
|
|
69
|
+
|
|
70
|
+
# [1.7.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.6.0...@formatjs/intl-getcanonicallocales@1.7.0) (2021-05-20)
|
|
71
|
+
|
|
72
|
+
### Features
|
|
73
|
+
|
|
74
|
+
* **@formatjs/ecma-376:** new package that generate ecma-376 numFmt pattern ([2a57d16](https://github.com/formatjs/formatjs/commit/2a57d1676f8fc840915b2750a5469934dfd765e8)), closes [#2885](https://github.com/formatjs/formatjs/issues/2885)
|
|
75
|
+
|
|
76
|
+
# [1.6.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.11...@formatjs/intl-getcanonicallocales@1.6.0) (2021-05-17)
|
|
77
|
+
|
|
78
|
+
### Features
|
|
79
|
+
|
|
80
|
+
* **@formatjs/intl-getcanonicallocales:** upgrade unicode to v39 ([ee3a069](https://github.com/formatjs/formatjs/commit/ee3a0694bb9e5418cbd04664016b47fc5b0e079c))
|
|
81
|
+
|
|
82
|
+
## [1.5.11](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.10...@formatjs/intl-getcanonicallocales@1.5.11) (2021-05-14)
|
|
83
|
+
|
|
84
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
85
|
+
|
|
86
|
+
## [1.5.10](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.9...@formatjs/intl-getcanonicallocales@1.5.10) (2021-05-10)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
89
|
+
|
|
90
|
+
## [1.5.9](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.8...@formatjs/intl-getcanonicallocales@1.5.9) (2021-04-12)
|
|
91
|
+
|
|
92
|
+
### Bug Fixes
|
|
93
|
+
|
|
94
|
+
* **@formatjs/intl-getcanonicallocales:** check for chunks length before regex, [#2813](https://github.com/formatjs/formatjs/issues/2813) ([89b40b9](https://github.com/formatjs/formatjs/commit/89b40b9aa0c9c2a64ab14a596404d91bf93d6cac))
|
|
95
|
+
|
|
96
|
+
## [1.5.8](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.7...@formatjs/intl-getcanonicallocales@1.5.8) (2021-03-26)
|
|
97
|
+
|
|
98
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
99
|
+
|
|
100
|
+
## [1.5.7](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.6...@formatjs/intl-getcanonicallocales@1.5.7) (2021-03-15)
|
|
101
|
+
|
|
102
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
103
|
+
|
|
104
|
+
## [1.5.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.5...@formatjs/intl-getcanonicallocales@1.5.6) (2021-03-01)
|
|
105
|
+
|
|
106
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
107
|
+
|
|
108
|
+
## [1.5.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.4...@formatjs/intl-getcanonicallocales@1.5.5) (2021-02-25)
|
|
109
|
+
|
|
110
|
+
### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* bump tslib version dep ([37577d2](https://github.com/formatjs/formatjs/commit/37577d22bf28d23de1d8013ba0047cf221ad8840)), closes [#2645](https://github.com/formatjs/formatjs/issues/2645)
|
|
113
|
+
|
|
114
|
+
## [1.5.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.3...@formatjs/intl-getcanonicallocales@1.5.4) (2021-02-25)
|
|
115
|
+
|
|
116
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
117
|
+
|
|
118
|
+
## [1.5.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.2...@formatjs/intl-getcanonicallocales@1.5.3) (2020-12-16)
|
|
119
|
+
|
|
120
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
121
|
+
|
|
122
|
+
## [1.5.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.1...@formatjs/intl-getcanonicallocales@1.5.2) (2020-11-26)
|
|
123
|
+
|
|
124
|
+
### Bug Fixes
|
|
125
|
+
|
|
126
|
+
* **@formatjs/intl-getcanonicallocales:** fix import path for polyfills ([#2348](https://github.com/formatjs/formatjs/issues/2348)) ([c704cf5](https://github.com/formatjs/formatjs/commit/c704cf5561c659ab1552c1c0efd76616c822da6f))
|
|
127
|
+
|
|
128
|
+
## [1.5.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.5.0...@formatjs/intl-getcanonicallocales@1.5.1) (2020-10-26)
|
|
129
|
+
|
|
130
|
+
### Bug Fixes
|
|
131
|
+
|
|
132
|
+
* **@formatjs/intl-getcanonicallocales:** fix UMD bundle ([c0362f5](https://github.com/formatjs/formatjs/commit/c0362f5243e663d1ac4efb011e8b4919d9dec1c1))
|
|
133
|
+
|
|
134
|
+
# [1.5.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.6...@formatjs/intl-getcanonicallocales@1.5.0) (2020-10-25)
|
|
135
|
+
|
|
136
|
+
### Features
|
|
137
|
+
|
|
138
|
+
* **@formatjs/intl-getcanonicallocales:** upgrade cldr to v37 ([53540af](https://github.com/formatjs/formatjs/commit/53540af06ef06e639443223170adf4cab7e308e0))
|
|
139
|
+
|
|
140
|
+
## [1.4.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.5...@formatjs/intl-getcanonicallocales@1.4.6) (2020-10-01)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
143
|
+
|
|
144
|
+
## [1.4.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.4...@formatjs/intl-getcanonicallocales@1.4.5) (2020-09-18)
|
|
145
|
+
|
|
146
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
147
|
+
|
|
148
|
+
## [1.4.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.3...@formatjs/intl-getcanonicallocales@1.4.4) (2020-09-09)
|
|
149
|
+
|
|
150
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
151
|
+
|
|
152
|
+
## [1.4.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.2...@formatjs/intl-getcanonicallocales@1.4.3) (2020-08-25)
|
|
153
|
+
|
|
154
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
155
|
+
|
|
156
|
+
## [1.4.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.1...@formatjs/intl-getcanonicallocales@1.4.2) (2020-08-21)
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
* add back polyfill.umd, fix [#2013](https://github.com/formatjs/formatjs/issues/2013) ([b9cfbd2](https://github.com/formatjs/formatjs/commit/b9cfbd2eeead6a5165b0e4cbf1ef3edbfbeca8ce))
|
|
161
|
+
|
|
162
|
+
## [1.4.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.4.0...@formatjs/intl-getcanonicallocales@1.4.1) (2020-08-19)
|
|
163
|
+
|
|
164
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
165
|
+
|
|
166
|
+
# [1.4.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.3.2...@formatjs/intl-getcanonicallocales@1.4.0) (2020-08-18)
|
|
167
|
+
|
|
168
|
+
### Features
|
|
169
|
+
|
|
170
|
+
* **@formatjs/intl-getcanonicallocales:** expose shouldPolyfill to detect if platform needs our polyfill ([ba0aac6](https://github.com/formatjs/formatjs/commit/ba0aac6dda7053a5b4ffb8f6502dd8c1688cbc8f))
|
|
171
|
+
|
|
172
|
+
## [1.3.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.3.1...@formatjs/intl-getcanonicallocales@1.3.2) (2020-08-14)
|
|
173
|
+
|
|
174
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
175
|
+
|
|
176
|
+
## [1.3.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.3.0...@formatjs/intl-getcanonicallocales@1.3.1) (2020-07-24)
|
|
177
|
+
|
|
178
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
179
|
+
|
|
180
|
+
# [1.3.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.10...@formatjs/intl-getcanonicallocales@1.3.0) (2020-07-14)
|
|
181
|
+
|
|
182
|
+
### Features
|
|
183
|
+
|
|
184
|
+
* publish ([b6e3465](https://github.com/formatjs/formatjs/commit/b6e3465ac95b3fa481f3c89f077a66ac004f7c27))
|
|
185
|
+
|
|
186
|
+
## [1.2.11](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.10...@formatjs/intl-getcanonicallocales@1.2.11) (2020-07-09)
|
|
187
|
+
|
|
188
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
189
|
+
|
|
190
|
+
## [1.2.10](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.8...@formatjs/intl-getcanonicallocales@1.2.10) (2020-07-03)
|
|
191
|
+
|
|
192
|
+
### Bug Fixes
|
|
193
|
+
|
|
194
|
+
* **@formatjs/intl-getcanonicallocales:** re-publish ([1528d6d](https://github.com/formatjs/formatjs/commit/1528d6d1326ca993f8df1a3e63817e2ed25ba219))
|
|
195
|
+
|
|
196
|
+
## [1.2.8](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.7...@formatjs/intl-getcanonicallocales@1.2.8) (2020-07-03)
|
|
197
|
+
|
|
198
|
+
### Bug Fixes
|
|
199
|
+
|
|
200
|
+
* add locale-data to package.json files ([52a1481](https://github.com/formatjs/formatjs/commit/52a148196585bf8b33b27b9b948d6333f49072e8))
|
|
201
|
+
|
|
202
|
+
## [1.2.7](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.6...@formatjs/intl-getcanonicallocales@1.2.7) (2020-07-01)
|
|
203
|
+
|
|
204
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
205
|
+
|
|
206
|
+
## [1.2.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.5...@formatjs/intl-getcanonicallocales@1.2.6) (2020-06-06)
|
|
207
|
+
|
|
208
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
209
|
+
|
|
210
|
+
## [1.2.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.4...@formatjs/intl-getcanonicallocales@1.2.5) (2020-06-06)
|
|
211
|
+
|
|
212
|
+
### Bug Fixes
|
|
213
|
+
|
|
214
|
+
* **@formatjs/intl-getcanonicallocales:** handle non-existent Intl object ([b488ee8](https://github.com/formatjs/formatjs/commit/b488ee88b8ccab854b738ba4ad9c3947058121a1))
|
|
215
|
+
|
|
216
|
+
## [1.2.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.3...@formatjs/intl-getcanonicallocales@1.2.4) (2020-05-28)
|
|
217
|
+
|
|
218
|
+
### Bug Fixes
|
|
219
|
+
|
|
220
|
+
* **@formatjs/intl-utils:** Add missing cldr-core to package.json dep ([d0b72fe](https://github.com/formatjs/formatjs/commit/d0b72fe398c7017d03e8ee66c98ad88fe3e47657))
|
|
221
|
+
|
|
222
|
+
## [1.2.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.2...@formatjs/intl-getcanonicallocales@1.2.3) (2020-05-27)
|
|
223
|
+
|
|
224
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
225
|
+
|
|
226
|
+
## [1.2.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.1...@formatjs/intl-getcanonicallocales@1.2.2) (2020-05-25)
|
|
227
|
+
|
|
228
|
+
### Bug Fixes
|
|
229
|
+
|
|
230
|
+
* **@formatjs/intl-getcanonicallocales:** fix alias lookup algo ([b39e3c2](https://github.com/formatjs/formatjs/commit/b39e3c2b1baefc011825f8e443769c2095beeb12))
|
|
231
|
+
* **@formatjs/intl-getcanonicallocales:** fix region casing ([396dbe7](https://github.com/formatjs/formatjs/commit/396dbe769bef6eb82ae274ba4935e70e076b2854))
|
|
232
|
+
* **@formatjs/intl-getcanonicallocales:** Handle aliases properly ([9e19e4b](https://github.com/formatjs/formatjs/commit/9e19e4b769560f3717f9589ab6180e932aaf96f8))
|
|
233
|
+
* **@formatjs/intl-getcanonicallocales:** set the polyfill if native impl is buggy ([555a28b](https://github.com/formatjs/formatjs/commit/555a28b2d6d3c48f69d765c5090f7880ef603adc))
|
|
234
|
+
* **@formatjs/intl-locale:** fix add/remove likely subtags ([d72f952](https://github.com/formatjs/formatjs/commit/d72f952a66905a3a7edd75518ccaa72c2020273e))
|
|
235
|
+
|
|
236
|
+
## [1.2.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.2.0...@formatjs/intl-getcanonicallocales@1.2.1) (2020-05-23)
|
|
237
|
+
|
|
238
|
+
**Note:** Version bump only for package @formatjs/intl-getcanonicallocales
|
|
239
|
+
|
|
240
|
+
# [1.2.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.1.1...@formatjs/intl-getcanonicallocales@1.2.0) (2020-05-23)
|
|
241
|
+
|
|
242
|
+
### Bug Fixes
|
|
243
|
+
|
|
244
|
+
* **@formatjs/intl-getcanonicallocales:** fix type def path in ([5df9a0b](https://github.com/formatjs/formatjs/commit/5df9a0b21e6b932835967c1d90a8cacab3d86892))
|
|
245
|
+
|
|
246
|
+
### Features
|
|
247
|
+
|
|
248
|
+
* **@formatjs/intl-getcanonicallocales:** Expose more functions to ([6fd12ec](https://github.com/formatjs/formatjs/commit/6fd12ec23b9857a92365584497d462cbac2b81f4))
|
|
249
|
+
|
|
250
|
+
## [1.1.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.1.0...@formatjs/intl-getcanonicallocales@1.1.1) (2020-05-22)
|
|
251
|
+
|
|
252
|
+
### Bug Fixes
|
|
253
|
+
|
|
254
|
+
* **eslint-plugin-formatjs:** add no-id to index ([8e5c0af](https://github.com/formatjs/formatjs/commit/8e5c0afe69944d52653b92c2f08e15363246834a))
|
|
255
|
+
|
|
256
|
+
# 1.1.0 (2020-05-22)
|
|
257
|
+
|
|
258
|
+
### Features
|
|
259
|
+
|
|
260
|
+
* **@formatjs/intl-getcanonicallocales:** initial commit ([daba5a4](https://github.com/formatjs/formatjs/commit/daba5a4944bbab29573d02f626606262a035901d))
|
|
261
|
+
|
|
262
|
+
## [1.1.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-locale@1.1.0...@formatjs/intl-locale@1.1.1) (2020-05-21)
|
|
263
|
+
|
|
264
|
+
**Note:** Version bump only for package @formatjs/intl-locale
|
|
265
|
+
|
|
266
|
+
# [1.1.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-locale@0.1.0...@formatjs/intl-locale@1.1.0) (2020-05-20)
|
|
267
|
+
|
|
268
|
+
### Bug Fixes
|
|
269
|
+
|
|
270
|
+
* **@formatjs/intl-locale:** fix according to https://github.com/tc39/test262/issues/2628 ([1006ed2](https://github.com/formatjs/formatjs/commit/1006ed248837930ffb951d8936feec9878231c71))
|
|
271
|
+
* **@formatjs/intl-locale:** fix and docs ([5c5ef76](https://github.com/formatjs/formatjs/commit/5c5ef7657dd939bc08a9233f25cbae7a662c439f))
|
|
272
|
+
* **@formatjs/intl-locale:** fix minimize ([5ee8909](https://github.com/formatjs/formatjs/commit/5ee890910bd7260e0d549a2dd89f8e39dcbdfc60))
|
|
273
|
+
* **@formatjs/intl-locale:** fix minimize ([2c21dcb](https://github.com/formatjs/formatjs/commit/2c21dcb97043902c5ce7de643b20138333125693))
|
|
274
|
+
* **@formatjs/intl-locale:** more fixes ([1bbd03d](https://github.com/formatjs/formatjs/commit/1bbd03d46905e869c3f69e79c647b64d20d3403f))
|
|
275
|
+
* **@formatjs/intl-locale:** split out likelySubtags data ([ed34904](https://github.com/formatjs/formatjs/commit/ed3490496dc793ebbad6446d1d304d2cb2e23fd1))
|
|
276
|
+
|
|
277
|
+
### Features
|
|
278
|
+
|
|
279
|
+
* **@formatjs/intl-locale:** make it public ([c377a28](https://github.com/formatjs/formatjs/commit/c377a2899b74800422221453ecd7d7f477810995))
|
|
280
|
+
* **@formatjs/intl-locale:** Use a much smaller handwritten parser ([c210cbf](https://github.com/formatjs/formatjs/commit/c210cbff1b88245a3e041b14edaaf2f5aefca3bd))
|
|
281
|
+
|
|
282
|
+
# 0.1.0 (2020-05-18)
|
|
283
|
+
|
|
284
|
+
### Bug Fixes
|
|
285
|
+
|
|
286
|
+
* **react-intl:** reduce onError chattiness ([42d0ac4](https://github.com/formatjs/formatjs/commit/42d0ac433d4d31629bd2aadb2dafb49775d01aac))
|
|
287
|
+
|
|
288
|
+
### Features
|
|
289
|
+
|
|
290
|
+
* **@formatjs/intl-locale:** initial commit ([f469e81](https://github.com/formatjs/formatjs/commit/f469e812a052318c8ec0816abc86035256e4fe11))
|
package/LICENSE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/index.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {parseUnicodeLocaleId} from './src/parser'
|
|
2
|
+
import {emitUnicodeLocaleId} from './src/emitter'
|
|
3
|
+
import {canonicalizeUnicodeLocaleId} from './src/canonicalizer'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* https://tc39.es/ecma402/#sec-canonicalizelocalelist
|
|
7
|
+
* @param locales
|
|
8
|
+
*/
|
|
9
|
+
function CanonicalizeLocaleList(locales?: string[] | string): string[] {
|
|
10
|
+
if (locales === undefined) {
|
|
11
|
+
return []
|
|
12
|
+
}
|
|
13
|
+
const seen: string[] = []
|
|
14
|
+
if (typeof locales === 'string') {
|
|
15
|
+
locales = [locales]
|
|
16
|
+
}
|
|
17
|
+
for (const locale of locales) {
|
|
18
|
+
const canonicalizedTag = emitUnicodeLocaleId(
|
|
19
|
+
canonicalizeUnicodeLocaleId(parseUnicodeLocaleId(locale))
|
|
20
|
+
)
|
|
21
|
+
if (seen.indexOf(canonicalizedTag) < 0) {
|
|
22
|
+
seen.push(canonicalizedTag)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return seen
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getCanonicalLocales(locales?: string[] | string): string[] {
|
|
29
|
+
return CanonicalizeLocaleList(locales)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
parseUnicodeLocaleId,
|
|
34
|
+
parseUnicodeLanguageId,
|
|
35
|
+
isStructurallyValidLanguageTag,
|
|
36
|
+
isUnicodeRegionSubtag,
|
|
37
|
+
isUnicodeScriptSubtag,
|
|
38
|
+
isUnicodeLanguageSubtag,
|
|
39
|
+
} from './src/parser'
|
|
40
|
+
export * from './src/types'
|
|
41
|
+
export * from './src/emitter'
|
|
42
|
+
|
|
43
|
+
export * from './src/likelySubtags.generated'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-getcanonicallocales",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Intl.getCanonicalLocales polyfill",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"url": "https://github.com/formatjs/formatjs/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"tslib": "
|
|
28
|
+
"tslib": "2.4.0"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
package/polyfill.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {getCanonicalLocales} from './'
|
|
2
|
+
import {shouldPolyfill} from './should-polyfill'
|
|
3
|
+
if (typeof Intl === 'undefined') {
|
|
4
|
+
if (typeof window !== 'undefined') {
|
|
5
|
+
Object.defineProperty(window, 'Intl', {
|
|
6
|
+
value: {},
|
|
7
|
+
})
|
|
8
|
+
// @ts-ignore we don't include @types/node so global isn't a thing
|
|
9
|
+
} else if (typeof global !== 'undefined') {
|
|
10
|
+
// @ts-ignore we don't include @types/node so global isn't a thing
|
|
11
|
+
Object.defineProperty(global, 'Intl', {
|
|
12
|
+
value: {},
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (shouldPolyfill()) {
|
|
17
|
+
Object.defineProperty(Intl, 'getCanonicalLocales', {
|
|
18
|
+
value: getCanonicalLocales,
|
|
19
|
+
writable: true,
|
|
20
|
+
enumerable: false,
|
|
21
|
+
configurable: true,
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {outputFileSync} from 'fs-extra'
|
|
2
|
+
import * as aliases from 'cldr-core/supplemental/aliases.json'
|
|
3
|
+
import minimist from 'minimist'
|
|
4
|
+
|
|
5
|
+
const {languageAlias, territoryAlias, scriptAlias, variantAlias} =
|
|
6
|
+
aliases.supplemental.metadata.alias
|
|
7
|
+
|
|
8
|
+
function main({out}: minimist.ParsedArgs) {
|
|
9
|
+
const data = {
|
|
10
|
+
languageAlias: Object.keys(languageAlias).reduce(
|
|
11
|
+
(all: Record<string, string>, locale) => {
|
|
12
|
+
all[locale] = languageAlias[locale as 'zh-cmn']._replacement
|
|
13
|
+
return all
|
|
14
|
+
},
|
|
15
|
+
{}
|
|
16
|
+
),
|
|
17
|
+
territoryAlias: Object.keys(territoryAlias).reduce(
|
|
18
|
+
(all: Record<string, string>, locale) => {
|
|
19
|
+
all[locale] = territoryAlias[locale as '004']._replacement
|
|
20
|
+
return all
|
|
21
|
+
},
|
|
22
|
+
{}
|
|
23
|
+
),
|
|
24
|
+
scriptAlias: Object.keys(scriptAlias).reduce(
|
|
25
|
+
(all: Record<string, string>, locale) => {
|
|
26
|
+
all[locale] = scriptAlias[locale as 'Qaai']._replacement
|
|
27
|
+
return all
|
|
28
|
+
},
|
|
29
|
+
{}
|
|
30
|
+
),
|
|
31
|
+
variantAlias: Object.keys(variantAlias).reduce(
|
|
32
|
+
(all: Record<string, string>, locale) => {
|
|
33
|
+
all[locale] = variantAlias[locale as 'heploc']._replacement
|
|
34
|
+
return all
|
|
35
|
+
},
|
|
36
|
+
{}
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
outputFileSync(
|
|
41
|
+
out,
|
|
42
|
+
`/* @generated */
|
|
43
|
+
// prettier-ignore
|
|
44
|
+
export const languageAlias: Record<string, string> = ${JSON.stringify(
|
|
45
|
+
data.languageAlias,
|
|
46
|
+
undefined,
|
|
47
|
+
2
|
|
48
|
+
)};
|
|
49
|
+
export const territoryAlias: Record<string, string> = ${JSON.stringify(
|
|
50
|
+
data.territoryAlias,
|
|
51
|
+
undefined,
|
|
52
|
+
2
|
|
53
|
+
)};
|
|
54
|
+
export const scriptAlias: Record<string, string> = ${JSON.stringify(
|
|
55
|
+
data.scriptAlias,
|
|
56
|
+
undefined,
|
|
57
|
+
2
|
|
58
|
+
)};
|
|
59
|
+
export const variantAlias: Record<string, string> = ${JSON.stringify(
|
|
60
|
+
data.variantAlias,
|
|
61
|
+
undefined,
|
|
62
|
+
2
|
|
63
|
+
)};
|
|
64
|
+
`
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (require.main === module) {
|
|
69
|
+
main(minimist(process.argv))
|
|
70
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {outputFileSync} from 'fs-extra'
|
|
2
|
+
import minimist from 'minimist'
|
|
3
|
+
import * as likelySubtags from 'cldr-core/supplemental/likelySubtags.json'
|
|
4
|
+
function main({out}: minimist.ParsedArgs) {
|
|
5
|
+
outputFileSync(
|
|
6
|
+
out,
|
|
7
|
+
`/* @generated */
|
|
8
|
+
// prettier-ignore
|
|
9
|
+
export const likelySubtags: Record<string, string> = ${JSON.stringify(
|
|
10
|
+
likelySubtags.supplemental.likelySubtags,
|
|
11
|
+
undefined,
|
|
12
|
+
2
|
|
13
|
+
)};
|
|
14
|
+
`
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (require.main === module) {
|
|
19
|
+
main(minimist(process.argv))
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function shouldPolyfill() {
|
|
2
|
+
return (
|
|
3
|
+
typeof Intl === 'undefined' ||
|
|
4
|
+
!('getCanonicalLocales' in Intl) ||
|
|
5
|
+
// Native Intl.getCanonicalLocales is just buggy
|
|
6
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=10682
|
|
7
|
+
((Intl as any).getCanonicalLocales as any)('und-x-private')[0] ===
|
|
8
|
+
'x-private'
|
|
9
|
+
)
|
|
10
|
+
}
|