@sharpee/lang-en-us 2.0.0 → 2.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/actions/about.d.ts +1 -0
- package/actions/about.d.ts.map +1 -1
- package/actions/about.js +7 -0
- package/actions/about.js.map +1 -1
- package/actions/help.d.ts +3 -3
- package/actions/help.d.ts.map +1 -1
- package/actions/help.js +8 -6
- package/actions/help.js.map +1 -1
- package/actions/index.d.ts +5 -3
- package/actions/index.d.ts.map +1 -1
- package/actions/reading.d.ts.map +1 -1
- package/actions/reading.js +3 -1
- package/actions/reading.js.map +1 -1
- package/actions/taking.d.ts +1 -0
- package/actions/taking.d.ts.map +1 -1
- package/actions/taking.js +2 -0
- package/actions/taking.js.map +1 -1
- package/language-provider.d.ts +6 -0
- package/language-provider.d.ts.map +1 -1
- package/language-provider.js +13 -0
- package/language-provider.js.map +1 -1
- package/package.json +3 -3
- package/platform-messages.d.ts +26 -0
- package/platform-messages.d.ts.map +1 -0
- package/platform-messages.js +31 -0
- package/platform-messages.js.map +1 -0
- package/formatters/article.d.ts +0 -41
- package/formatters/article.d.ts.map +0 -1
- package/formatters/article.js +0 -143
- package/formatters/article.js.map +0 -1
- package/formatters/index.d.ts +0 -19
- package/formatters/index.d.ts.map +0 -1
- package/formatters/index.js +0 -42
- package/formatters/index.js.map +0 -1
- package/formatters/list.d.ts +0 -56
- package/formatters/list.d.ts.map +0 -1
- package/formatters/list.js +0 -178
- package/formatters/list.js.map +0 -1
- package/formatters/registry.d.ts +0 -49
- package/formatters/registry.d.ts.map +0 -1
- package/formatters/registry.js +0 -136
- package/formatters/registry.js.map +0 -1
- package/formatters/text.d.ts +0 -33
- package/formatters/text.d.ts.map +0 -1
- package/formatters/text.js +0 -80
- package/formatters/text.js.map +0 -1
- package/formatters/types.d.ts +0 -52
- package/formatters/types.d.ts.map +0 -1
- package/formatters/types.js +0 -14
- package/formatters/types.js.map +0 -1
- package/formatters/verb.d.ts +0 -30
- package/formatters/verb.d.ts.map +0 -1
- package/formatters/verb.js +0 -59
- package/formatters/verb.js.map +0 -1
package/formatters/types.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatter Types
|
|
3
|
-
*
|
|
4
|
-
* Formatters transform placeholder values in message templates.
|
|
5
|
-
*
|
|
6
|
-
* Syntax: {formatter:formatter:...:placeholder} (the placeholder is the last segment)
|
|
7
|
-
* Example: {a:item} → "a sword"
|
|
8
|
-
* Example: {list:items} → "a sword, a key, and a coin"
|
|
9
|
-
*
|
|
10
|
-
* @see ADR-095 Message Templates with Formatters
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Context passed to formatters
|
|
14
|
-
*/
|
|
15
|
-
export interface FormatterContext {
|
|
16
|
-
/** Get entity by ID for nounType/article lookup */
|
|
17
|
-
getEntity?: (id: string) => EntityInfo | undefined;
|
|
18
|
-
/** Render-time settings the language layer reads (ADR-190). */
|
|
19
|
-
settings?: {
|
|
20
|
-
/** Serial (Oxford) comma in lists. Default true when absent. */
|
|
21
|
-
serialComma?: boolean;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Minimal entity info for formatting
|
|
26
|
-
*/
|
|
27
|
-
export interface EntityInfo {
|
|
28
|
-
name: string;
|
|
29
|
-
nounType?: 'common' | 'proper' | 'mass' | 'unique' | 'plural';
|
|
30
|
-
properName?: boolean;
|
|
31
|
-
article?: string;
|
|
32
|
-
grammaticalNumber?: 'singular' | 'plural';
|
|
33
|
-
/**
|
|
34
|
-
* Author-supplied plural form for irregular nouns (ADR-190). Populated from
|
|
35
|
-
* `IdentityTrait.plural` by `entityInfoFrom`. The `list`/`count` formatters use
|
|
36
|
-
* it when present, else fall back to the `pluralize()` heuristic.
|
|
37
|
-
*/
|
|
38
|
-
plural?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Formatter function signature
|
|
42
|
-
*
|
|
43
|
-
* @param value - The value to format (string, array, or EntityInfo)
|
|
44
|
-
* @param context - Formatting context with entity lookup
|
|
45
|
-
* @returns Formatted string
|
|
46
|
-
*/
|
|
47
|
-
export type Formatter = (value: string | string[] | EntityInfo | EntityInfo[], context: FormatterContext) => string;
|
|
48
|
-
/**
|
|
49
|
-
* Formatter registry - maps formatter names to functions
|
|
50
|
-
*/
|
|
51
|
-
export type FormatterRegistry = Map<string, Formatter>;
|
|
52
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IACnD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE;QACT,gEAAgE;QAChE,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,UAAU,EAAE,EACpD,OAAO,EAAE,gBAAgB,KACtB,MAAM,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
package/formatters/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Formatter Types
|
|
4
|
-
*
|
|
5
|
-
* Formatters transform placeholder values in message templates.
|
|
6
|
-
*
|
|
7
|
-
* Syntax: {formatter:formatter:...:placeholder} (the placeholder is the last segment)
|
|
8
|
-
* Example: {a:item} → "a sword"
|
|
9
|
-
* Example: {list:items} → "a sword, a key, and a coin"
|
|
10
|
-
*
|
|
11
|
-
* @see ADR-095 Message Templates with Formatters
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
//# sourceMappingURL=types.js.map
|
package/formatters/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG"}
|
package/formatters/verb.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verb-Agreement Formatters
|
|
3
|
-
*
|
|
4
|
-
* Formatters that emit a verb form agreeing in number with the entity they
|
|
5
|
-
* are keyed to, so templates need not hardcode a singular verb. The verb is
|
|
6
|
-
* chosen from the entity's grammatical number, mirroring how the article
|
|
7
|
-
* formatters choose articles from `nounType`.
|
|
8
|
-
*
|
|
9
|
-
* Syntax keys the formatter to a placeholder, e.g. `{is:item}` resolves the
|
|
10
|
-
* `item` value and emits the agreeing copula:
|
|
11
|
-
*
|
|
12
|
-
* "{the:cap:item} {is:item} fixed in place."
|
|
13
|
-
* → "The white house is fixed in place." (singular)
|
|
14
|
-
* → "The pygmy goats are fixed in place." (plural)
|
|
15
|
-
*
|
|
16
|
-
* An entity is treated as plural when its `nounType` is `'plural'` or its
|
|
17
|
-
* `grammaticalNumber` is `'plural'`. A bare string (no EntityInfo metadata)
|
|
18
|
-
* or a missing value falls back to the singular form.
|
|
19
|
-
*
|
|
20
|
-
* @see ADR-095 Message Templates with Formatters
|
|
21
|
-
* @see ADR-089 Grammatical Number
|
|
22
|
-
*/
|
|
23
|
-
import type { Formatter } from './types.js';
|
|
24
|
-
/** "is" formatter — emits "is" (singular) or "are" (plural). */
|
|
25
|
-
export declare const isFormatter: Formatter;
|
|
26
|
-
/** "was" formatter — emits "was" (singular) or "were" (plural). */
|
|
27
|
-
export declare const wasFormatter: Formatter;
|
|
28
|
-
/** "has" formatter — emits "has" (singular) or "have" (plural). */
|
|
29
|
-
export declare const hasFormatter: Formatter;
|
|
30
|
-
//# sourceMappingURL=verb.d.ts.map
|
package/formatters/verb.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verb.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/verb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AA+BxD,gEAAgE;AAChE,eAAO,MAAM,WAAW,EAAE,SAA+C,CAAC;AAE1E,mEAAmE;AACnE,eAAO,MAAM,YAAY,EAAE,SAAiD,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,YAAY,EAAE,SAAiD,CAAC"}
|
package/formatters/verb.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Verb-Agreement Formatters
|
|
4
|
-
*
|
|
5
|
-
* Formatters that emit a verb form agreeing in number with the entity they
|
|
6
|
-
* are keyed to, so templates need not hardcode a singular verb. The verb is
|
|
7
|
-
* chosen from the entity's grammatical number, mirroring how the article
|
|
8
|
-
* formatters choose articles from `nounType`.
|
|
9
|
-
*
|
|
10
|
-
* Syntax keys the formatter to a placeholder, e.g. `{is:item}` resolves the
|
|
11
|
-
* `item` value and emits the agreeing copula:
|
|
12
|
-
*
|
|
13
|
-
* "{the:cap:item} {is:item} fixed in place."
|
|
14
|
-
* → "The white house is fixed in place." (singular)
|
|
15
|
-
* → "The pygmy goats are fixed in place." (plural)
|
|
16
|
-
*
|
|
17
|
-
* An entity is treated as plural when its `nounType` is `'plural'` or its
|
|
18
|
-
* `grammaticalNumber` is `'plural'`. A bare string (no EntityInfo metadata)
|
|
19
|
-
* or a missing value falls back to the singular form.
|
|
20
|
-
*
|
|
21
|
-
* @see ADR-095 Message Templates with Formatters
|
|
22
|
-
* @see ADR-089 Grammatical Number
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.hasFormatter = exports.wasFormatter = exports.isFormatter = void 0;
|
|
26
|
-
/**
|
|
27
|
-
* Decide whether a formatter value should take a plural verb.
|
|
28
|
-
*
|
|
29
|
-
* @param value - The placeholder value (EntityInfo, string, or array thereof).
|
|
30
|
-
* @returns true when the value is grammatically plural.
|
|
31
|
-
*/
|
|
32
|
-
function isPlural(value) {
|
|
33
|
-
// An array of values reads as plural unless it holds exactly one item.
|
|
34
|
-
if (Array.isArray(value)) {
|
|
35
|
-
return value.length !== 1;
|
|
36
|
-
}
|
|
37
|
-
if (typeof value === 'string') {
|
|
38
|
-
return false; // No metadata on a bare string — default to singular.
|
|
39
|
-
}
|
|
40
|
-
return value.nounType === 'plural' || value.grammaticalNumber === 'plural';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Build a copula/auxiliary formatter that emits `singular` or `plural`
|
|
44
|
-
* depending on the value's grammatical number.
|
|
45
|
-
*
|
|
46
|
-
* @param singular - Verb form for singular subjects (e.g. "is").
|
|
47
|
-
* @param plural - Verb form for plural subjects (e.g. "are").
|
|
48
|
-
* @returns A Formatter that returns the agreeing form.
|
|
49
|
-
*/
|
|
50
|
-
function makeAgreementFormatter(singular, plural) {
|
|
51
|
-
return (value, _context) => (isPlural(value) ? plural : singular);
|
|
52
|
-
}
|
|
53
|
-
/** "is" formatter — emits "is" (singular) or "are" (plural). */
|
|
54
|
-
exports.isFormatter = makeAgreementFormatter('is', 'are');
|
|
55
|
-
/** "was" formatter — emits "was" (singular) or "were" (plural). */
|
|
56
|
-
exports.wasFormatter = makeAgreementFormatter('was', 'were');
|
|
57
|
-
/** "has" formatter — emits "has" (singular) or "have" (plural). */
|
|
58
|
-
exports.hasFormatter = makeAgreementFormatter('has', 'have');
|
|
59
|
-
//# sourceMappingURL=verb.js.map
|
package/formatters/verb.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verb.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/verb.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAIH;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoD;IACpE,uEAAuE;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,sDAAsD;IACtE,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,iBAAiB,KAAK,QAAQ,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,QAAgB,EAAE,MAAc;IAC9D,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACpE,CAAC;AAED,gEAAgE;AACnD,QAAA,WAAW,GAAc,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAE1E,mEAAmE;AACtD,QAAA,YAAY,GAAc,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE7E,mEAAmE;AACtD,QAAA,YAAY,GAAc,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC"}
|