saykit 0.7.0 → 0.8.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 +1 -1
- package/dist/runtime.d.mts +23 -13
- package/dist/runtime.mjs +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/runtime.d.mts
CHANGED
|
@@ -11,18 +11,25 @@ type Awaitable<T> = T | PromiseLike<T>;
|
|
|
11
11
|
type Named<T> = {
|
|
12
12
|
[name: string]: T;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Branches of a choice, keyed by CLDR category or by exact number.
|
|
16
|
+
*
|
|
17
|
+
* `Branch` is what a case may be written as. It is text everywhere the message
|
|
18
|
+
* is text, and widens in JSX, where a case that shows the number has to be a
|
|
19
|
+
* fragment — a string attribute has nowhere to put a value.
|
|
20
|
+
*/
|
|
21
|
+
interface NumeralOptions<Branch = string> extends Omit<Partial<Record<Intl.LDMLPluralRule, Branch>>, 'other'> {
|
|
22
|
+
other: Branch;
|
|
23
|
+
[digit: number]: Branch;
|
|
17
24
|
/**
|
|
18
25
|
* Subtracted from the value before `#` is formatted, so "You and 2 others"
|
|
19
26
|
* can select on a total of three. Reserved — it never names a branch.
|
|
20
27
|
*/
|
|
21
28
|
offset?: number;
|
|
22
29
|
}
|
|
23
|
-
interface SelectOptions {
|
|
24
|
-
other:
|
|
25
|
-
[match: string | number]:
|
|
30
|
+
interface SelectOptions<Branch = string> {
|
|
31
|
+
other: Branch;
|
|
32
|
+
[match: string | number]: Branch;
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
28
35
|
* Formatting for a `{arg, number}` placeholder.
|
|
@@ -188,11 +195,12 @@ declare class Say<Locale extends string = string, Loader extends Say.Loader<Loca
|
|
|
188
195
|
* ```ts
|
|
189
196
|
* say.plural(count, {
|
|
190
197
|
* one: 'You have 1 item',
|
|
191
|
-
* other:
|
|
198
|
+
* other: `You have ${count} items`,
|
|
192
199
|
* })
|
|
193
200
|
* ```
|
|
194
201
|
*
|
|
195
|
-
*
|
|
202
|
+
* Interpolating the selector into a branch extracts as ICU's `#`, the number
|
|
203
|
+
* the message branched on. A `#` you write yourself is text.
|
|
196
204
|
* @param _ Number to determine the plural form of
|
|
197
205
|
* @param options Pluralisation rules keyed by CLDR categories or specific numbers
|
|
198
206
|
* @returns The plural form of the number
|
|
@@ -201,15 +209,17 @@ declare class Say<Locale extends string = string, Loader extends Say.Loader<Loca
|
|
|
201
209
|
plural(_: number | Named<number>, options: Disallow<NumeralOptions, 'id' | 'context'>): string;
|
|
202
210
|
/**
|
|
203
211
|
* Define an ordinal message (e.g. "1st", "2nd", "3rd").
|
|
204
|
-
*
|
|
212
|
+
*
|
|
213
|
+
* Interpolating the selector into a branch extracts as ICU's `#`, the number
|
|
214
|
+
* the message branched on. A `#` you write yourself is text.
|
|
205
215
|
*
|
|
206
216
|
* @example
|
|
207
217
|
* ```ts
|
|
208
218
|
* say.ordinal(position, {
|
|
209
|
-
* 1:
|
|
210
|
-
* 2:
|
|
211
|
-
* 3:
|
|
212
|
-
* other:
|
|
219
|
+
* 1: `${position}st`,
|
|
220
|
+
* 2: `${position}nd`,
|
|
221
|
+
* 3: `${position}rd`,
|
|
222
|
+
* other: `${position}th`,
|
|
213
223
|
* })
|
|
214
224
|
* ```
|
|
215
225
|
*
|
package/dist/runtime.mjs
CHANGED
|
@@ -203,11 +203,12 @@ var Say = class Say {
|
|
|
203
203
|
* ```ts
|
|
204
204
|
* say.plural(count, {
|
|
205
205
|
* one: 'You have 1 item',
|
|
206
|
-
* other:
|
|
206
|
+
* other: `You have ${count} items`,
|
|
207
207
|
* })
|
|
208
208
|
* ```
|
|
209
209
|
*
|
|
210
|
-
*
|
|
210
|
+
* Interpolating the selector into a branch extracts as ICU's `#`, the number
|
|
211
|
+
* the message branched on. A `#` you write yourself is text.
|
|
211
212
|
* @param _ Number to determine the plural form of
|
|
212
213
|
* @param options Pluralisation rules keyed by CLDR categories or specific numbers
|
|
213
214
|
* @returns The plural form of the number
|
|
@@ -218,15 +219,17 @@ var Say = class Say {
|
|
|
218
219
|
}
|
|
219
220
|
/**
|
|
220
221
|
* Define an ordinal message (e.g. "1st", "2nd", "3rd").
|
|
221
|
-
*
|
|
222
|
+
*
|
|
223
|
+
* Interpolating the selector into a branch extracts as ICU's `#`, the number
|
|
224
|
+
* the message branched on. A `#` you write yourself is text.
|
|
222
225
|
*
|
|
223
226
|
* @example
|
|
224
227
|
* ```ts
|
|
225
228
|
* say.ordinal(position, {
|
|
226
|
-
* 1:
|
|
227
|
-
* 2:
|
|
228
|
-
* 3:
|
|
229
|
-
* other:
|
|
229
|
+
* 1: `${position}st`,
|
|
230
|
+
* 2: `${position}nd`,
|
|
231
|
+
* 3: `${position}rd`,
|
|
232
|
+
* other: `${position}th`,
|
|
230
233
|
* })
|
|
231
234
|
* ```
|
|
232
235
|
*
|