@concordance-wiki/i18n 0.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 +674 -0
- package/README.md +54 -0
- package/dist/messages/en/about.json +102 -0
- package/dist/messages/en/age.json +34 -0
- package/dist/messages/en/api.json +86 -0
- package/dist/messages/en/category.json +58 -0
- package/dist/messages/en/decision.json +62 -0
- package/dist/messages/en/document.json +150 -0
- package/dist/messages/en/drawer.json +6 -0
- package/dist/messages/en/entity.json +170 -0
- package/dist/messages/en/footer.json +82 -0
- package/dist/messages/en/home.json +78 -0
- package/dist/messages/en/index.json +70 -0
- package/dist/messages/en/keyword.json +98 -0
- package/dist/messages/en/meeting.json +94 -0
- package/dist/messages/en/mentions.json +10 -0
- package/dist/messages/en/nav.json +18 -0
- package/dist/messages/en/neighbourhood.json +50 -0
- package/dist/messages/en/notfound.json +30 -0
- package/dist/messages/en/panels.json +10 -0
- package/dist/messages/en/pins.json +46 -0
- package/dist/messages/en/related.json +70 -0
- package/dist/messages/en/results.json +70 -0
- package/dist/messages/en/search.json +58 -0
- package/dist/messages/en/site.json +46 -0
- package/dist/messages/en/space.json +38 -0
- package/dist/messages/en/spaces.json +30 -0
- package/dist/messages/en/time.json +6 -0
- package/dist/messages/en/todo.json +50 -0
- package/dist/messages/en/transcript.json +10 -0
- package/dist/messages/en.json +1066 -0
- package/dist/messages/fr/about.json +27 -0
- package/dist/messages/fr/age.json +10 -0
- package/dist/messages/fr/api.json +23 -0
- package/dist/messages/fr/category.json +16 -0
- package/dist/messages/fr/decision.json +17 -0
- package/dist/messages/fr/document.json +39 -0
- package/dist/messages/fr/drawer.json +3 -0
- package/dist/messages/fr/entity.json +44 -0
- package/dist/messages/fr/footer.json +22 -0
- package/dist/messages/fr/home.json +21 -0
- package/dist/messages/fr/index.json +19 -0
- package/dist/messages/fr/keyword.json +26 -0
- package/dist/messages/fr/meeting.json +25 -0
- package/dist/messages/fr/mentions.json +4 -0
- package/dist/messages/fr/nav.json +6 -0
- package/dist/messages/fr/neighbourhood.json +14 -0
- package/dist/messages/fr/notfound.json +9 -0
- package/dist/messages/fr/panels.json +4 -0
- package/dist/messages/fr/pins.json +13 -0
- package/dist/messages/fr/related.json +19 -0
- package/dist/messages/fr/results.json +19 -0
- package/dist/messages/fr/search.json +16 -0
- package/dist/messages/fr/site.json +13 -0
- package/dist/messages/fr/space.json +11 -0
- package/dist/messages/fr/spaces.json +9 -0
- package/dist/messages/fr/time.json +3 -0
- package/dist/messages/fr/todo.json +14 -0
- package/dist/messages/fr/transcript.json +4 -0
- package/dist/messages/fr.json +268 -0
- package/dist/src/area.d.ts +17 -0
- package/dist/src/area.d.ts.map +1 -0
- package/dist/src/area.js +2 -0
- package/dist/src/area.js.map +1 -0
- package/dist/src/areas/about.d.ts +166 -0
- package/dist/src/areas/about.d.ts.map +1 -0
- package/dist/src/areas/about.js +34 -0
- package/dist/src/areas/about.js.map +1 -0
- package/dist/src/areas/age.d.ts +61 -0
- package/dist/src/areas/age.d.ts.map +1 -0
- package/dist/src/areas/age.js +17 -0
- package/dist/src/areas/age.js.map +1 -0
- package/dist/src/areas/api.d.ts +139 -0
- package/dist/src/areas/api.d.ts.map +1 -0
- package/dist/src/areas/api.js +30 -0
- package/dist/src/areas/api.js.map +1 -0
- package/dist/src/areas/category.d.ts +106 -0
- package/dist/src/areas/category.d.ts.map +1 -0
- package/dist/src/areas/category.js +23 -0
- package/dist/src/areas/category.js.map +1 -0
- package/dist/src/areas/decision.d.ts +105 -0
- package/dist/src/areas/decision.d.ts.map +1 -0
- package/dist/src/areas/decision.js +24 -0
- package/dist/src/areas/decision.js.map +1 -0
- package/dist/src/areas/document.d.ts +235 -0
- package/dist/src/areas/document.d.ts.map +1 -0
- package/dist/src/areas/document.js +46 -0
- package/dist/src/areas/document.js.map +1 -0
- package/dist/src/areas/drawer.d.ts +15 -0
- package/dist/src/areas/drawer.d.ts.map +1 -0
- package/dist/src/areas/drawer.js +10 -0
- package/dist/src/areas/drawer.js.map +1 -0
- package/dist/src/areas/entity.d.ts +288 -0
- package/dist/src/areas/entity.d.ts.map +1 -0
- package/dist/src/areas/entity.js +51 -0
- package/dist/src/areas/entity.js.map +1 -0
- package/dist/src/areas/footer.d.ts +143 -0
- package/dist/src/areas/footer.d.ts.map +1 -0
- package/dist/src/areas/footer.js +29 -0
- package/dist/src/areas/footer.js.map +1 -0
- package/dist/src/areas/home.d.ts +142 -0
- package/dist/src/areas/home.d.ts.map +1 -0
- package/dist/src/areas/home.js +28 -0
- package/dist/src/areas/home.js.map +1 -0
- package/dist/src/areas/index.d.ts +121 -0
- package/dist/src/areas/index.d.ts.map +1 -0
- package/dist/src/areas/index.js +26 -0
- package/dist/src/areas/index.js.map +1 -0
- package/dist/src/areas/keyword.d.ts +169 -0
- package/dist/src/areas/keyword.d.ts.map +1 -0
- package/dist/src/areas/keyword.js +33 -0
- package/dist/src/areas/keyword.js.map +1 -0
- package/dist/src/areas/meeting.d.ts +157 -0
- package/dist/src/areas/meeting.d.ts.map +1 -0
- package/dist/src/areas/meeting.js +32 -0
- package/dist/src/areas/meeting.js.map +1 -0
- package/dist/src/areas/mentions.d.ts +25 -0
- package/dist/src/areas/mentions.d.ts.map +1 -0
- package/dist/src/areas/mentions.js +11 -0
- package/dist/src/areas/mentions.js.map +1 -0
- package/dist/src/areas/nav.d.ts +33 -0
- package/dist/src/areas/nav.d.ts.map +1 -0
- package/dist/src/areas/nav.js +13 -0
- package/dist/src/areas/nav.js.map +1 -0
- package/dist/src/areas/neighbourhood.d.ts +87 -0
- package/dist/src/areas/neighbourhood.d.ts.map +1 -0
- package/dist/src/areas/neighbourhood.js +21 -0
- package/dist/src/areas/neighbourhood.js.map +1 -0
- package/dist/src/areas/notfound.d.ts +51 -0
- package/dist/src/areas/notfound.d.ts.map +1 -0
- package/dist/src/areas/notfound.js +16 -0
- package/dist/src/areas/notfound.js.map +1 -0
- package/dist/src/areas/panels.d.ts +21 -0
- package/dist/src/areas/panels.d.ts.map +1 -0
- package/dist/src/areas/panels.js +11 -0
- package/dist/src/areas/panels.js.map +1 -0
- package/dist/src/areas/pins.d.ts +75 -0
- package/dist/src/areas/pins.d.ts.map +1 -0
- package/dist/src/areas/pins.js +20 -0
- package/dist/src/areas/pins.js.map +1 -0
- package/dist/src/areas/related.d.ts +111 -0
- package/dist/src/areas/related.d.ts.map +1 -0
- package/dist/src/areas/related.js +26 -0
- package/dist/src/areas/related.js.map +1 -0
- package/dist/src/areas/results.d.ts +119 -0
- package/dist/src/areas/results.d.ts.map +1 -0
- package/dist/src/areas/results.js +26 -0
- package/dist/src/areas/results.js.map +1 -0
- package/dist/src/areas/search.d.ts +95 -0
- package/dist/src/areas/search.d.ts.map +1 -0
- package/dist/src/areas/search.js +23 -0
- package/dist/src/areas/search.js.map +1 -0
- package/dist/src/areas/site.d.ts +77 -0
- package/dist/src/areas/site.d.ts.map +1 -0
- package/dist/src/areas/site.js +20 -0
- package/dist/src/areas/site.js.map +1 -0
- package/dist/src/areas/space.d.ts +67 -0
- package/dist/src/areas/space.d.ts.map +1 -0
- package/dist/src/areas/space.js +18 -0
- package/dist/src/areas/space.js.map +1 -0
- package/dist/src/areas/spaces.d.ts +55 -0
- package/dist/src/areas/spaces.d.ts.map +1 -0
- package/dist/src/areas/spaces.js +16 -0
- package/dist/src/areas/spaces.js.map +1 -0
- package/dist/src/areas/time.d.ts +17 -0
- package/dist/src/areas/time.d.ts.map +1 -0
- package/dist/src/areas/time.js +10 -0
- package/dist/src/areas/time.js.map +1 -0
- package/dist/src/areas/todo.d.ts +89 -0
- package/dist/src/areas/todo.d.ts.map +1 -0
- package/dist/src/areas/todo.js +21 -0
- package/dist/src/areas/todo.js.map +1 -0
- package/dist/src/areas/transcript.d.ts +21 -0
- package/dist/src/areas/transcript.d.ts.map +1 -0
- package/dist/src/areas/transcript.js +11 -0
- package/dist/src/areas/transcript.js.map +1 -0
- package/dist/src/areas.d.ts +2737 -0
- package/dist/src/areas.d.ts.map +1 -0
- package/dist/src/areas.js +60 -0
- package/dist/src/areas.js.map +1 -0
- package/dist/src/arguments.d.ts +15 -0
- package/dist/src/arguments.d.ts.map +1 -0
- package/dist/src/arguments.js +43 -0
- package/dist/src/arguments.js.map +1 -0
- package/dist/src/catalogue.d.ts +42 -0
- package/dist/src/catalogue.d.ts.map +1 -0
- package/dist/src/catalogue.js +94 -0
- package/dist/src/catalogue.js.map +1 -0
- package/dist/src/ids.d.ts +44 -0
- package/dist/src/ids.d.ts.map +1 -0
- package/dist/src/ids.js +34 -0
- package/dist/src/ids.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/intl.d.ts +35 -0
- package/dist/src/intl.d.ts.map +1 -0
- package/dist/src/intl.js +87 -0
- package/dist/src/intl.js.map +1 -0
- package/dist/src/labels.d.ts +8 -0
- package/dist/src/labels.d.ts.map +1 -0
- package/dist/src/labels.js +86 -0
- package/dist/src/labels.js.map +1 -0
- package/dist/src/shipped.d.ts +7 -0
- package/dist/src/shipped.d.ts.map +1 -0
- package/dist/src/shipped.js +10 -0
- package/dist/src/shipped.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areas.d.ts","sourceRoot":"","sources":["../../src/areas.ts"],"names":[],"mappings":"AA6BA,6FAA6F;AAC7F,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BR,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { aboutMessages } from "./areas/about.js";
|
|
2
|
+
import { ageMessages } from "./areas/age.js";
|
|
3
|
+
import { apiMessages } from "./areas/api.js";
|
|
4
|
+
import { categoryMessages } from "./areas/category.js";
|
|
5
|
+
import { decisionMessages } from "./areas/decision.js";
|
|
6
|
+
import { documentMessages } from "./areas/document.js";
|
|
7
|
+
import { drawerMessages } from "./areas/drawer.js";
|
|
8
|
+
import { entityMessages } from "./areas/entity.js";
|
|
9
|
+
import { footerMessages } from "./areas/footer.js";
|
|
10
|
+
import { homeMessages } from "./areas/home.js";
|
|
11
|
+
import { indexMessages } from "./areas/index.js";
|
|
12
|
+
import { keywordMessages } from "./areas/keyword.js";
|
|
13
|
+
import { meetingMessages } from "./areas/meeting.js";
|
|
14
|
+
import { mentionsMessages } from "./areas/mentions.js";
|
|
15
|
+
import { navMessages } from "./areas/nav.js";
|
|
16
|
+
import { neighbourhoodMessages } from "./areas/neighbourhood.js";
|
|
17
|
+
import { notfoundMessages } from "./areas/notfound.js";
|
|
18
|
+
import { panelsMessages } from "./areas/panels.js";
|
|
19
|
+
import { pinsMessages } from "./areas/pins.js";
|
|
20
|
+
import { relatedMessages } from "./areas/related.js";
|
|
21
|
+
import { resultsMessages } from "./areas/results.js";
|
|
22
|
+
import { searchMessages } from "./areas/search.js";
|
|
23
|
+
import { siteMessages } from "./areas/site.js";
|
|
24
|
+
import { spaceMessages } from "./areas/space.js";
|
|
25
|
+
import { spacesMessages } from "./areas/spaces.js";
|
|
26
|
+
import { timeMessages } from "./areas/time.js";
|
|
27
|
+
import { todoMessages } from "./areas/todo.js";
|
|
28
|
+
import { transcriptMessages } from "./areas/transcript.js";
|
|
29
|
+
/** Every area of the catalogues, one per identifier prefix, in the order of the prefixes. */
|
|
30
|
+
export const AREAS = [
|
|
31
|
+
aboutMessages,
|
|
32
|
+
ageMessages,
|
|
33
|
+
apiMessages,
|
|
34
|
+
categoryMessages,
|
|
35
|
+
decisionMessages,
|
|
36
|
+
documentMessages,
|
|
37
|
+
drawerMessages,
|
|
38
|
+
entityMessages,
|
|
39
|
+
footerMessages,
|
|
40
|
+
homeMessages,
|
|
41
|
+
indexMessages,
|
|
42
|
+
keywordMessages,
|
|
43
|
+
meetingMessages,
|
|
44
|
+
mentionsMessages,
|
|
45
|
+
navMessages,
|
|
46
|
+
neighbourhoodMessages,
|
|
47
|
+
notfoundMessages,
|
|
48
|
+
panelsMessages,
|
|
49
|
+
pinsMessages,
|
|
50
|
+
relatedMessages,
|
|
51
|
+
resultsMessages,
|
|
52
|
+
searchMessages,
|
|
53
|
+
siteMessages,
|
|
54
|
+
spaceMessages,
|
|
55
|
+
spacesMessages,
|
|
56
|
+
timeMessages,
|
|
57
|
+
todoMessages,
|
|
58
|
+
transcriptMessages,
|
|
59
|
+
];
|
|
60
|
+
//# sourceMappingURL=areas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areas.js","sourceRoot":"","sources":["../../src/areas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,W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,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,6FAA6F;AAC7F,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,aAAa;IACb,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,qBAAqB;IACrB,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,eAAe;IACf,eAAe;IACf,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,kBAAkB;CACV,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MessageFormatElement } from "@formatjs/icu-messageformat-parser";
|
|
2
|
+
/** The ICU argument kinds a message can declare; a tag counts as an argument because it needs a formatting function. */
|
|
3
|
+
export type ArgumentKind = "argument" | "number" | "date" | "time" | "select" | "plural" | "tag";
|
|
4
|
+
export type ParsedMessage = {
|
|
5
|
+
ok: true;
|
|
6
|
+
elements: MessageFormatElement[];
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function describeSyntaxError(error: unknown): string;
|
|
12
|
+
export declare function parseMessage(message: string): ParsedMessage;
|
|
13
|
+
/** The arguments of a parsed message, by name in sorted order; the first kind wins when a name is reused. */
|
|
14
|
+
export declare function argumentsOf(elements: MessageFormatElement[]): ReadonlyMap<string, ArgumentKind>;
|
|
15
|
+
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../../src/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,wHAAwH;AACxH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEjG,MAAM,MAAM,aAAa,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE1D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAM3D;AAwBD,6GAA6G;AAC7G,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAI/F"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { parse, TYPE } from "@formatjs/icu-messageformat-parser";
|
|
2
|
+
export function describeSyntaxError(error) {
|
|
3
|
+
return error instanceof Error ? error.message : String(error);
|
|
4
|
+
}
|
|
5
|
+
export function parseMessage(message) {
|
|
6
|
+
try {
|
|
7
|
+
return { ok: true, elements: parse(message) };
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
return { ok: false, reason: describeSyntaxError(error) };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const kinds = {
|
|
14
|
+
[TYPE.argument]: "argument",
|
|
15
|
+
[TYPE.number]: "number",
|
|
16
|
+
[TYPE.date]: "date",
|
|
17
|
+
[TYPE.time]: "time",
|
|
18
|
+
[TYPE.select]: "select",
|
|
19
|
+
[TYPE.plural]: "plural",
|
|
20
|
+
[TYPE.tag]: "tag",
|
|
21
|
+
};
|
|
22
|
+
function collect(elements, into) {
|
|
23
|
+
for (const element of elements) {
|
|
24
|
+
if (element.type === TYPE.literal || element.type === TYPE.pound)
|
|
25
|
+
continue;
|
|
26
|
+
if (!into.has(element.value))
|
|
27
|
+
into.set(element.value, kinds[element.type]);
|
|
28
|
+
if (element.type === TYPE.select || element.type === TYPE.plural) {
|
|
29
|
+
for (const option of Object.values(element.options))
|
|
30
|
+
collect(option.value, into);
|
|
31
|
+
}
|
|
32
|
+
else if (element.type === TYPE.tag) {
|
|
33
|
+
collect(element.children, into);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** The arguments of a parsed message, by name in sorted order; the first kind wins when a name is reused. */
|
|
38
|
+
export function argumentsOf(elements) {
|
|
39
|
+
const found = new Map();
|
|
40
|
+
collect(elements, found);
|
|
41
|
+
return new Map([...found].sort(([a], [b]) => (a < b ? -1 : 1)));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../src/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAA6B,MAAM,oCAAoC,CAAC;AAQ5F,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,MAAM,KAAK,GAAmE;IAC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AAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzB,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ConfigIssue, Locale } from "@concordance-wiki/core";
|
|
2
|
+
import { type PrimitiveType } from "intl-messageformat";
|
|
3
|
+
import type { MessageArguments, MessageId } from "./ids.js";
|
|
4
|
+
/** Label overrides by language, the shape of `labels` in `theme.yaml`. */
|
|
5
|
+
export type ThemeLabels = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
6
|
+
export interface CatalogueOptions {
|
|
7
|
+
/** The `labels` block of the theme; only the block of the catalogue's language applies. */
|
|
8
|
+
labels?: ThemeLabels;
|
|
9
|
+
/** Time zone of the dates formatted inside messages; UTC keeps builds reproducible. */
|
|
10
|
+
timeZone?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Catalogue {
|
|
13
|
+
/** The locale numbers, dates and plurals are formatted with. */
|
|
14
|
+
readonly locale: Locale;
|
|
15
|
+
/** The language of the shipped catalogue in use. */
|
|
16
|
+
readonly language: string;
|
|
17
|
+
/** True when the requested language has no catalogue and the source language is used instead. */
|
|
18
|
+
readonly fallback: boolean;
|
|
19
|
+
readonly timeZone: string;
|
|
20
|
+
/** Final ICU messages, overrides applied. */
|
|
21
|
+
readonly messages: Readonly<Record<MessageId, string>>;
|
|
22
|
+
}
|
|
23
|
+
export declare class CatalogueError extends Error {
|
|
24
|
+
readonly issues: readonly ConfigIssue[];
|
|
25
|
+
constructor(issues: readonly ConfigIssue[]);
|
|
26
|
+
}
|
|
27
|
+
/** The shipped catalogue of the locale's language, or the source catalogue when there is none. */
|
|
28
|
+
export declare function resolveLanguage(locale: Locale): {
|
|
29
|
+
language: string;
|
|
30
|
+
fallback: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function loadCatalogue(locale: string, options?: CatalogueOptions): Catalogue;
|
|
33
|
+
/** The argument tuple of a message: one object for a message with arguments, nothing otherwise. */
|
|
34
|
+
export type MessageArgumentsOf<Id extends MessageId> = Id extends keyof MessageArguments ? [args: MessageArguments[Id]] : [];
|
|
35
|
+
/** Resolves a message to its final string with the catalogue's locale; the result never reaches a browser runtime. */
|
|
36
|
+
export declare function formatMessage<Id extends MessageId>(catalogue: Catalogue, id: Id, ...args: MessageArgumentsOf<Id>): string;
|
|
37
|
+
/**
|
|
38
|
+
* Resolves an ICU message that lives outside the catalogues, the counted message of a type
|
|
39
|
+
* module for instance, with the locale and the time zone of a catalogue.
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatText(catalogue: Catalogue, message: string, values?: Record<string, PrimitiveType>): string;
|
|
42
|
+
//# sourceMappingURL=catalogue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/catalogue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI5D,0EAA0E;AAC1E,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAErF,MAAM,WAAW,gBAAgB;IAC/B,2FAA2F;IAC3F,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,uFA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,MAAM,EAAE,aAAa,CAAM,GACzC,MAAM,CAKR"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { IntlMessageFormat } from "intl-messageformat";
|
|
2
|
+
import { validateOverrides } from "./labels.js";
|
|
3
|
+
import { shipped, SOURCE_LANGUAGE } from "./shipped.js";
|
|
4
|
+
export class CatalogueError extends Error {
|
|
5
|
+
issues;
|
|
6
|
+
constructor(issues) {
|
|
7
|
+
super(issues.map((issue) => `${issue.path}: ${issue.message}`).join("; "));
|
|
8
|
+
this.name = "CatalogueError";
|
|
9
|
+
this.issues = issues;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Any `Intl` constructor accepts a canonical tag; a malformed one raises a RangeError. */
|
|
13
|
+
function canonical(tag) {
|
|
14
|
+
try {
|
|
15
|
+
return Intl.getCanonicalLocales(tag)[0];
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** The shipped catalogue of the locale's language, or the source catalogue when there is none. */
|
|
22
|
+
export function resolveLanguage(locale) {
|
|
23
|
+
const language = new Intl.Locale(locale).language;
|
|
24
|
+
return language in shipped
|
|
25
|
+
? { language, fallback: false }
|
|
26
|
+
: { language: SOURCE_LANGUAGE, fallback: true };
|
|
27
|
+
}
|
|
28
|
+
export function loadCatalogue(locale, options = {}) {
|
|
29
|
+
const tag = canonical(locale);
|
|
30
|
+
if (tag === undefined) {
|
|
31
|
+
throw new CatalogueError([
|
|
32
|
+
{
|
|
33
|
+
severity: "error",
|
|
34
|
+
path: "project.locale",
|
|
35
|
+
message: "not a valid language tag",
|
|
36
|
+
received: locale,
|
|
37
|
+
expected: "a BCP 47 language tag such as en or fr-CA",
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
const { language, fallback } = resolveLanguage(tag);
|
|
42
|
+
const overrides = options.labels?.[language] ?? {};
|
|
43
|
+
const issues = validateOverrides(overrides, `labels.${language}`);
|
|
44
|
+
if (issues.length > 0)
|
|
45
|
+
throw new CatalogueError(issues);
|
|
46
|
+
// Every override passed validation, so its key is an identifier of the catalogue.
|
|
47
|
+
const applied = overrides;
|
|
48
|
+
return {
|
|
49
|
+
locale: fallback ? SOURCE_LANGUAGE : tag,
|
|
50
|
+
language,
|
|
51
|
+
fallback,
|
|
52
|
+
timeZone: options.timeZone ?? "UTC",
|
|
53
|
+
// Both records list every identifier, so the merge does too.
|
|
54
|
+
messages: { ...shipped[language], ...applied },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const formatters = new WeakMap();
|
|
58
|
+
const dateStyles = ["short", "medium", "long", "full"];
|
|
59
|
+
function zonedFormats(timeZone) {
|
|
60
|
+
const styles = Object.fromEntries(dateStyles.map((style) => [style, { timeZone }]));
|
|
61
|
+
return { date: styles, time: styles };
|
|
62
|
+
}
|
|
63
|
+
function formatterFor(catalogue, id) {
|
|
64
|
+
let cache = formatters.get(catalogue);
|
|
65
|
+
if (cache === undefined) {
|
|
66
|
+
cache = new Map();
|
|
67
|
+
formatters.set(catalogue, cache);
|
|
68
|
+
}
|
|
69
|
+
let formatter = cache.get(id);
|
|
70
|
+
if (formatter === undefined) {
|
|
71
|
+
formatter = new IntlMessageFormat(catalogue.messages[id], catalogue.locale, zonedFormats(catalogue.timeZone));
|
|
72
|
+
cache.set(id, formatter);
|
|
73
|
+
}
|
|
74
|
+
return formatter;
|
|
75
|
+
}
|
|
76
|
+
/** Resolves a message to its final string with the catalogue's locale; the result never reaches a browser runtime. */
|
|
77
|
+
export function formatMessage(catalogue, id, ...args) {
|
|
78
|
+
const values = { ...args[0] };
|
|
79
|
+
return formatterFor(catalogue, id)
|
|
80
|
+
.formatToParts(values)
|
|
81
|
+
.map((part) => part.value)
|
|
82
|
+
.join("");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resolves an ICU message that lives outside the catalogues, the counted message of a type
|
|
86
|
+
* module for instance, with the locale and the time zone of a catalogue.
|
|
87
|
+
*/
|
|
88
|
+
export function formatText(catalogue, message, values = {}) {
|
|
89
|
+
return new IntlMessageFormat(message, catalogue.locale, zonedFormats(catalogue.timeZone))
|
|
90
|
+
.formatToParts(values)
|
|
91
|
+
.map((part) => part.value)
|
|
92
|
+
.join("");
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=catalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../../src/catalogue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoC,MAAM,oBAAoB,CAAC;AAGzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAwBxD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,MAAM,CAAyB;IAExC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,2FAA2F;AAC3F,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAClD,OAAO,QAAQ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/B,aAAa,CAAC,MAAM,CAAC;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;SACzB,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,SAAoB,EACpB,OAAe,EACf,SAAwC,EAAE;IAE1C,OAAO,IAAI,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACtF,aAAa,CAAC,MAAM,CAAC;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;SACzB,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AREAS } from "./areas.js";
|
|
2
|
+
type UnionToIntersection<Union> = (Union extends unknown ? (member: Union) => void : never) extends (member: infer Intersection) => void ? Intersection : never;
|
|
3
|
+
type Areas = (typeof AREAS)[number];
|
|
4
|
+
/** The source catalogue, every area merged: its keys are the identifiers. */
|
|
5
|
+
type Source = UnionToIntersection<Areas["en"]>;
|
|
6
|
+
/** Every identifier of the source catalogue; an unknown identifier does not compile. */
|
|
7
|
+
export type MessageId = keyof Source;
|
|
8
|
+
export declare const source: Source;
|
|
9
|
+
export declare const french: UnionToIntersection<Areas["fr"]>;
|
|
10
|
+
/** The ICU kind of every argument of every message, as declared by the areas. */
|
|
11
|
+
export declare const messageArguments: UnionToIntersection<Areas["arguments"]>;
|
|
12
|
+
type Declared = typeof messageArguments;
|
|
13
|
+
/** The identifiers whose declaration lists at least one argument. */
|
|
14
|
+
type WithArguments = {
|
|
15
|
+
[Id in MessageId]: keyof Declared[Id] extends never ? never : Id;
|
|
16
|
+
}[MessageId];
|
|
17
|
+
/** The TypeScript type a value must have for each ICU kind. */
|
|
18
|
+
export interface ArgumentValues {
|
|
19
|
+
argument: string;
|
|
20
|
+
number: number;
|
|
21
|
+
date: Date;
|
|
22
|
+
time: Date;
|
|
23
|
+
select: string;
|
|
24
|
+
plural: number;
|
|
25
|
+
tag: never;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The arguments of the messages that take some, typed from the kinds the areas declare; a
|
|
29
|
+
* message absent from this type takes none.
|
|
30
|
+
*/
|
|
31
|
+
export type MessageArguments = {
|
|
32
|
+
[Id in WithArguments]: {
|
|
33
|
+
-readonly [Name in keyof Declared[Id]]: Declared[Id][Name] extends keyof ArgumentValues ? ArgumentValues[Declared[Id][Name]] : never;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare function byCodeUnit(a: string, b: string): number;
|
|
37
|
+
/** The identifiers of the source catalogue in sorted order. */
|
|
38
|
+
export declare const messageIds: readonly MessageId[];
|
|
39
|
+
/** A record with one value per identifier of the source catalogue. */
|
|
40
|
+
export declare function byMessageId<T>(value: (id: MessageId) => T): Readonly<Record<MessageId, T>>;
|
|
41
|
+
/** The argument names of every message in sorted order, for checks against the parsed catalogues. */
|
|
42
|
+
export declare const argumentNames: Readonly<Record<MessageId, readonly string[]>>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,KAAK,mBAAmB,CAAC,KAAK,IAAI,CAChC,KAAK,SAAS,OAAO,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,GAAG,KAAK,CACxD,SAAS,CAAC,MAAM,EAAE,MAAM,YAAY,KAAK,IAAI,GAC1C,YAAY,GACZ,KAAK,CAAC;AAEV,KAAK,KAAK,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpC,6EAA6E;AAC7E,KAAK,MAAM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M,UAAU,EAAE,SAAS,SAAS,EAGZ,CAAC;AAEhC,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAK1F;AAED,qGAAqG;AACrG,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC,CAExE,CAAC"}
|
package/dist/src/ids.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AREAS } from "./areas.js";
|
|
2
|
+
/** One flat record from the records of every area, in the order of the areas. */
|
|
3
|
+
function merged(records) {
|
|
4
|
+
const record = {};
|
|
5
|
+
for (const part of records)
|
|
6
|
+
Object.assign(record, part);
|
|
7
|
+
return record;
|
|
8
|
+
}
|
|
9
|
+
// Every area lists its own identifiers, so the merge of them all lists every identifier.
|
|
10
|
+
export const source = merged(AREAS.map((area) => area.en));
|
|
11
|
+
// The same identifiers, translated: an area declares its French next to its English.
|
|
12
|
+
export const french = merged(AREAS.map((area) => area.fr));
|
|
13
|
+
/** The ICU kind of every argument of every message, as declared by the areas. */
|
|
14
|
+
export const messageArguments = merged(AREAS.map((area) => area.arguments));
|
|
15
|
+
// Code-unit order, not locale order: the output must not depend on the collation data of the runtime.
|
|
16
|
+
export function byCodeUnit(a, b) {
|
|
17
|
+
return Number(a > b) - Number(a < b);
|
|
18
|
+
}
|
|
19
|
+
/** The identifiers of the source catalogue in sorted order. */
|
|
20
|
+
export const messageIds = Object.keys(source)
|
|
21
|
+
.sort(byCodeUnit)
|
|
22
|
+
// Object.keys returns the keys of the merged catalogue, whose type lists exactly them.
|
|
23
|
+
.map((id) => id);
|
|
24
|
+
/** A record with one value per identifier of the source catalogue. */
|
|
25
|
+
export function byMessageId(value) {
|
|
26
|
+
const record = {};
|
|
27
|
+
for (const id of messageIds)
|
|
28
|
+
record[id] = value(id);
|
|
29
|
+
// Every identifier received a value in the loop above.
|
|
30
|
+
return record;
|
|
31
|
+
}
|
|
32
|
+
/** The argument names of every message in sorted order, for checks against the parsed catalogues. */
|
|
33
|
+
export const argumentNames = byMessageId((id) => Object.keys(messageArguments[id]).sort(byCodeUnit));
|
|
34
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAgBnC,iFAAiF;AACjF,SAAS,MAAM,CACb,OAAmD;IAEnD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,OAAO;QAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAW,CAAC;AAErE,qFAAqF;AACrF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAqC,CAAC;AAE/F,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CACpC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAEO,CAAC;AAgC7C,sGAAsG;AACtG,MAAM,UAAU,UAAU,CAAC,CAAS,EAAE,CAAS;IAC7C,OAAO,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,UAAU,GAAyB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KAChE,IAAI,CAAC,UAAU,CAAC;IACjB,uFAAuF;KACtF,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAe,CAAC,CAAC;AAEhC,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAI,KAA2B;IACxD,MAAM,MAAM,GAAkC,EAAE,CAAC;IACjD,KAAK,MAAM,EAAE,IAAI,UAAU;QAAE,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IACpD,uDAAuD;IACvD,OAAO,MAA8B,CAAC;AACxC,CAAC;AAED,qGAAqG;AACrG,MAAM,CAAC,MAAM,aAAa,GAAmD,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAC9F,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CACnD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { argumentsOf, parseMessage, type ArgumentKind, type ParsedMessage } from "./arguments.js";
|
|
2
|
+
export { CatalogueError, formatMessage, formatText, loadCatalogue, resolveLanguage, type Catalogue, type CatalogueOptions, type MessageArgumentsOf, type ThemeLabels, } from "./catalogue.js";
|
|
3
|
+
export { argumentNames, messageArguments, messageIds, type ArgumentValues, type MessageArguments, type MessageId, } from "./ids.js";
|
|
4
|
+
export { formatDate, formatDay, formatMonth, formatMonthName, formatNumber, formatRelative, textDirection, type DateOptions, type DateStyle, type LocaleInfo, type TextDirection, } from "./intl.js";
|
|
5
|
+
export { validateLabels, validateOverride, validateOverrides } from "./labels.js";
|
|
6
|
+
export { SOURCE_LANGUAGE, shippedLanguages } from "./shipped.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,EACf,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { argumentsOf, parseMessage } from "./arguments.js";
|
|
2
|
+
export { CatalogueError, formatMessage, formatText, loadCatalogue, resolveLanguage, } from "./catalogue.js";
|
|
3
|
+
export { argumentNames, messageArguments, messageIds, } from "./ids.js";
|
|
4
|
+
export { formatDate, formatDay, formatMonth, formatMonthName, formatNumber, formatRelative, textDirection, } from "./intl.js";
|
|
5
|
+
export { validateLabels, validateOverride, validateOverrides } from "./labels.js";
|
|
6
|
+
export { SOURCE_LANGUAGE, shippedLanguages } from "./shipped.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAyC,MAAM,gBAAgB,CAAC;AAClG,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,UAAU,GAIX,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,GAKd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Locale } from "@concordance-wiki/core";
|
|
2
|
+
export type DateStyle = "short" | "medium" | "long" | "full";
|
|
3
|
+
export interface DateOptions {
|
|
4
|
+
/** Defaults to UTC so that a build does not depend on the machine's time zone. */
|
|
5
|
+
timeZone?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function formatDate(locale: Locale, date: Date, style: DateStyle, options?: DateOptions): string;
|
|
8
|
+
/** The month of a date with its year, "March 2026", in the words of the locale. */
|
|
9
|
+
export declare function formatMonth(locale: Locale, date: Date, options?: DateOptions): string;
|
|
10
|
+
/** The day of a date without its year, "March 12", in the words of the locale, for a sentence that names a session. */
|
|
11
|
+
export declare function formatDay(locale: Locale, date: Date, options?: DateOptions): string;
|
|
12
|
+
/** The month of a date alone, "March", in the words of the locale, for a tree that already names the year. */
|
|
13
|
+
export declare function formatMonthName(locale: Locale, date: Date, options?: DateOptions): string;
|
|
14
|
+
export declare function formatNumber(locale: Locale, value: number, options?: Intl.NumberFormatOptions): string;
|
|
15
|
+
/**
|
|
16
|
+
* The time elapsed from `from` to `to`, such as "3 days ago" or "in 2 hours" when `from` is
|
|
17
|
+
* later than `to`; the `short` style abbreviates the unit where the locale does, for a narrow line.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatRelative(locale: Locale, from: Date, to: Date, style?: Intl.RelativeTimeFormatStyle): string;
|
|
20
|
+
export type TextDirection = "ltr" | "rtl";
|
|
21
|
+
/** What the platform exposes about a locale; the text information is standard but not present on every engine. */
|
|
22
|
+
export interface LocaleInfo {
|
|
23
|
+
getTextInfo?: () => {
|
|
24
|
+
direction: string;
|
|
25
|
+
};
|
|
26
|
+
textInfo?: {
|
|
27
|
+
direction: string;
|
|
28
|
+
};
|
|
29
|
+
maximize: () => {
|
|
30
|
+
script?: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The writing direction of a locale, for the `dir` attribute of a page. */
|
|
34
|
+
export declare function textDirection(locale: Locale, info?: (tag: string) => LocaleInfo): TextDirection;
|
|
35
|
+
//# sourceMappingURL=intl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intl.d.ts","sourceRoot":"","sources":["../../src/intl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,WAAgB,GACxB,MAAM,CAKR;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAMzF;AAED,uHAAuH;AACvH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAMvF;AAED,8GAA8G;AAC9G,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAK7F;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,mBAAwB,GACrC,MAAM,CAER;AAqBD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,IAAI,EACR,KAAK,GAAE,IAAI,CAAC,uBAAgC,GAC3C,MAAM,CAMR;AAED,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1C,kHAAkH;AAClH,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,MAAM;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,QAAQ,EAAE,MAAM;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrC;AAmBD,4EAA4E;AAC5E,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAA2B,GACjD,aAAa,CASf"}
|
package/dist/src/intl.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export function formatDate(locale, date, style, options = {}) {
|
|
2
|
+
return new Intl.DateTimeFormat(locale, {
|
|
3
|
+
dateStyle: style,
|
|
4
|
+
timeZone: options.timeZone ?? "UTC",
|
|
5
|
+
}).format(date);
|
|
6
|
+
}
|
|
7
|
+
/** The month of a date with its year, "March 2026", in the words of the locale. */
|
|
8
|
+
export function formatMonth(locale, date, options = {}) {
|
|
9
|
+
return new Intl.DateTimeFormat(locale, {
|
|
10
|
+
month: "long",
|
|
11
|
+
year: "numeric",
|
|
12
|
+
timeZone: options.timeZone ?? "UTC",
|
|
13
|
+
}).format(date);
|
|
14
|
+
}
|
|
15
|
+
/** The day of a date without its year, "March 12", in the words of the locale, for a sentence that names a session. */
|
|
16
|
+
export function formatDay(locale, date, options = {}) {
|
|
17
|
+
return new Intl.DateTimeFormat(locale, {
|
|
18
|
+
day: "numeric",
|
|
19
|
+
month: "long",
|
|
20
|
+
timeZone: options.timeZone ?? "UTC",
|
|
21
|
+
}).format(date);
|
|
22
|
+
}
|
|
23
|
+
/** The month of a date alone, "March", in the words of the locale, for a tree that already names the year. */
|
|
24
|
+
export function formatMonthName(locale, date, options = {}) {
|
|
25
|
+
return new Intl.DateTimeFormat(locale, {
|
|
26
|
+
month: "long",
|
|
27
|
+
timeZone: options.timeZone ?? "UTC",
|
|
28
|
+
}).format(date);
|
|
29
|
+
}
|
|
30
|
+
export function formatNumber(locale, value, options = {}) {
|
|
31
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
32
|
+
}
|
|
33
|
+
const second = 1000;
|
|
34
|
+
const minute = 60 * second;
|
|
35
|
+
const hour = 60 * minute;
|
|
36
|
+
const day = 24 * hour;
|
|
37
|
+
const week = 7 * day;
|
|
38
|
+
const year = 365.25 * day;
|
|
39
|
+
const month = year / 12;
|
|
40
|
+
/** Largest unit first: the first one that fits the elapsed time is the one shown. */
|
|
41
|
+
const units = [
|
|
42
|
+
["year", year],
|
|
43
|
+
["month", month],
|
|
44
|
+
["week", week],
|
|
45
|
+
["day", day],
|
|
46
|
+
["hour", hour],
|
|
47
|
+
["minute", minute],
|
|
48
|
+
["second", second],
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* The time elapsed from `from` to `to`, such as "3 days ago" or "in 2 hours" when `from` is
|
|
52
|
+
* later than `to`; the `short` style abbreviates the unit where the locale does, for a narrow line.
|
|
53
|
+
*/
|
|
54
|
+
export function formatRelative(locale, from, to, style = "long") {
|
|
55
|
+
const elapsed = from.getTime() - to.getTime();
|
|
56
|
+
const magnitude = Math.abs(elapsed);
|
|
57
|
+
const [unit, size] = units.find(([, length]) => magnitude >= length) ?? ["second", second];
|
|
58
|
+
const value = Math.round(elapsed / size);
|
|
59
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto", style }).format(value, unit);
|
|
60
|
+
}
|
|
61
|
+
const rtlScripts = new Set([
|
|
62
|
+
"Adlm",
|
|
63
|
+
"Arab",
|
|
64
|
+
"Hebr",
|
|
65
|
+
"Mand",
|
|
66
|
+
"Nkoo",
|
|
67
|
+
"Rohg",
|
|
68
|
+
"Samr",
|
|
69
|
+
"Syrc",
|
|
70
|
+
"Thaa",
|
|
71
|
+
"Yezi",
|
|
72
|
+
]);
|
|
73
|
+
function platformLocale(tag) {
|
|
74
|
+
return new Intl.Locale(tag);
|
|
75
|
+
}
|
|
76
|
+
/** The writing direction of a locale, for the `dir` attribute of a page. */
|
|
77
|
+
export function textDirection(locale, info = platformLocale) {
|
|
78
|
+
const resolved = info(locale);
|
|
79
|
+
const reported = resolved.getTextInfo !== undefined
|
|
80
|
+
? resolved.getTextInfo().direction
|
|
81
|
+
: resolved.textInfo?.direction;
|
|
82
|
+
if (reported !== undefined)
|
|
83
|
+
return reported === "rtl" ? "rtl" : "ltr";
|
|
84
|
+
const script = resolved.maximize().script;
|
|
85
|
+
return script !== undefined && rtlScripts.has(script) ? "rtl" : "ltr";
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=intl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intl.js","sourceRoot":"","sources":["../../src/intl.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,UAAU,CACxB,MAAc,EACd,IAAU,EACV,KAAgB,EAChB,UAAuB,EAAE;IAEzB,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QACrC,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;KACpC,C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IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAC3B,MAAc,EACd,OAAoC,cAAc;IAElD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,QAAQ,GACZ,QAAQ,CAAC,WAAW,KAAK,SAAS;QAChC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS;QAClC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IACnC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACtE,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;IAC1C,OAAO,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConfigIssue } from "@concordance-wiki/core";
|
|
2
|
+
/** The issue an override raises, or undefined when it can replace the source message. */
|
|
3
|
+
export declare function validateOverride(id: string, message: string, path: string): ConfigIssue | undefined;
|
|
4
|
+
/** Validates the overrides of one language; `prefix` is the path of the block, `labels.fr` style. */
|
|
5
|
+
export declare function validateOverrides(overrides: Readonly<Record<string, string>>, prefix: string): ConfigIssue[];
|
|
6
|
+
/** Validates the whole `labels` block of a theme: every language must ship a catalogue and every override must be valid. */
|
|
7
|
+
export declare function validateLabels(labels: Readonly<Record<string, Readonly<Record<string, string>>>>): ConfigIssue[];
|
|
8
|
+
//# sourceMappingURL=labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAwB1D,yFAAyF;AACzF,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,WAAW,GAAG,SAAS,CAmCzB;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC3C,MAAM,EAAE,MAAM,GACb,WAAW,EAAE,CAOf;AAED,4HAA4H;AAC5H,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GACjE,WAAW,EAAE,CAgBf"}
|