unicode-input-toolconverter 0.2.0 → 0.2.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/.nyc_output/out.json +8980 -1849
- package/CHANGES.md +15 -1
- package/README.md +6 -11
- package/_locales/en-US/messages.json +153 -6
- package/_locales/hu-HU/messages.json +153 -6
- package/_locales/pt-BR/messages.json +153 -6
- package/_locales/sv-SE/messages.json +153 -6
- package/babel.config.json +0 -1
- package/browser_action/characterSelection.js +18 -11
- package/browser_action/charrefConverters.js +286 -79
- package/browser_action/chartBuild.js +97 -27
- package/browser_action/encodingBehaviors.js +10 -7
- package/browser_action/entityBehaviors.js +42 -16
- package/browser_action/index-es.html +13 -1
- package/browser_action/index-instrumented.html +13 -1
- package/browser_action/index-pages.html +13 -1
- package/browser_action/index.html +13 -1
- package/browser_action/index.iife.min.js +9 -1
- package/browser_action/index.iife.min.js.map +1 -1
- package/browser_action/index.instrumented.iife.min.js +1 -1
- package/browser_action/index.instrumented.iife.min.js.map +1 -1
- package/browser_action/index.js +5 -5
- package/browser_action/preferences/prefDefaults.js +12 -3
- package/browser_action/service-worker/sw-activateCallback.js +1 -2
- package/browser_action/service-worker/sw-resources.json +6 -4
- package/browser_action/templateUtils/elements.js +12 -1
- package/browser_action/templateUtils/fill.js +6 -0
- package/browser_action/templateUtils/validation.js +4 -1
- package/browser_action/templates/chartBuild.js +167 -102
- package/browser_action/templates/index.js +227 -53
- package/browser_action/templatesElementCustomization/widgets.js +40 -15
- package/browser_action/unicode/UnicodeConverter.js +99 -73
- package/browser_action/unicode/charrefunicodeDb.js +100 -50
- package/browser_action/unicode/getScriptInfoForCodePoint.js +13 -4
- package/browser_action/unicode/hangul.js +27 -20
- package/browser_action/unicode/lastScriptNames.json +1 -1
- package/browser_action/unicode/parseUnihanFromTextFileStrings.js +44 -25
- package/browser_action/unicode/unicodeFieldInfo.js +112 -90
- package/browser_action/unicode/unicodeScripts.js +409 -35
- package/browser_action/unicode/unihan.js +4 -3
- package/browser_action/unicode/unihanDbPopulate.js +7 -2
- package/browser_action/unicode/unihanFields.js +34 -0
- package/browser_action/unicodecharref.js +353 -190
- package/browser_action/utils/DOMUtils.js +95 -34
- package/browser_action/utils/FetchUtils.js +7 -6
- package/browser_action/utils/TextUtils.js +4 -4
- package/browser_action/utils/TypedArrayUtils.js +9 -5
- package/browser_action/utils/semicolonSeparatedToArray.js +3 -3
- package/browser_action/utils/setupServiceWorker.js +2 -2
- package/eslint.config.js +11 -0
- package/icons/openWindow16.png +0 -0
- package/icons/openWindow24.png +0 -0
- package/lib/background.html +7 -0
- package/lib/background.js +2 -2
- package/package.json +80 -70
- package/pnpm-workspace.yaml +8 -0
- package/server.js +66 -51
- package/sw.js +97 -56
- package/tools/entities-import.js +4 -1
- package/tools/findEsResources.js +33 -10
- package/tools/fix-sw-resources-vendor-paths.js +60 -0
- package/tools/list-locales.js +2 -2
- package/tools/parseUnicodeCharts.js +126 -60
- package/tools/ucd-import.js +1 -10
- package/tools/unicode-charts.html +49 -20
- package/tools/unihan-import.js +45 -15
- package/tools/write-sw-version.js +16 -0
- package/tsconfig.json +23 -0
- package/typings/__coverage__.d.ts +5 -0
- package/typings/apple-system-profiler.d.ts +17 -0
- package/typings/commands.d.ts +19 -0
- package/typings/json-6.d.ts +4 -0
- package/typings/rollup-plugin-istanbul.d.ts +3 -0
- package/vendor/camelcase/index.d.ts +154 -0
- package/vendor/camelcase/index.js +137 -23
- package/vendor/fflate/esm/browser.d.ts +1539 -0
- package/vendor/fflate/esm/browser.js +82 -55
- package/vendor/intl-dom/dist/Formatter.d.ts +120 -0
- package/vendor/intl-dom/dist/Formatter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/collation.d.ts +42 -0
- package/vendor/intl-dom/dist/collation.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts +52 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts +96 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts +17 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts +285 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts.map +1 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts +88 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts +67 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts +73 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts +26 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts.map +1 -0
- package/vendor/intl-dom/dist/i18n.d.ts +113 -0
- package/vendor/intl-dom/dist/i18n.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.d.ts +92 -0
- package/vendor/intl-dom/dist/index.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.esm.d.ts +34 -0
- package/vendor/intl-dom/dist/index.esm.js +854 -896
- package/vendor/intl-dom/dist/index.esm.min.js +4 -0
- package/vendor/intl-dom/dist/index.esm.min.js.map +1 -0
- package/vendor/intl-dom/dist/index.umd.js +2953 -0
- package/vendor/intl-dom/dist/index.umd.min.js +4 -0
- package/vendor/intl-dom/dist/index.umd.min.js.map +1 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts +34 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts.map +1 -0
- package/vendor/intl-dom/dist/shared.d.ts +20 -0
- package/vendor/intl-dom/dist/shared.d.ts.map +1 -0
- package/vendor/intl-dom/dist/utils.d.ts +53 -0
- package/vendor/intl-dom/dist/utils.d.ts.map +1 -0
- package/vendor/jamilih/dist/jml.d.mts +468 -0
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +1489 -343
- package/vendor/jquery/dist/jquery.js +1677 -2713
- package/vendor/json-6/dist/index.mjs +2 -0
- package/vendor/miller-columns/CHANGES.md +185 -0
- package/vendor/miller-columns/LICENSE-MIT.txt +21 -0
- package/vendor/miller-columns/README.md +249 -0
- package/vendor/miller-columns/demos/index.html +69 -0
- package/vendor/miller-columns/demos/index.js +72 -0
- package/vendor/miller-columns/dist/index-es.js +748 -0
- package/vendor/miller-columns/dist/index-es.min.d.ts +25 -0
- package/vendor/miller-columns/dist/index-es.min.js +7 -1
- package/vendor/miller-columns/dist/index-umd.js +757 -0
- package/vendor/miller-columns/dist/index-umd.min.js +7 -0
- package/vendor/miller-columns/dist/index.d.ts +25 -0
- package/vendor/miller-columns/dist/millerColumns.d.ts +10 -0
- package/vendor/miller-columns/eslint.config.js +46 -0
- package/vendor/miller-columns/fix-declarations.js +18 -0
- package/vendor/miller-columns/miller-columns.css +24 -1
- package/vendor/miller-columns/package.json +73 -0
- package/vendor/miller-columns/pnpm-workspace.yaml +2 -0
- package/vendor/miller-columns/src/index.js +642 -0
- package/vendor/miller-columns/src/millerColumns.ts +12 -0
- package/vendor/miller-columns/tsconfig-prod.json +23 -0
- package/vendor/miller-columns/tsconfig.json +21 -0
- package/vendor/simple-prefs/dist/index.esm.d.ts +1 -0
- package/vendor/simple-prefs/dist/index.esm.js +164 -216
- package/vendor/simple-prefs/dist/simple-prefs.d.ts +117 -0
- package/lgtm.yml +0 -5
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `arg` - By default, accepts the third portion of the
|
|
3
|
+
* `formattingRegex` within `insertNodes`, i.e., to allow the locale to
|
|
4
|
+
* supply arguments back to the calling script.
|
|
5
|
+
* `key` - The substitution key.
|
|
6
|
+
* @callback SubstitutionCallback
|
|
7
|
+
* @param {{
|
|
8
|
+
* arg: string,
|
|
9
|
+
* key: string
|
|
10
|
+
* }} cfg
|
|
11
|
+
* @returns {string|Element} The replacement text or element
|
|
12
|
+
*/
|
|
13
|
+
export type SubstitutionCallback = (cfg: {
|
|
14
|
+
arg: string;
|
|
15
|
+
key: string;
|
|
16
|
+
}) => string | Element;
|
|
17
|
+
export type ValueArray = [string | number | Date, object?, object?];
|
|
18
|
+
export type Integer = number;
|
|
19
|
+
export type ListValueArray = [
|
|
20
|
+
string[],
|
|
21
|
+
(((item: string, i: Integer) => Element) | object)?,
|
|
22
|
+
object?,
|
|
23
|
+
object?
|
|
24
|
+
];
|
|
25
|
+
export type DateRangeValueArray = [
|
|
26
|
+
Date | number,
|
|
27
|
+
Date | number,
|
|
28
|
+
Intl.DateTimeFormatOptions | undefined
|
|
29
|
+
];
|
|
30
|
+
export type RelativeValueArray = [number, Intl.RelativeTimeFormatUnit, object?];
|
|
31
|
+
export type RelativeTimeInfo = {
|
|
32
|
+
relative: RelativeValueArray;
|
|
33
|
+
};
|
|
34
|
+
export type ListInfo = {
|
|
35
|
+
list: ListValueArray;
|
|
36
|
+
};
|
|
37
|
+
export type NumberInfo = {
|
|
38
|
+
number: ValueArray | number;
|
|
39
|
+
};
|
|
40
|
+
export type DateInfo = {
|
|
41
|
+
date: ValueArray;
|
|
42
|
+
};
|
|
43
|
+
export type DateTimeInfo = {
|
|
44
|
+
datetime: ValueArray;
|
|
45
|
+
};
|
|
46
|
+
export type DateRangeInfo = {
|
|
47
|
+
dateRange: DateRangeValueArray;
|
|
48
|
+
};
|
|
49
|
+
export type DatetimeRangeInfo = {
|
|
50
|
+
datetimeRange: DateRangeValueArray;
|
|
51
|
+
};
|
|
52
|
+
export type RegionInfo = {
|
|
53
|
+
region: ValueArray;
|
|
54
|
+
};
|
|
55
|
+
export type LanguageInfo = {
|
|
56
|
+
language: ValueArray;
|
|
57
|
+
};
|
|
58
|
+
export type ScriptInfo = {
|
|
59
|
+
script: ValueArray;
|
|
60
|
+
};
|
|
61
|
+
export type CurrencyInfo = {
|
|
62
|
+
currency: ValueArray;
|
|
63
|
+
};
|
|
64
|
+
export type PluralInfo = {
|
|
65
|
+
plural: ValueArray;
|
|
66
|
+
};
|
|
67
|
+
export type PlainLocaleStringBodyObject = {
|
|
68
|
+
[key: string]: string;
|
|
69
|
+
};
|
|
70
|
+
export type PlainNestedLocaleStringBodyObject = {
|
|
71
|
+
[key: string]: string | PlainNestedLocaleStringBodyObject;
|
|
72
|
+
};
|
|
73
|
+
export type SwitchCaseInfo = {
|
|
74
|
+
/**
|
|
75
|
+
* Whether this conditional is the default
|
|
76
|
+
*/
|
|
77
|
+
default?: boolean;
|
|
78
|
+
};
|
|
79
|
+
export type SwitchCaseArray = [string, string, SwitchCaseInfo?];
|
|
80
|
+
export type SwitchArray = Record<string, SwitchCaseArray>;
|
|
81
|
+
export type SwitchArrays = Record<string, SwitchArray>;
|
|
82
|
+
export type SwitchCase = {
|
|
83
|
+
/**
|
|
84
|
+
* The locale message with any formatting
|
|
85
|
+
* place-holders; defaults to use of any single conditional
|
|
86
|
+
*/
|
|
87
|
+
message: string;
|
|
88
|
+
/**
|
|
89
|
+
* A description to add for translators
|
|
90
|
+
*/
|
|
91
|
+
description?: string;
|
|
92
|
+
};
|
|
93
|
+
export type SwitchGroup = Record<string, SwitchCase>;
|
|
94
|
+
export type Switch = Record<string, SwitchCase | SwitchGroup>;
|
|
95
|
+
export type Switches = Record<string, Switch>;
|
|
96
|
+
export type RichLocaleStringSubObject = {
|
|
97
|
+
/**
|
|
98
|
+
* The locale message with any formatting
|
|
99
|
+
* place-holders; defaults to use of any single conditional
|
|
100
|
+
*/
|
|
101
|
+
message: string;
|
|
102
|
+
/**
|
|
103
|
+
* A description to add for translators
|
|
104
|
+
*/
|
|
105
|
+
description?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Conditionals
|
|
108
|
+
*/
|
|
109
|
+
switches?: Switches;
|
|
110
|
+
};
|
|
111
|
+
export type RichLocaleStringBodyObject = {
|
|
112
|
+
[key: string]: RichLocaleStringSubObject;
|
|
113
|
+
};
|
|
114
|
+
export type RichNestedLocaleStringBodyObject = {
|
|
115
|
+
[key: string]: RichLocaleStringSubObject | RichNestedLocaleStringBodyObject;
|
|
116
|
+
};
|
|
117
|
+
export type LocaleResolver = (localesBasePath: string, locale: string) => string | false;
|
|
118
|
+
export type DateRange = [
|
|
119
|
+
Date | number,
|
|
120
|
+
Date | number,
|
|
121
|
+
(Intl.DateTimeFormatOptions | undefined)?
|
|
122
|
+
];
|
|
123
|
+
export type SubstitutionObjectValue = string | string[] | number | Date | DateRange | Element | Node | SubstitutionCallback | NumberInfo | PluralInfo | CurrencyInfo | LanguageInfo | ScriptInfo | DatetimeRangeInfo | DateRangeInfo | RegionInfo | DateTimeInfo | DateInfo | ListInfo | RelativeTimeInfo;
|
|
124
|
+
export type SubstitutionObject = {
|
|
125
|
+
[key: string]: SubstitutionObjectValue;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* May have additional properties if supplying options to an underlying
|
|
129
|
+
* formatter.
|
|
130
|
+
* The first value is the main value.
|
|
131
|
+
* The second are the options related to the main value.
|
|
132
|
+
* The third are any additional options.
|
|
133
|
+
* @typedef {[string|number|Date, object?, object?]} ValueArray
|
|
134
|
+
*/
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {number} Integer
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {[
|
|
140
|
+
* string[],
|
|
141
|
+
* (((item: string, i: Integer) => Element)|object)?,
|
|
142
|
+
* object?,
|
|
143
|
+
* object?
|
|
144
|
+
* ]} ListValueArray
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* @typedef {[
|
|
148
|
+
* Date|number, Date|number, Intl.DateTimeFormatOptions|undefined
|
|
149
|
+
* ]} DateRangeValueArray
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* @typedef {[number, Intl.RelativeTimeFormatUnit, object?]} RelativeValueArray
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* @typedef {object} RelativeTimeInfo
|
|
156
|
+
* @property {RelativeValueArray} relative
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* @typedef {object} ListInfo
|
|
160
|
+
* @property {ListValueArray} list
|
|
161
|
+
*/
|
|
162
|
+
/**
|
|
163
|
+
* @typedef {object} NumberInfo
|
|
164
|
+
* @property {ValueArray|number} number
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* @typedef {object} DateInfo
|
|
168
|
+
* @property {ValueArray} date
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* @typedef {object} DateTimeInfo
|
|
172
|
+
* @property {ValueArray} datetime
|
|
173
|
+
*/
|
|
174
|
+
/**
|
|
175
|
+
* @typedef {object} DateRangeInfo
|
|
176
|
+
* @property {DateRangeValueArray} dateRange
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* @typedef {object} DatetimeRangeInfo
|
|
180
|
+
* @property {DateRangeValueArray} datetimeRange
|
|
181
|
+
*/
|
|
182
|
+
/**
|
|
183
|
+
* @typedef {object} RegionInfo
|
|
184
|
+
* @property {ValueArray} region
|
|
185
|
+
*/
|
|
186
|
+
/**
|
|
187
|
+
* @typedef {object} LanguageInfo
|
|
188
|
+
* @property {ValueArray} language
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* @typedef {object} ScriptInfo
|
|
192
|
+
* @property {ValueArray} script
|
|
193
|
+
*/
|
|
194
|
+
/**
|
|
195
|
+
* @typedef {object} CurrencyInfo
|
|
196
|
+
* @property {ValueArray} currency
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* @typedef {object} PluralInfo
|
|
200
|
+
* @property {ValueArray} plural
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* @typedef {{[key: string]: string}} PlainLocaleStringBodyObject
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* @typedef {{
|
|
207
|
+
* [key: string]: string|PlainNestedLocaleStringBodyObject
|
|
208
|
+
* }} PlainNestedLocaleStringBodyObject
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
* @typedef {object} SwitchCaseInfo
|
|
212
|
+
* @property {boolean} [default=false] Whether this conditional is the default
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* Contains the type, the message, and optional info about the switch case.
|
|
216
|
+
* @typedef {[string, string, SwitchCaseInfo?]} SwitchCaseArray
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
219
|
+
* @typedef {Record<string, SwitchCaseArray>} SwitchArray
|
|
220
|
+
*/
|
|
221
|
+
/**
|
|
222
|
+
* @typedef {Record<string, SwitchArray>} SwitchArrays
|
|
223
|
+
*/
|
|
224
|
+
/**
|
|
225
|
+
* @typedef {object} SwitchCase
|
|
226
|
+
* @property {string} message The locale message with any formatting
|
|
227
|
+
* place-holders; defaults to use of any single conditional
|
|
228
|
+
* @property {string} [description] A description to add for translators
|
|
229
|
+
*/
|
|
230
|
+
/**
|
|
231
|
+
* @typedef {Record<string, SwitchCase>} SwitchGroup
|
|
232
|
+
*/
|
|
233
|
+
/**
|
|
234
|
+
* @typedef {Record<string, SwitchCase|SwitchGroup>} Switch
|
|
235
|
+
*/
|
|
236
|
+
/**
|
|
237
|
+
* @typedef {Record<string, Switch>} Switches
|
|
238
|
+
*/
|
|
239
|
+
/**
|
|
240
|
+
* @typedef {object} RichLocaleStringSubObject
|
|
241
|
+
* @property {string} message The locale message with any formatting
|
|
242
|
+
* place-holders; defaults to use of any single conditional
|
|
243
|
+
* @property {string} [description] A description to add for translators
|
|
244
|
+
* @property {Switches} [switches] Conditionals
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
247
|
+
* @typedef {{
|
|
248
|
+
* [key: string]: RichLocaleStringSubObject
|
|
249
|
+
* }} RichLocaleStringBodyObject
|
|
250
|
+
*/
|
|
251
|
+
/**
|
|
252
|
+
* @typedef {{
|
|
253
|
+
* [key: string]: RichLocaleStringSubObject|RichNestedLocaleStringBodyObject
|
|
254
|
+
* }} RichNestedLocaleStringBodyObject
|
|
255
|
+
*/
|
|
256
|
+
/**
|
|
257
|
+
* Takes a base path and locale and gives a URL.
|
|
258
|
+
* @callback LocaleResolver
|
|
259
|
+
* @param {string} localesBasePath (Trailing slash optional)
|
|
260
|
+
* @param {string} locale BCP-47 language string
|
|
261
|
+
* @returns {string|false} URL of the locale file to be fetched
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* @typedef {[
|
|
265
|
+
* Date|number, Date|number, (Intl.DateTimeFormatOptions|undefined)?
|
|
266
|
+
* ]} DateRange
|
|
267
|
+
*/
|
|
268
|
+
/**
|
|
269
|
+
* @typedef {string|string[]|number|Date|DateRange|
|
|
270
|
+
* Element|Node|SubstitutionCallback|
|
|
271
|
+
* NumberInfo|PluralInfo|CurrencyInfo|LanguageInfo|ScriptInfo|
|
|
272
|
+
* DatetimeRangeInfo|DateRangeInfo|RegionInfo|DateTimeInfo|DateInfo|
|
|
273
|
+
* ListInfo|RelativeTimeInfo
|
|
274
|
+
* } SubstitutionObjectValue
|
|
275
|
+
*/
|
|
276
|
+
/**
|
|
277
|
+
* @typedef {{
|
|
278
|
+
* [key: string]: SubstitutionObjectValue
|
|
279
|
+
* }} SubstitutionObject
|
|
280
|
+
*/
|
|
281
|
+
/**
|
|
282
|
+
* @type {LocaleResolver}
|
|
283
|
+
*/
|
|
284
|
+
export declare const defaultLocaleResolver: LocaleResolver;
|
|
285
|
+
//# sourceMappingURL=defaultLocaleResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultLocaleResolver.d.ts","sourceRoot":"","sources":["../src/defaultLocaleResolver.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AANA,YAAU,oBAAoB,GAC9B,CAGG,GAAG,EAHE;IACN,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAA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EG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAFxB,cAmBT,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export { setFetch, getFetch } from './shared.js';
|
|
2
|
+
export type LocaleMatcher = (locale: string) => any;
|
|
3
|
+
/**
|
|
4
|
+
* Takes a locale and returns a new locale to check.
|
|
5
|
+
* @callback LocaleMatcher
|
|
6
|
+
* @param {string} locale The failed locale
|
|
7
|
+
* @throws {Error} If there are no further hyphens left to check
|
|
8
|
+
* @returns {string|Promise<string>} The new locale to check
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @type {LocaleMatcher}
|
|
12
|
+
*/
|
|
13
|
+
export declare const defaultLocaleMatcher: LocaleMatcher;
|
|
14
|
+
/**
|
|
15
|
+
* @param {object} cfg
|
|
16
|
+
* @param {string} cfg.locale
|
|
17
|
+
* @param {string[]} cfg.locales
|
|
18
|
+
* @param {LocaleMatcher} [cfg.localeMatcher]
|
|
19
|
+
* @returns {string|false}
|
|
20
|
+
*/
|
|
21
|
+
export declare const getMatchingLocale: ({ locale, locales, localeMatcher }: {
|
|
22
|
+
locale: string;
|
|
23
|
+
locales: string[];
|
|
24
|
+
localeMatcher?: LocaleMatcher;
|
|
25
|
+
}) => string | false;
|
|
26
|
+
export type LocaleObjectInfo = {
|
|
27
|
+
/**
|
|
28
|
+
* The successfully retrieved locale strings
|
|
29
|
+
*/
|
|
30
|
+
strings: import('./getMessageForKeyByStyle.js').LocaleObject;
|
|
31
|
+
/**
|
|
32
|
+
* The successfully resolved locale
|
|
33
|
+
*/
|
|
34
|
+
locale: string;
|
|
35
|
+
};
|
|
36
|
+
export type LocaleStringArgs = {
|
|
37
|
+
locales?: string[];
|
|
38
|
+
defaultLocales?: string[];
|
|
39
|
+
localesBasePath?: string;
|
|
40
|
+
localeResolver?: import('./defaultLocaleResolver.js').LocaleResolver;
|
|
41
|
+
localeMatcher?: "lookup" | LocaleMatcher;
|
|
42
|
+
};
|
|
43
|
+
export type LocaleStringFinder = (cfg?: LocaleStringArgs) => Promise<LocaleObjectInfo>;
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {object} LocaleObjectInfo
|
|
46
|
+
* @property {import('./getMessageForKeyByStyle.js').
|
|
47
|
+
* LocaleObject} strings The successfully retrieved locale strings
|
|
48
|
+
* @property {string} locale The successfully resolved locale
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {{
|
|
52
|
+
* locales?: string[],
|
|
53
|
+
* defaultLocales?: string[],
|
|
54
|
+
* localesBasePath?: string,
|
|
55
|
+
* localeResolver?: import('./defaultLocaleResolver.js').LocaleResolver,
|
|
56
|
+
* localeMatcher?: "lookup"|LocaleMatcher
|
|
57
|
+
* }} LocaleStringArgs
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* `locales` - BCP-47 language strings. Defaults to `navigator.languages`.
|
|
61
|
+
* `defaultLocales` - Defaults to ["en-US"].
|
|
62
|
+
* `localesBasePath` - Defaults to `.`.
|
|
63
|
+
* `localeResolver` - Defaults to `defaultLocaleResolver`.
|
|
64
|
+
* @typedef {(
|
|
65
|
+
* cfg?: LocaleStringArgs
|
|
66
|
+
* ) => Promise<LocaleObjectInfo>} LocaleStringFinder
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @type {LocaleStringFinder}
|
|
71
|
+
*/
|
|
72
|
+
export declare const findLocaleStrings: LocaleStringFinder;
|
|
73
|
+
export type LocaleFinder = (cfg?: LocaleStringArgs) => Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolves to the successfully resolved locale.
|
|
76
|
+
* `locales` - BCP-47 language strings. Defaults to `navigator.languages`.
|
|
77
|
+
* `defaultLocales` - Defaults to ["en-US"].
|
|
78
|
+
* `localesBasePath` - Defaults to `.`.
|
|
79
|
+
* `localeResolver` - Defaults to `defaultLocaleResolver`.
|
|
80
|
+
* `localeMatcher`.
|
|
81
|
+
* @typedef {(cfg?: LocaleStringArgs) => Promise<string>} LocaleFinder
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @type {LocaleFinder}
|
|
86
|
+
*/
|
|
87
|
+
export declare const findLocale: LocaleFinder;
|
|
88
|
+
//# sourceMappingURL=findLocaleStrings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findLocaleStrings.d.ts","sourceRoot":"","sources":["../src/findLocaleStrings.js"],"names":[],"mappings":"AAMA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AAI5C,YAAU,aAAa,GACvB,CAAgB,MAAM,EAAd,MACR,QAAA,CAAA;AAJH;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAFvB,aAUT,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,uCAL3B;IAAoB,MAAM,EAAlB,MAAM,CACd;IAAsB,OAAO,EAArB,MAAM,EAAE,CAChB;IAA4B,aAAa,AAAzC,CACA,EADQ,aAAa,CACrB;CAAA,KAAU,MAAM,GAAC,KAcnB,CAAC;AAGC,YAAkB,gBAAgB,GAClC;;;;IACgB,OAAO,EADZ,OAAO,8BAA8B,EAC9C,YAAY,CACd;;;;IAAmB,MAAM,EAAd,MAAM,CACnB;CAAA,CAAA;AAGE,YAMG,gBAAgB,GANT;IACR,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,4BAA4B,EAAE,cAAc,CAAC;IACrE,aAAa,CAAC,EAAE,QAAQ,GAAC,aAAa,CAAA;CACvC,CAAkB;AAQnB,YAEgC,kBAAkB,GAFxC,CACR,GAAG,CAAC,EAAE,gBAAgB,KACnB,OAAO,CAAC,gBAAgB,CAAC,CAAoB;AAxBrD;;;;;GAKG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAFpB,kBAYT,CAAC;AASC,YAAuD,YAAY,GAAzD,CAAC,GAAG,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAc;AAPtE;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU,EAFb,YAaT,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export { setDocument, getDocument } from './shared.js';
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
export type CheckExtraSuppliedFormattersCallback = (substs: import('./defaultLocaleResolver.js').SubstitutionObject | {
|
|
4
|
+
substitutions: import('./defaultLocaleResolver.js').SubstitutionObject;
|
|
5
|
+
}) => any;
|
|
6
|
+
export type MissingSuppliedFormattersCallback = (cfg: {
|
|
7
|
+
key: string;
|
|
8
|
+
formatter: import('./Formatter.js').LocalFormatter | import('./Formatter.js').RegularFormatter | import('./Formatter.js').SwitchFormatter;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {number} Integer
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @callback CheckExtraSuppliedFormattersCallback
|
|
15
|
+
* @param {import('./defaultLocaleResolver.js').SubstitutionObject|{
|
|
16
|
+
* substitutions: import('./defaultLocaleResolver.js').SubstitutionObject
|
|
17
|
+
* }} substs (Why is an arg. of `substitutions` being passed in?)
|
|
18
|
+
* @throws {Error} Upon an extra formatting key being found
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {(
|
|
23
|
+
* cfg: {
|
|
24
|
+
* key: string,
|
|
25
|
+
* formatter: import('./Formatter.js').LocalFormatter|
|
|
26
|
+
* import('./Formatter.js').RegularFormatter|
|
|
27
|
+
* import('./Formatter.js').SwitchFormatter
|
|
28
|
+
* }
|
|
29
|
+
* ) => boolean} MissingSuppliedFormattersCallback
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {object} cfg
|
|
34
|
+
* @param {string} cfg.string
|
|
35
|
+
* @param {string} [cfg.locale] The (possibly already resolved) locale
|
|
36
|
+
* for use by configuring formatters
|
|
37
|
+
* @param {import('./getMessageForKeyByStyle.js').LocalObject} [cfg.locals]
|
|
38
|
+
* @param {import('./defaultLocaleResolver.js').Switches} [cfg.switches]
|
|
39
|
+
* @param {Integer} [cfg.maximumLocalNestingDepth]
|
|
40
|
+
* @param {?(import('./defaultAllSubstitutions.js').AllSubstitutionCallback|
|
|
41
|
+
* import('./defaultAllSubstitutions.js').AllSubstitutionCallback[])
|
|
42
|
+
* } [cfg.allSubstitutions]
|
|
43
|
+
* @param {import('./defaultInsertNodes.js').InsertNodesCallback
|
|
44
|
+
* } [cfg.insertNodes]
|
|
45
|
+
* @param {false|import('./defaultLocaleResolver.js').SubstitutionObject
|
|
46
|
+
* } [cfg.substitutions]
|
|
47
|
+
* @param {boolean} [cfg.dom]
|
|
48
|
+
* @param {boolean} [cfg.forceNodeReturn]
|
|
49
|
+
* @param {boolean} [cfg.throwOnMissingSuppliedFormatters]
|
|
50
|
+
* @param {boolean} [cfg.throwOnExtraSuppliedFormatters]
|
|
51
|
+
* @returns {string|Text|DocumentFragment}
|
|
52
|
+
*/
|
|
53
|
+
export declare const getDOMForLocaleString: ({ string, locale, locals, switches, maximumLocalNestingDepth, allSubstitutions, insertNodes, substitutions, dom, forceNodeReturn, throwOnMissingSuppliedFormatters, throwOnExtraSuppliedFormatters }: {
|
|
54
|
+
string: string;
|
|
55
|
+
locale?: string;
|
|
56
|
+
locals?: import('./getMessageForKeyByStyle.js').LocalObject;
|
|
57
|
+
switches?: import('./defaultLocaleResolver.js').Switches;
|
|
58
|
+
maximumLocalNestingDepth?: Integer;
|
|
59
|
+
allSubstitutions?: (import('./defaultAllSubstitutions.js').AllSubstitutionCallback | import('./defaultAllSubstitutions.js').AllSubstitutionCallback[]) | null;
|
|
60
|
+
insertNodes?: import('./defaultInsertNodes.js').InsertNodesCallback;
|
|
61
|
+
substitutions?: false | import('./defaultLocaleResolver.js').SubstitutionObject;
|
|
62
|
+
dom?: boolean;
|
|
63
|
+
forceNodeReturn?: boolean;
|
|
64
|
+
throwOnMissingSuppliedFormatters?: boolean;
|
|
65
|
+
throwOnExtraSuppliedFormatters?: boolean;
|
|
66
|
+
}) => string | Text | DocumentFragment;
|
|
67
|
+
//# sourceMappingURL=getDOMForLocaleString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDOMForLocaleString.d.ts","sourceRoot":"","sources":["../src/getDOMForLocaleString.js"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAGlD,YAAkB,OAAO,GAAf,MAAM,CAAS;AAIzB,YAAU,oCAAoC,GAC9C,CAEG,MAAM,EAFD,OAAO,4BAA4B,EAAE,kBAAkB,GAAC;IAC9D,aAAa,EAAE,OAAO,4BAA4B,EAAE,kBAAkB,CAAA;CAExE,QAAA,CAAA;AAKA,YAOc,iCAAiC,GAPrC,CACR,GAAG,EAAE;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,gBAAgB,EAAE,cAAc,GACxD,OAAe,gBAAgB,EAAE,gBAAgB,GACjD,OAAe,gBAAgB,EAAE,eAAe,CAAA;CAC3C,KACE,OAAO,CAAmC;AArBlD;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,qBAAqB,yMAnB/B;IAAoB,MAAM,EAAlB,MAAM,CACd;IAAqB,MAAM,AAA3B,CAEA,EAFQ,MAAM,CAEd;IAAiE,MAAM,AAAvE,CACA,EADQ,OAAO,8BAA8B,EAAE,WAAW,CAC1D;IAA4D,QAAQ,AAApE,CACA,EADQ,OAAO,4BAA4B,EAAE,QAAQ,CACrD;IAAsB,wBAAwB,AAA9C,CACA,EADQ,OAAO,CACf;IAEO,gBAAgB,AAFvB,CAGA,EAHS,CAAC,OAAO,8BAA8B,EAAE,uBAAuB,GAC1E,OAAW,8BAA8B,EAAE,uBAAuB,EAAE,CAAC,OAAA,CAEnE;IACO,WAAW,AADlB,CAEA,EAFQ,OAAO,yBAAyB,EAAE,mBAAmB,CAE7D;IACO,aAAa,AADpB,CAEA,EAFQ,KAAK,GAAC,OAAO,4BAA4B,EAAE,kBAAkB,CAErE;IAAsB,GAAG,AAAzB,CACA,EADQ,OAAO,CACf;IAAsB,eAAe,AAArC,CACA,EADQ,OAAO,CACf;IAAsB,gCAAgC,AAAtD,CACA,EADQ,OAAO,CACf;IAAsB,8BAA8B,AAApD,CACA,EADQ,OAAO,CACf;CAAA,KAAU,MAAM,GAAC,IAAI,GAAC,gBA4GxB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type LocalObject = LocaleBody;
|
|
2
|
+
export type LocaleHead = {
|
|
3
|
+
locals?: LocalObject;
|
|
4
|
+
switches?: import('./defaultLocaleResolver.js').Switches;
|
|
5
|
+
};
|
|
6
|
+
export type LocaleBody = import('./defaultLocaleResolver.js').RichNestedLocaleStringBodyObject | import('./defaultLocaleResolver.js').RichLocaleStringBodyObject | import('./defaultLocaleResolver.js').PlainLocaleStringBodyObject | import('./defaultLocaleResolver.js').PlainNestedLocaleStringBodyObject | object;
|
|
7
|
+
export type LocaleObject = {
|
|
8
|
+
head?: LocaleHead;
|
|
9
|
+
body: LocaleBody;
|
|
10
|
+
};
|
|
11
|
+
export type MessageStyleCallbackResult = {
|
|
12
|
+
/**
|
|
13
|
+
* Regardless of message style, will contain
|
|
14
|
+
* the string result
|
|
15
|
+
*/
|
|
16
|
+
value: string;
|
|
17
|
+
/**
|
|
18
|
+
* Full info on the localized item
|
|
19
|
+
* (for rich message styles only)
|
|
20
|
+
*/
|
|
21
|
+
info?: import('./defaultLocaleResolver.js').RichLocaleStringSubObject;
|
|
22
|
+
};
|
|
23
|
+
export type MessageStyleCallback = (obj: LocaleObject, key: string) => false | MessageStyleCallbackResult;
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {LocaleBody} LocalObject
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* May also contain language code and direction, translator name and
|
|
29
|
+
* contact, etc., but no defaults currently apply besides reserving `locals`
|
|
30
|
+
* @typedef {object} LocaleHead
|
|
31
|
+
* @property {LocalObject} [locals]
|
|
32
|
+
* @property {import('./defaultLocaleResolver.js').Switches} [switches]
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {import('./defaultLocaleResolver.js').
|
|
36
|
+
* RichNestedLocaleStringBodyObject|
|
|
37
|
+
* import('./defaultLocaleResolver.js').RichLocaleStringBodyObject|
|
|
38
|
+
* import('./defaultLocaleResolver.js').PlainLocaleStringBodyObject|
|
|
39
|
+
* import('./defaultLocaleResolver.js').PlainNestedLocaleStringBodyObject|
|
|
40
|
+
* object
|
|
41
|
+
* } LocaleBody
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {object} LocaleObject
|
|
45
|
+
* @property {LocaleHead} [head]
|
|
46
|
+
* @property {LocaleBody} body
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {object} MessageStyleCallbackResult
|
|
50
|
+
* @property {string} value Regardless of message style, will contain
|
|
51
|
+
* the string result
|
|
52
|
+
* @property {import(
|
|
53
|
+
* './defaultLocaleResolver.js'
|
|
54
|
+
* ).RichLocaleStringSubObject} [info] Full info on the localized item
|
|
55
|
+
* (for rich message styles only)
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* @callback MessageStyleCallback
|
|
59
|
+
* @param {LocaleObject} obj The exact
|
|
60
|
+
* format depends on the `cfg.defaults` of `i18n`
|
|
61
|
+
* @param {string} key
|
|
62
|
+
* @returns {false|MessageStyleCallbackResult} If `false`, will resort to
|
|
63
|
+
* default
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* @param {object} [cfg]
|
|
67
|
+
* @param {"richNested"|"rich"|"plain"|"plainNested"|MessageStyleCallback} [cfg.messageStyle]
|
|
68
|
+
* @returns {MessageStyleCallback}
|
|
69
|
+
*/
|
|
70
|
+
export declare const getMessageForKeyByStyle: ({ messageStyle }?: {
|
|
71
|
+
messageStyle?: "richNested" | "rich" | "plain" | "plainNested" | MessageStyleCallback;
|
|
72
|
+
}) => MessageStyleCallback;
|
|
73
|
+
//# sourceMappingURL=getMessageForKeyByStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMessageForKeyByStyle.d.ts","sourceRoot":"","sources":["../src/getMessageForKeyByStyle.js"],"names":[],"mappings":"AAGG,YAAsB,WAAW,GAAvB,UAAU,CAAa;AAMjC,YAAkB,UAAU,GAC5B;IAAyB,MAAM,AAA/B,CACA,EADW,WAAW,CACtB;IAA2D,QAAQ,AAAnE,CAAoE,EAAzD,OAAO,4BAA4B,EAAE,QAAQ,CAAY;CAAA,CAAA;AAIpE,YAME,UAAU,GANF,OAAO,4BAA4B,EAC3C,gCAAgC,GACpC,OAAW,4BAA4B,EAAE,0BAA0B,GACnE,OAAW,4BAA4B,EAAE,2BAA2B,GACpE,OAAW,4BAA4B,EAAE,iCAAiC,GAC1E,MAAU,CACI;AAIZ,YAAkB,YAAY,GAC9B;IAAwB,IAAI,AAA5B,CACA,EADW,UAAU,CACrB;IAAuB,IAAI,EAAhB,UAAU,CACvB;CAAA,CAAA;AAGE,YAAkB,0BAA0B,GAC5C;;;;;IAAmB,KAAK,EAAb,MAAM,CAEjB;;;;;IAE+B,IAAI,AAFnC,CAIF,EAJa,OACb,4BAA+B,EAC1B,yBAAyB,CAE9B;CAAA,CAAA;AAGE,YAAU,oBAAoB,GAC9B,CAAsB,GAAG,EAAjB,YAER,EAAgB,GAAG,EAAX,MACR,KAAU,KAAK,GAAC,0BAElB,CAAA;AA7CD;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAGH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,sBAHjC;IAA6E,YAAY,AAAzF,CACA,EADQ,YAAY,GAAC,MAAM,GAAC,OAAO,GAAC,aAAa,GAAC,oBAAoB,CACtE;CAAA,KAAU,oBAuLZ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} cfg
|
|
3
|
+
* @param {string|false} [cfg.message] If present, this string will be
|
|
4
|
+
* the return value.
|
|
5
|
+
* @param {false|null|undefined|
|
|
6
|
+
* import('./getMessageForKeyByStyle.js').LocaleObject
|
|
7
|
+
* } [cfg.defaults]
|
|
8
|
+
* @param {"richNested"|"rich"|"plain"|"plainNested"|
|
|
9
|
+
* import('./getMessageForKeyByStyle.js').MessageStyleCallback
|
|
10
|
+
* } [cfg.messageStyle]
|
|
11
|
+
* @param {import('./getMessageForKeyByStyle.js').
|
|
12
|
+
* MessageStyleCallback
|
|
13
|
+
* } [cfg.messageForKey] Defaults to getting `MessageStyleCallback` based
|
|
14
|
+
* on `messageStyle`
|
|
15
|
+
* @param {string} cfg.key Key to check against object of strings;
|
|
16
|
+
* used to find a default if no string `message` is provided.
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
export declare const getStringFromMessageAndDefaults: ({ message, defaults, messageStyle, messageForKey, key }: {
|
|
20
|
+
message?: string | false;
|
|
21
|
+
defaults?: false | null | undefined | import('./getMessageForKeyByStyle.js').LocaleObject;
|
|
22
|
+
messageStyle?: "richNested" | "rich" | "plain" | "plainNested" | import('./getMessageForKeyByStyle.js').MessageStyleCallback;
|
|
23
|
+
messageForKey?: import('./getMessageForKeyByStyle.js').MessageStyleCallback;
|
|
24
|
+
key: string;
|
|
25
|
+
}) => string;
|
|
26
|
+
//# sourceMappingURL=getStringFromMessageAndDefaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStringFromMessageAndDefaults.d.ts","sourceRoot":"","sources":["../src/getStringFromMessageAndDefaults.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,+BAA+B,4DAhBzC;IAA2B,OAAO,AAAlC,CAEA,EAFQ,MAAM,GAAC,KAAK,CAEpB;IAEO,QAAQ,AAFf,CAGA,EAHQ,KAAK,GAAC,IAAI,GAAC,SAAS,GAC9B,OAAW,8BAA8B,EAAE,YAAY,CAErD;IAEO,YAAY,AAFnB,CAGA,EAHQ,YAAY,GAAC,MAAM,GAAC,OAAO,GAAC,aAAa,GACnD,OAAW,8BAA8B,EAAE,oBAAoB,CAE7D;IAEO,aAAa,AAFpB,CAIA,EAJQ,OAAO,8BAA8B,EAC3C,oBAAoB,CAGtB;IAAoB,GAAG,EAAf,MAAM,CAEd;CAAA,KAAU,MAiCZ,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export type Sort = import('./index.js').Sort;
|
|
2
|
+
export type SortList = import('./index.js').SortList;
|
|
3
|
+
export type List = import('./index.js').List;
|
|
4
|
+
export type I18NCallback = import('./index.js').I18NCallback;
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('./index.js').Sort} Sort
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('./index.js').SortList} SortList
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {import('./index.js').List} List
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {import('./index.js').I18NCallback} I18NCallback
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @param {object} cfg
|
|
19
|
+
* @param {import('./getMessageForKeyByStyle.js').LocaleObject} cfg.strings
|
|
20
|
+
* @param {string} cfg.resolvedLocale
|
|
21
|
+
* @param {"richNested"|"rich"|"plain"|"plainNested"|
|
|
22
|
+
* import('./getMessageForKeyByStyle.js').
|
|
23
|
+
* MessageStyleCallback} [cfg.messageStyle]
|
|
24
|
+
* @param {?import('./defaultAllSubstitutions.js').AllSubstitutionCallback|
|
|
25
|
+
* import('./defaultAllSubstitutions.js').
|
|
26
|
+
* AllSubstitutionCallback[]} [cfg.allSubstitutions]
|
|
27
|
+
* @param {import('./defaultInsertNodes.js').
|
|
28
|
+
* InsertNodesCallback} [cfg.insertNodes]
|
|
29
|
+
* @param {import('./defaultKeyCheckerConverter.js').
|
|
30
|
+
* KeyCheckerConverterCallback} [cfg.keyCheckerConverter]
|
|
31
|
+
* @param {false|null|undefined|
|
|
32
|
+
* import('./getMessageForKeyByStyle.js').LocaleObject} [cfg.defaults]
|
|
33
|
+
* @param {false|import('./defaultLocaleResolver.js').
|
|
34
|
+
* SubstitutionObject} [cfg.substitutions]
|
|
35
|
+
* @param {Integer} [cfg.maximumLocalNestingDepth]
|
|
36
|
+
* @param {boolean} [cfg.dom]
|
|
37
|
+
* @param {boolean} [cfg.forceNodeReturn]
|
|
38
|
+
* @param {boolean} [cfg.throwOnMissingSuppliedFormatters]
|
|
39
|
+
* @param {boolean} [cfg.throwOnExtraSuppliedFormatters]
|
|
40
|
+
* @returns {I18NCallback} Rejects if no suitable locale is found.
|
|
41
|
+
*/
|
|
42
|
+
export declare const i18nServer: ({ strings, resolvedLocale, messageStyle, allSubstitutions: defaultAllSubstitutionsValue, insertNodes, keyCheckerConverter, defaults: defaultDefaults, substitutions: defaultSubstitutions, maximumLocalNestingDepth, dom: domDefaults, forceNodeReturn: forceNodeReturnDefault, throwOnMissingSuppliedFormatters: throwOnMissingSuppliedFormattersDefault, throwOnExtraSuppliedFormatters: throwOnExtraSuppliedFormattersDefault }: {
|
|
43
|
+
strings: import('./getMessageForKeyByStyle.js').LocaleObject;
|
|
44
|
+
resolvedLocale: string;
|
|
45
|
+
messageStyle?: "richNested" | "rich" | "plain" | "plainNested" | import('./getMessageForKeyByStyle.js').MessageStyleCallback;
|
|
46
|
+
allSubstitutions?: (import('./defaultAllSubstitutions.js').AllSubstitutionCallback | null) | import('./defaultAllSubstitutions.js').AllSubstitutionCallback[];
|
|
47
|
+
insertNodes?: import('./defaultInsertNodes.js').InsertNodesCallback;
|
|
48
|
+
keyCheckerConverter?: import('./defaultKeyCheckerConverter.js').KeyCheckerConverterCallback;
|
|
49
|
+
defaults?: false | null | undefined | import('./getMessageForKeyByStyle.js').LocaleObject;
|
|
50
|
+
substitutions?: false | import('./defaultLocaleResolver.js').SubstitutionObject;
|
|
51
|
+
maximumLocalNestingDepth?: Integer;
|
|
52
|
+
dom?: boolean;
|
|
53
|
+
forceNodeReturn?: boolean;
|
|
54
|
+
throwOnMissingSuppliedFormatters?: boolean;
|
|
55
|
+
throwOnExtraSuppliedFormatters?: boolean;
|
|
56
|
+
}) => I18NCallback;
|
|
57
|
+
export type Integer = number;
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {number} Integer
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* @param {object} [cfg]
|
|
63
|
+
* @param {string[]} [cfg.locales] BCP-47 language strings
|
|
64
|
+
* @param {string[]} [cfg.defaultLocales]
|
|
65
|
+
* @param {import('./findLocaleStrings.js').
|
|
66
|
+
* LocaleStringFinder} [cfg.localeStringFinder]
|
|
67
|
+
* @param {string} [cfg.localesBasePath]
|
|
68
|
+
* @param {import('./defaultLocaleResolver.js').
|
|
69
|
+
* LocaleResolver} [cfg.localeResolver]
|
|
70
|
+
* @param {"lookup"|import('./findLocaleStrings.js').
|
|
71
|
+
* LocaleMatcher} [cfg.localeMatcher]
|
|
72
|
+
* @param {"richNested"|"rich"|"plain"|"plainNested"|
|
|
73
|
+
* import('./getMessageForKeyByStyle.js').
|
|
74
|
+
* MessageStyleCallback} [cfg.messageStyle]
|
|
75
|
+
* @param {?(import('./defaultAllSubstitutions.js').AllSubstitutionCallback|
|
|
76
|
+
* import('./defaultAllSubstitutions.js').
|
|
77
|
+
* AllSubstitutionCallback[])} [cfg.allSubstitutions]
|
|
78
|
+
* @param {import('./defaultInsertNodes.js').
|
|
79
|
+
* InsertNodesCallback} [cfg.insertNodes]
|
|
80
|
+
* @param {import('./defaultKeyCheckerConverter.js').
|
|
81
|
+
* KeyCheckerConverterCallback} [cfg.keyCheckerConverter]
|
|
82
|
+
* @param {false|null|undefined|
|
|
83
|
+
* import('./getMessageForKeyByStyle.js').LocaleObject} [cfg.defaults]
|
|
84
|
+
* @param {false|
|
|
85
|
+
* import('./defaultLocaleResolver.js').
|
|
86
|
+
* SubstitutionObject} [cfg.substitutions]
|
|
87
|
+
* @param {Integer} [cfg.maximumLocalNestingDepth]
|
|
88
|
+
* @param {boolean} [cfg.dom]
|
|
89
|
+
* @param {boolean} [cfg.forceNodeReturn]
|
|
90
|
+
* @param {boolean} [cfg.throwOnMissingSuppliedFormatters]
|
|
91
|
+
* @param {boolean} [cfg.throwOnExtraSuppliedFormatters]
|
|
92
|
+
* @returns {Promise<I18NCallback>} Rejects if no suitable locale is found.
|
|
93
|
+
*/
|
|
94
|
+
export declare const i18n: ({ locales, defaultLocales, localeStringFinder, localesBasePath, localeResolver, localeMatcher, messageStyle, allSubstitutions, insertNodes, keyCheckerConverter, defaults, substitutions, maximumLocalNestingDepth, dom, forceNodeReturn, throwOnMissingSuppliedFormatters, throwOnExtraSuppliedFormatters }?: {
|
|
95
|
+
locales?: string[];
|
|
96
|
+
defaultLocales?: string[];
|
|
97
|
+
localeStringFinder?: import('./findLocaleStrings.js').LocaleStringFinder;
|
|
98
|
+
localesBasePath?: string;
|
|
99
|
+
localeResolver?: import('./defaultLocaleResolver.js').LocaleResolver;
|
|
100
|
+
localeMatcher?: "lookup" | import('./findLocaleStrings.js').LocaleMatcher;
|
|
101
|
+
messageStyle?: "richNested" | "rich" | "plain" | "plainNested" | import('./getMessageForKeyByStyle.js').MessageStyleCallback;
|
|
102
|
+
allSubstitutions?: (import('./defaultAllSubstitutions.js').AllSubstitutionCallback | import('./defaultAllSubstitutions.js').AllSubstitutionCallback[]) | null;
|
|
103
|
+
insertNodes?: import('./defaultInsertNodes.js').InsertNodesCallback;
|
|
104
|
+
keyCheckerConverter?: import('./defaultKeyCheckerConverter.js').KeyCheckerConverterCallback;
|
|
105
|
+
defaults?: false | null | undefined | import('./getMessageForKeyByStyle.js').LocaleObject;
|
|
106
|
+
substitutions?: false | import('./defaultLocaleResolver.js').SubstitutionObject;
|
|
107
|
+
maximumLocalNestingDepth?: Integer;
|
|
108
|
+
dom?: boolean;
|
|
109
|
+
forceNodeReturn?: boolean;
|
|
110
|
+
throwOnMissingSuppliedFormatters?: boolean;
|
|
111
|
+
throwOnExtraSuppliedFormatters?: boolean;
|
|
112
|
+
}) => Promise<I18NCallback>;
|
|
113
|
+
//# sourceMappingURL=i18n.d.ts.map
|