@d3plus/locales 3.0.16 → 3.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 D3plus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @d3plus/locales
2
-
2
+
3
3
  International localizations for number, date, and UI labels.
4
4
 
5
5
  ## Installing
@@ -7,10 +7,10 @@ International localizations for number, date, and UI labels.
7
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).
8
8
 
9
9
  ```js
10
- import modules from "@d3plus/locales";
10
+ import {*} from "@d3plus/locales";
11
11
  ```
12
12
 
13
- In vanilla JavaScript, a `d3plus` global is exported from the pre-bundled version:
13
+ In a vanilla environment, a `d3plus` global is exported from the pre-bundled version:
14
14
 
15
15
  ```html
16
16
  <script src="https://cdn.jsdelivr.net/npm/@d3plus/locales"></script>
@@ -21,22 +21,151 @@ In vanilla JavaScript, a `d3plus` global is exported from the pre-bundled versio
21
21
 
22
22
  ## Examples
23
23
 
24
- Live examples can be found on [d3plus.org](https://d3plus.org/), which includes a collection of example visualizations using @d3plus/react.
24
+ Live examples can be found on [d3plus.org](https://d3plus.org/), which includes a collection of example visualizations using [@d3plus/react](https://github.com/d3plus/d3plus/tree/main/packages/react).
25
25
 
26
26
  ## API Reference
27
27
 
28
- #####
29
- * [formatLocale](#formatLocale) - A set of default locale formatters used when assigning suffixes and currency in numbers.
28
+ | Functions | Description |
29
+ | --- | --- |
30
+ | [`findLocale`](#findlocale) | Converts a 2-letter language code into a full language-region locale string (e.g., "en" to "en-US"). |
30
31
 
31
- ---
32
+ | Variables | Description |
33
+ | --- | --- |
34
+ | [`formatLocale`](#formatlocale) | |
35
+ | [`locale`](#locale) | |
36
+ | [`translateLocale`](#translatelocale) | |
32
37
 
33
- <a name="formatLocale"></a>
34
- #### **formatLocale** [<>](https://github.com/d3plus/d3plus/blob/main/packages/locales/src/dictionaries/formatLocale.js#L1)
38
+ | Interfaces | Description |
39
+ | --- | --- |
40
+ | [`FormatLocaleDefinition`](#formatlocaledefinition) | formatLocale |
41
+ | [`TimeLocaleDefinition`](#timelocaledefinition) | |
42
+ | [`TranslationStrings`](#translationstrings) | |
35
43
 
36
- A set of default locale formatters used when assigning suffixes and currency in numbers.
44
+ ## Functions
45
+
46
+ <a id="findlocale"></a>
47
+
48
+ ### findLocale()
49
+
50
+ > **findLocale**(`locale`: `string`): `string`
51
+
52
+ Defined in: [findLocale.ts:49](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/findLocale.ts#L49)
53
+
54
+ Converts a 2-letter language code into a full language-region locale string (e.g., "en" to "en-US").
55
+
56
+ #### Parameters
57
+
58
+ | Parameter | Type | Description |
59
+ | ------ | ------ | ------ |
60
+ | `locale` | `string` | A 2-letter language code (e.g., "en", "fr"). |
61
+
62
+ #### Returns
63
+
64
+ `string`
65
+
66
+ ## Variables
67
+
68
+ <a id="formatlocale"></a>
69
+
70
+ ### formatLocale
71
+
72
+ > `const` **formatLocale**: `Record`\<`string`, [`FormatLocaleDefinition`](#formatlocaledefinition)\>
37
73
 
74
+ Defined in: [dictionaries/formatLocale.ts:17](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L17)
38
75
 
39
- This is a global namespace
76
+ ***
40
77
 
41
- ---
78
+ <a id="locale"></a>
79
+
80
+ ### locale
81
+
82
+ > `const` **locale**: `Record`\<`string`, [`TimeLocaleDefinition`](#timelocaledefinition)\>
83
+
84
+ Defined in: [dictionaries/timeLocale.ts:39](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L39)
85
+
86
+ ***
87
+
88
+ <a id="translatelocale"></a>
89
+
90
+ ### translateLocale
91
+
92
+ > `const` **translateLocale**: `Record`\<`string`, [`TranslationStrings`](#translationstrings)\>
93
+
94
+ Defined in: [dictionaries/translateLocale.ts:21](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L21)
95
+
96
+ ## Interfaces
97
+
98
+ <a id="formatlocaledefinition"></a>
99
+
100
+ ### FormatLocaleDefinition
101
+
102
+ Defined in: [dictionaries/formatLocale.ts:6](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L6)
103
+
104
+ **`Namespace`**
105
+
106
+ formatLocale
107
+ A set of default locale formatters used when assigning suffixes and currency in numbers.
42
108
 
109
+ #### Properties
110
+
111
+ | Property | Type | Defined in |
112
+ | ------ | ------ | ------ |
113
+ | <a id="property-currency"></a> `currency` | \[`string`, `string`\] | [dictionaries/formatLocale.ts:14](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L14) |
114
+ | <a id="property-delimiters"></a> `delimiters` | `object` | [dictionaries/formatLocale.ts:10](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L10) |
115
+ | `delimiters.decimal` | `string` | [dictionaries/formatLocale.ts:12](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L12) |
116
+ | `delimiters.thousands` | `string` | [dictionaries/formatLocale.ts:11](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L11) |
117
+ | <a id="property-grouping"></a> `grouping` | `number`[] | [dictionaries/formatLocale.ts:9](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L9) |
118
+ | <a id="property-separator"></a> `separator?` | `string` | [dictionaries/formatLocale.ts:7](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L7) |
119
+ | <a id="property-suffixes"></a> `suffixes` | `string`[] | [dictionaries/formatLocale.ts:8](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/formatLocale.ts#L8) |
120
+
121
+ ***
122
+
123
+ <a id="timelocaledefinition"></a>
124
+
125
+ ### TimeLocaleDefinition
126
+
127
+ Defined in: [dictionaries/timeLocale.ts:1](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L1)
128
+
129
+ #### Properties
130
+
131
+ | Property | Type | Defined in |
132
+ | ------ | ------ | ------ |
133
+ | <a id="property-date"></a> `date` | `string` | [dictionaries/timeLocale.ts:3](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L3) |
134
+ | <a id="property-datetime"></a> `dateTime` | `string` | [dictionaries/timeLocale.ts:2](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L2) |
135
+ | <a id="property-days"></a> `days` | \[`string`, `string`, `string`, `string`, `string`, `string`, `string`\] | [dictionaries/timeLocale.ts:7](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L7) |
136
+ | <a id="property-months"></a> `months` | \[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`\] | [dictionaries/timeLocale.ts:9](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L9) |
137
+ | <a id="property-periods"></a> `periods` | \[`string`, `string`\] | [dictionaries/timeLocale.ts:6](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L6) |
138
+ | <a id="property-quarter"></a> `quarter` | `string` | [dictionaries/timeLocale.ts:5](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L5) |
139
+ | <a id="property-shortdays"></a> `shortDays` | \[`string`, `string`, `string`, `string`, `string`, `string`, `string`\] | [dictionaries/timeLocale.ts:8](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L8) |
140
+ | <a id="property-shortmonths"></a> `shortMonths` | \[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`\] | [dictionaries/timeLocale.ts:23](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L23) |
141
+ | <a id="property-time"></a> `time` | `string` | [dictionaries/timeLocale.ts:4](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/timeLocale.ts#L4) |
142
+
143
+ ***
144
+
145
+ <a id="translationstrings"></a>
146
+
147
+ ### TranslationStrings
148
+
149
+ Defined in: [dictionaries/translateLocale.ts:1](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L1)
150
+
151
+ #### Properties
152
+
153
+ | Property | Type | Defined in |
154
+ | ------ | ------ | ------ |
155
+ | <a id="property-and"></a> `and` | `string` | [dictionaries/translateLocale.ts:2](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L2) |
156
+ | <a id="property-back"></a> `Back` | `string` | [dictionaries/translateLocale.ts:3](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L3) |
157
+ | <a id="property-click-to-expand"></a> `Click to Expand` | `string` | [dictionaries/translateLocale.ts:4](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L4) |
158
+ | <a id="property-click-to-hide"></a> `Click to Hide` | `string` | [dictionaries/translateLocale.ts:5](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L5) |
159
+ | <a id="property-click-to-highlight"></a> `Click to Highlight` | `string` | [dictionaries/translateLocale.ts:6](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L6) |
160
+ | <a id="property-click-to-show"></a> `Click to Show` | `string` | [dictionaries/translateLocale.ts:7](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L7) |
161
+ | <a id="property-click-to-show-all"></a> `Click to Show All` | `string` | [dictionaries/translateLocale.ts:8](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L8) |
162
+ | <a id="property-download"></a> `Download` | `string` | [dictionaries/translateLocale.ts:9](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L9) |
163
+ | <a id="property-loading-visualization"></a> `Loading Visualization` | `string` | [dictionaries/translateLocale.ts:10](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L10) |
164
+ | <a id="property-more"></a> `more` | `string` | [dictionaries/translateLocale.ts:11](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L11) |
165
+ | <a id="property-no-data-available"></a> `No Data Available` | `string` | [dictionaries/translateLocale.ts:12](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L12) |
166
+ | <a id="property-powered-by-d3plus"></a> `Powered by D3plus` | `string` | [dictionaries/translateLocale.ts:13](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L13) |
167
+ | <a id="property-share"></a> `Share` | `string` | [dictionaries/translateLocale.ts:14](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L14) |
168
+ | <a id="property-shiftclick-to-hide"></a> `Shift+Click to Hide` | `string` | [dictionaries/translateLocale.ts:15](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L15) |
169
+ | <a id="property-shiftclick-to-highlight"></a> `Shift+Click to Highlight` | `string` | [dictionaries/translateLocale.ts:16](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L16) |
170
+ | <a id="property-total"></a> `Total` | `string` | [dictionaries/translateLocale.ts:17](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L17) |
171
+ | <a id="property-values"></a> `Values` | `string` | [dictionaries/translateLocale.ts:18](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/locales/src/dictionaries/translateLocale.ts#L18) |
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  @namespace {Object} formatLocale
3
- @desc A set of default locale formatters used when assigning suffixes and currency in numbers.
4
- */ export default {
3
+ A set of default locale formatters used when assigning suffixes and currency in numbers.
4
+ */ var formatLocale = {
5
5
  "ar-SA": {
6
6
  separator: "",
7
7
  suffixes: [
@@ -11,17 +11,17 @@
11
11
  "f",
12
12
  "p",
13
13
  "n",
14
- "µ",
14
+ "\u00b5",
15
15
  "m",
16
16
  "",
17
- " ألف",
18
- " مليون",
19
- " بليون",
20
- " تريليون",
21
- " كوادريليون",
22
- " كوينتيليون",
23
- " سكستليون",
24
- "سبتيليون"
17
+ " \u0623\u0644\u0641",
18
+ " \u0645\u0644\u064a\u0648\u0646",
19
+ " \u0628\u0644\u064a\u0648\u0646",
20
+ " \u062a\u0631\u064a\u0644\u064a\u0648\u0646",
21
+ " \u0643\u0648\u0627\u062f\u0631\u064a\u0644\u064a\u0648\u0646",
22
+ " \u0643\u0648\u064a\u0646\u062a\u064a\u0644\u064a\u0648\u0646",
23
+ " \u0633\u0643\u0633\u062a\u0644\u064a\u0648\u0646",
24
+ "\u0633\u0628\u062a\u064a\u0644\u064a\u0648\u0646"
25
25
  ],
26
26
  grouping: [
27
27
  3
@@ -44,7 +44,7 @@
44
44
  "f",
45
45
  "p",
46
46
  "n",
47
- "µ",
47
+ "\u00b5",
48
48
  "m",
49
49
  "",
50
50
  "k",
@@ -64,7 +64,7 @@
64
64
  decimal: "."
65
65
  },
66
66
  currency: [
67
- "£",
67
+ "\u00a3",
68
68
  ""
69
69
  ]
70
70
  },
@@ -77,7 +77,7 @@
77
77
  "f",
78
78
  "p",
79
79
  "n",
80
- "µ",
80
+ "\u00b5",
81
81
  "m",
82
82
  "",
83
83
  "k",
@@ -110,7 +110,7 @@
110
110
  "f",
111
111
  "p",
112
112
  "n",
113
- "µ",
113
+ "\u00b5",
114
114
  "m",
115
115
  "",
116
116
  " thousand",
@@ -143,7 +143,7 @@
143
143
  "f",
144
144
  "p",
145
145
  "n",
146
- "µ",
146
+ "\u00b5",
147
147
  "m",
148
148
  "",
149
149
  "k",
@@ -176,7 +176,7 @@
176
176
  "f",
177
177
  "p",
178
178
  "n",
179
- "µ",
179
+ "\u00b5",
180
180
  "m",
181
181
  "",
182
182
  "k",
@@ -209,7 +209,7 @@
209
209
  "f",
210
210
  "p",
211
211
  "n",
212
- "µ",
212
+ "\u00b5",
213
213
  "m",
214
214
  "",
215
215
  "k",
@@ -229,7 +229,7 @@
229
229
  decimal: ","
230
230
  },
231
231
  currency: [
232
- "",
232
+ "\u20ac",
233
233
  ""
234
234
  ]
235
235
  },
@@ -242,7 +242,7 @@
242
242
  "f",
243
243
  "p",
244
244
  "n",
245
- "µ",
245
+ "\u00b5",
246
246
  "m",
247
247
  "",
248
248
  "tuhat",
@@ -274,7 +274,7 @@
274
274
  "f",
275
275
  "p",
276
276
  "n",
277
- "µ",
277
+ "\u00b5",
278
278
  "m",
279
279
  "",
280
280
  "k",
@@ -294,30 +294,30 @@
294
294
  decimal: ","
295
295
  },
296
296
  currency: [
297
- "",
297
+ "\u20ac",
298
298
  ""
299
299
  ]
300
300
  },
301
301
  "zh-CN": {
302
302
  separator: "",
303
303
  suffixes: [
304
- "",
305
- "",
306
- "",
307
- "",
308
- "",
309
- "",
310
- "",
311
- "",
304
+ "\u5e7a",
305
+ "\u4ed4",
306
+ "\u963f",
307
+ "\u98de",
308
+ "\u76ae",
309
+ "\u7eb3",
310
+ "\u5fae",
311
+ "\u6beb",
312
312
  "",
313
- "",
314
- "",
315
- "",
316
- "",
317
- "",
318
- "",
319
- "",
320
- ""
313
+ "\u5343",
314
+ "\u5146",
315
+ "\u5409",
316
+ "\u592a",
317
+ "\u62cd",
318
+ "\u827e",
319
+ "\u6cfd",
320
+ "\u5c27"
321
321
  ],
322
322
  grouping: [
323
323
  3
@@ -327,8 +327,9 @@
327
327
  decimal: "."
328
328
  },
329
329
  currency: [
330
- "¥",
330
+ "\u00a5",
331
331
  ""
332
332
  ]
333
333
  }
334
334
  };
335
+ export default formatLocale;