@doenet/doenetml-iframe 0.7.21-dev.408 → 0.7.21-dev.409
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 +6 -4
- package/index.js +39 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,10 +196,12 @@ differ — a Spanish-speaking student may work a French physics problem.
|
|
|
196
196
|
- `uiLocale` — BCP-47 tag for the chrome's language. Defaults to following
|
|
197
197
|
`documentLocale`, so a fully Spanish activity is fully Spanish without the
|
|
198
198
|
host configuring anything.
|
|
199
|
-
- `localeResources` — FTL message catalogs keyed by locale, for
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
- `localeResources` — FTL message catalogs keyed by locale, for a host with
|
|
200
|
+
translations of its own. English and Spanish are bundled and every other
|
|
201
|
+
language is fetched from the `locales/` directory published beside the
|
|
202
|
+
standalone bundle the iframe loads, so a host needing only the shipped
|
|
203
|
+
translations passes nothing; a catalog supplied here wins over either, which
|
|
204
|
+
is how a deployment corrects a translation.
|
|
203
205
|
|
|
204
206
|
The rendered container always carries a `lang` attribute naming the language
|
|
205
207
|
the content was rendered in, so screen readers pronounce it with the right
|
package/index.js
CHANGED
|
@@ -1486,6 +1486,10 @@ const BUNDLED_TRANSLATIONS = {
|
|
|
1486
1486
|
editor: esEditor
|
|
1487
1487
|
}
|
|
1488
1488
|
};
|
|
1489
|
+
[
|
|
1490
|
+
DEFAULT_LOCALE,
|
|
1491
|
+
...Object.keys(BUNDLED_TRANSLATIONS)
|
|
1492
|
+
];
|
|
1489
1493
|
function bundledResources(namespaces, { includeEnglish = false } = {}) {
|
|
1490
1494
|
const resources = {};
|
|
1491
1495
|
if (includeEnglish) {
|
|
@@ -1507,6 +1511,40 @@ bundledResources(
|
|
|
1507
1511
|
CHROME_NAMESPACES,
|
|
1508
1512
|
{ includeEnglish: true }
|
|
1509
1513
|
);
|
|
1514
|
+
const CODE_SPLIT_CATALOGS = typeof __DOENET_CODE_SPLIT_CATALOGS__ === "undefined" || __DOENET_CODE_SPLIT_CATALOGS__;
|
|
1515
|
+
const LAZY_CATALOG_MODULES = CODE_SPLIT_CATALOGS ? /* @__PURE__ */ Object.assign({}) : {};
|
|
1516
|
+
const CATALOG_PATH_PATTERN = /\/locales\/([^/]+)\/([^/]+)\.ftl$/;
|
|
1517
|
+
function isCatalogNamespace(name2) {
|
|
1518
|
+
return CATALOG_NAMESPACES.includes(name2);
|
|
1519
|
+
}
|
|
1520
|
+
function loadersFromModules(modules) {
|
|
1521
|
+
const byLocale = {};
|
|
1522
|
+
for (const [modulePath, importModule] of Object.entries(modules)) {
|
|
1523
|
+
const match2 = CATALOG_PATH_PATTERN.exec(modulePath);
|
|
1524
|
+
if (!match2 || !isCatalogNamespace(match2[2])) {
|
|
1525
|
+
continue;
|
|
1526
|
+
}
|
|
1527
|
+
(byLocale[match2[1]] ??= {})[match2[2]] = importModule;
|
|
1528
|
+
}
|
|
1529
|
+
const loaders = {};
|
|
1530
|
+
for (const [locale, importers] of Object.entries(byLocale)) {
|
|
1531
|
+
loaders[locale] = async (namespaces) => {
|
|
1532
|
+
const wanted = namespaces.filter(
|
|
1533
|
+
(namespace) => Boolean(importers[namespace])
|
|
1534
|
+
);
|
|
1535
|
+
const sources = await Promise.all(
|
|
1536
|
+
wanted.map((namespace) => importers[namespace]())
|
|
1537
|
+
);
|
|
1538
|
+
const catalogs = {};
|
|
1539
|
+
wanted.forEach((namespace, index2) => {
|
|
1540
|
+
catalogs[namespace] = sources[index2];
|
|
1541
|
+
});
|
|
1542
|
+
return catalogs;
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
return loaders;
|
|
1546
|
+
}
|
|
1547
|
+
loadersFromModules(LAZY_CATALOG_MODULES);
|
|
1510
1548
|
bundledResources(WORKER_NAMESPACES);
|
|
1511
1549
|
const DIAGNOSTIC_CODES = {
|
|
1512
1550
|
"doenet-i0001": "line-segment-attributes-ignored-with-endpoints",
|
|
@@ -67231,7 +67269,7 @@ function ExternalVirtualKeyboard({
|
|
|
67231
67269
|
}
|
|
67232
67270
|
);
|
|
67233
67271
|
}
|
|
67234
|
-
const version = "0.7.21-dev.
|
|
67272
|
+
const version = "0.7.21-dev.409";
|
|
67235
67273
|
const latestDoenetmlVersion = version;
|
|
67236
67274
|
function subscribeToPinnedTheme() {
|
|
67237
67275
|
return () => {
|