@d3plus/locales 3.0.0-alpha.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/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @d3plus/locales
2
+
3
+ International localizations for number, date, and UI labels.
4
+
5
+ ## Installing
6
+
7
+ If using npm, `npm install @d3plus/locales`. Otherwise, you can download the [latest release from GitHub](https://github.com/d3plus/d3plus/releases/latest) or load from a [CDN](https://cdn.jsdelivr.net/npm/@d3plus/locales@3.0.0-alpha.0/+esm).
8
+
9
+ ```js
10
+ import modules from "@d3plus/locales";
11
+ ```
12
+
13
+ In vanilla JavaScript, a `d3plus` global is exported from the pre-bundled version:
14
+
15
+ ```html
16
+ <script src="https://cdn.jsdelivr.net/npm/@d3plus/locales@3.0.0-alpha.0"></script>
17
+ <script>
18
+ console.log(d3plus);
19
+ </script>
20
+ ```
21
+
22
+ ## Examples
23
+
24
+ Live examples can be found on [d3plus.org](https://d3plus.org/), which includes a collection of example visualizations using @d3plus/react.
25
+
26
+ ## API Reference
27
+
28
+ #####
29
+ * [formatLocale](#formatLocale) - A set of default locale formatters used when assigning suffixes and currency in numbers.
30
+
31
+ | Name | Default | Description |
32
+ |---|---|---|
33
+ | separator | "" | Separation between the number with the suffix. |
34
+ | suffixes | [] | List of suffixes used to format numbers. |
35
+ | grouping | [3] | The array of group sizes, |
36
+ | delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
37
+ | currency | ["$", ""] | The currency prefix and suffix. |
38
+
39
+ ---
40
+
41
+ <a name="formatLocale"></a>
42
+ #### **formatLocale** [<>](https://github.com/d3plus/d3plus/blob/main/packages/locales/src/dictionaries/formatLocale.js#L1)
43
+
44
+ A set of default locale formatters used when assigning suffixes and currency in numbers.
45
+
46
+ | Name | Default | Description |
47
+ |---|---|---|
48
+ | separator | "" | Separation between the number with the suffix. |
49
+ | suffixes | [] | List of suffixes used to format numbers. |
50
+ | grouping | [3] | The array of group sizes, |
51
+ | delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
52
+ | currency | ["$", ""] | The currency prefix and suffix. |
53
+
54
+
55
+ This is a global namespace
56
+
57
+ ---
58
+
59
+
60
+ ###### <sub>Documentation generated on Thu, 13 Mar 2025 19:58:29 GMT</sub>
package/es/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as translateLocale } from "./src/dictionaries/translateLocale.js";
2
+ export { default as formatLocale } from "./src/dictionaries/formatLocale.js";
3
+ export { default as locale } from "./src/dictionaries/timeLocale.js";
4
+ export { default as findLocale } from "./src/findLocale.js";
@@ -0,0 +1,342 @@
1
+ /**
2
+ @namespace {Object} formatLocale
3
+ @desc A set of default locale formatters used when assigning suffixes and currency in numbers.
4
+ *
5
+ * | Name | Default | Description |
6
+ * |---|---|---|
7
+ * | separator | "" | Separation between the number with the suffix. |
8
+ * | suffixes | [] | List of suffixes used to format numbers. |
9
+ * | grouping | [3] | The array of group sizes, |
10
+ * | delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
11
+ * | currency | ["$", ""] | The currency prefix and suffix. |
12
+ */ export default {
13
+ "ar-SA": {
14
+ separator: "",
15
+ suffixes: [
16
+ "y",
17
+ "z",
18
+ "a",
19
+ "f",
20
+ "p",
21
+ "n",
22
+ "µ",
23
+ "m",
24
+ "",
25
+ " ألف",
26
+ " مليون",
27
+ " بليون",
28
+ " تريليون",
29
+ " كوادريليون",
30
+ " كوينتيليون",
31
+ " سكستليون",
32
+ "سبتيليون"
33
+ ],
34
+ grouping: [
35
+ 3
36
+ ],
37
+ delimiters: {
38
+ thousands: ",",
39
+ decimal: "."
40
+ },
41
+ currency: [
42
+ "SAR ",
43
+ ""
44
+ ]
45
+ },
46
+ "en-GB": {
47
+ separator: "",
48
+ suffixes: [
49
+ "y",
50
+ "z",
51
+ "a",
52
+ "f",
53
+ "p",
54
+ "n",
55
+ "µ",
56
+ "m",
57
+ "",
58
+ "k",
59
+ "M",
60
+ "B",
61
+ "T",
62
+ "q",
63
+ "Q",
64
+ "Z",
65
+ "Y"
66
+ ],
67
+ grouping: [
68
+ 3
69
+ ],
70
+ delimiters: {
71
+ thousands: ",",
72
+ decimal: "."
73
+ },
74
+ currency: [
75
+ "£",
76
+ ""
77
+ ]
78
+ },
79
+ "en-US": {
80
+ separator: "",
81
+ suffixes: [
82
+ "y",
83
+ "z",
84
+ "a",
85
+ "f",
86
+ "p",
87
+ "n",
88
+ "µ",
89
+ "m",
90
+ "",
91
+ "k",
92
+ "M",
93
+ "B",
94
+ "T",
95
+ "q",
96
+ "Q",
97
+ "Z",
98
+ "Y"
99
+ ],
100
+ grouping: [
101
+ 3
102
+ ],
103
+ delimiters: {
104
+ thousands: ",",
105
+ decimal: "."
106
+ },
107
+ currency: [
108
+ "$",
109
+ ""
110
+ ]
111
+ },
112
+ "en-SA": {
113
+ separator: "",
114
+ suffixes: [
115
+ "y",
116
+ "z",
117
+ "a",
118
+ "f",
119
+ "p",
120
+ "n",
121
+ "µ",
122
+ "m",
123
+ "",
124
+ " thousand",
125
+ " million",
126
+ " billion",
127
+ " trillion",
128
+ " quadrillion",
129
+ " quintillion",
130
+ " sextillion",
131
+ "septillion"
132
+ ],
133
+ grouping: [
134
+ 3
135
+ ],
136
+ delimiters: {
137
+ thousands: ",",
138
+ decimal: "."
139
+ },
140
+ currency: [
141
+ "$",
142
+ ""
143
+ ]
144
+ },
145
+ "es-CL": {
146
+ separator: "",
147
+ suffixes: [
148
+ "y",
149
+ "z",
150
+ "a",
151
+ "f",
152
+ "p",
153
+ "n",
154
+ "µ",
155
+ "m",
156
+ "",
157
+ "k",
158
+ "M",
159
+ "MM",
160
+ "B",
161
+ "T",
162
+ "Q",
163
+ "Z",
164
+ "Y"
165
+ ],
166
+ grouping: [
167
+ 3
168
+ ],
169
+ delimiters: {
170
+ thousands: ".",
171
+ decimal: ","
172
+ },
173
+ currency: [
174
+ "$",
175
+ ""
176
+ ]
177
+ },
178
+ "es-MX": {
179
+ separator: "",
180
+ suffixes: [
181
+ "y",
182
+ "z",
183
+ "a",
184
+ "f",
185
+ "p",
186
+ "n",
187
+ "µ",
188
+ "m",
189
+ "",
190
+ "k",
191
+ "M",
192
+ "MM",
193
+ "B",
194
+ "T",
195
+ "Q",
196
+ "Z",
197
+ "Y"
198
+ ],
199
+ grouping: [
200
+ 3
201
+ ],
202
+ delimiters: {
203
+ thousands: ",",
204
+ decimal: "."
205
+ },
206
+ currency: [
207
+ "$",
208
+ ""
209
+ ]
210
+ },
211
+ "es-ES": {
212
+ separator: "",
213
+ suffixes: [
214
+ "y",
215
+ "z",
216
+ "a",
217
+ "f",
218
+ "p",
219
+ "n",
220
+ "µ",
221
+ "m",
222
+ "",
223
+ "k",
224
+ "mm",
225
+ "b",
226
+ "t",
227
+ "q",
228
+ "Q",
229
+ "Z",
230
+ "Y"
231
+ ],
232
+ grouping: [
233
+ 3
234
+ ],
235
+ delimiters: {
236
+ thousands: ".",
237
+ decimal: ","
238
+ },
239
+ currency: [
240
+ "€",
241
+ ""
242
+ ]
243
+ },
244
+ "et-EE": {
245
+ separator: " ",
246
+ suffixes: [
247
+ "y",
248
+ "z",
249
+ "a",
250
+ "f",
251
+ "p",
252
+ "n",
253
+ "µ",
254
+ "m",
255
+ "",
256
+ "tuhat",
257
+ "miljonit",
258
+ "miljardit",
259
+ "triljonit",
260
+ "q",
261
+ "Q",
262
+ "Z",
263
+ "Y"
264
+ ],
265
+ grouping: [
266
+ 3
267
+ ],
268
+ delimiters: {
269
+ thousands: " ",
270
+ decimal: ","
271
+ },
272
+ currency: [
273
+ "",
274
+ "eurot"
275
+ ]
276
+ },
277
+ "fr-FR": {
278
+ suffixes: [
279
+ "y",
280
+ "z",
281
+ "a",
282
+ "f",
283
+ "p",
284
+ "n",
285
+ "µ",
286
+ "m",
287
+ "",
288
+ "k",
289
+ "m",
290
+ "b",
291
+ "t",
292
+ "q",
293
+ "Q",
294
+ "Z",
295
+ "Y"
296
+ ],
297
+ grouping: [
298
+ 3
299
+ ],
300
+ delimiters: {
301
+ thousands: " ",
302
+ decimal: ","
303
+ },
304
+ currency: [
305
+ "€",
306
+ ""
307
+ ]
308
+ },
309
+ "zh-CN": {
310
+ separator: "",
311
+ suffixes: [
312
+ "幺",
313
+ "仄",
314
+ "阿",
315
+ "飞",
316
+ "皮",
317
+ "纳",
318
+ "微",
319
+ "毫",
320
+ "",
321
+ "千",
322
+ "兆",
323
+ "吉",
324
+ "太",
325
+ "拍",
326
+ "艾",
327
+ "泽",
328
+ "尧"
329
+ ],
330
+ grouping: [
331
+ 3
332
+ ],
333
+ delimiters: {
334
+ thousands: ",",
335
+ decimal: "."
336
+ },
337
+ currency: [
338
+ "¥",
339
+ ""
340
+ ]
341
+ }
342
+ };