@dokebi/i18n 0.2.10 → 0.2.11
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/AI.md +2 -1
- package/dist/options.d.ts +1 -0
- package/dist/options.js +10 -2
- package/dist/page.d.ts +5 -0
- package/dist/page.js +112 -16
- package/dist/plugin.js +1 -1
- package/options.schema.json +12 -1
- package/package.json +2 -2
package/AI.md
CHANGED
|
@@ -14,7 +14,7 @@ Private `dokebi.yaml`, under `options.dokebi-i18n`:
|
|
|
14
14
|
| `http.enabled` | boolean | false | Attach request translators and contribute page locale; requires web. |
|
|
15
15
|
| `http.cookieName` | string | dokebi-lang | Preference cookie name, 1–128 ASCII letters, digits, underscores or hyphens. |
|
|
16
16
|
| `http.pageMessages` | string[] | `['*']` | Namespaces every rendered page receives in the `i18n` prop (`*`: all); at most 64. Unknown names fail the start (`UNKNOWN_NAMESPACE`). |
|
|
17
|
-
| `http.apps` | object | `{}` | Per @dokebi/app app (the name of `domains.<host>.app`, at most 256): `{ <app>: { pageMessages?, locales?, defaultLocale? } }` (at least one). `pageMessages` replaces `http.pageMessages` on that app's pages (D-0196; unknown names fail the start, `UNKNOWN_NAMESPACE`); `locales` and `defaultLocale` are the locales that app offers and its answer when none matches (0.2.6, D-0241; outside the catalogs' locales, or a default outside the list, fail the start, `INVALID_OPTIONS`). |
|
|
17
|
+
| `http.apps` | object | `{}` | Per @dokebi/app app (the name of `domains.<host>.app`, at most 256): `{ <app>: { pageMessages?, pageExclude?, locales?, defaultLocale? } }` (at least one). `pageMessages` replaces `http.pageMessages` on that app's pages (D-0196; unknown names fail the start, `UNKNOWN_NAMESPACE`); `pageExclude` lists key prefixes (on a dot boundary) or whole namespaces that app's pages never receive (0.2.11, D-0312, §Vue pages; at most 4096; a prefix whose namespace no catalog has fails the start, `UNKNOWN_NAMESPACE`); `locales` and `defaultLocale` are the locales that app offers and its answer when none matches (0.2.6, D-0241; outside the catalogs' locales, or a default outside the list, fail the start, `INVALID_OPTIONS`). |
|
|
18
18
|
| `http.maxPageHeaderBytes` | integer | 4096 | Longest `X-Dokebi-I18n` visit header read, 256–16384; a longer one counts as holding nothing (D-0126). The browser runtime stays inside it. |
|
|
19
19
|
| `http.pathLocale` | boolean | false | A first path segment that is a configured locale (`/ja/p/1`, any case) decides the request locale; see §HTTP integration (URL locales). |
|
|
20
20
|
| `http.maxCookieHeaderBytes` | integer | 16384 | Longest Cookie request header read, 256–65536; a longer one counts as naming neither the preference cookie nor the page cache claim (the request goes on). |
|
|
@@ -166,6 +166,7 @@ const { t, n, d, locale, switchLocale } = useI18n();
|
|
|
166
166
|
|
|
167
167
|
- **Which namespaces.** `http.pageMessages` (default `['*']`, every namespace) names what every page gets; a route adds more with `pageMessages(request, 'posts', 'editor')` before `render` (an unknown name fails that render with `UNKNOWN_NAMESPACE`). With `[]` pages get only what routes add (`locale`, `version` and `settings` still come).
|
|
168
168
|
- **Per app (D-0196).** Several apps on one server (a member site and an admin) share one catalog, so `['*']` sends the admin's wording in the member site's first HTML too, and a public page (D-0195) sends every bundle on every load. `http.apps.<app>.pageMessages` gives that app's pages their own list instead (`apps: { frontend: { pageMessages: [front, site, common] } }`); a route of the app still adds more with `pageMessages(request, …)`, and apps not listed get `http.pageMessages`. The app is @dokebi/web's `appOf(request)` (@dokebi/app answers it from the host); with `http.apps` and nothing that tells a request's app, the start warns `I18N_PAGE_APPS_UNUSED` and every page gets `http.pageMessages`. An app's list is joined like a route's table (`http.maxJoinedSets`).
|
|
169
|
+
- **Keys an app's pages never receive (0.2.11, [D-0312](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0312-i18n-page-exclude.md)).** A shared namespace often mixes the member site's words with staff-only ones (`game.title` next to `game.settings.*`), and renaming the staff keys breaks every page that uses them. `http.apps.<app>.pageExclude` leaves key prefixes out of every bundle that app's pages receive — its first HTML, its visits, its list and a route's `pageMessages(request, …)` alike, also on its template domains: `apps: { site: { pageMessages: [game, community, …], pageExclude: [game.settings, community.manage, logs] } }`. A prefix ends at a dot (`game.settings` covers `game.settings` and `game.settings.*`, not `game.settingsBar`); a bare namespace (`logs`) leaves that namespace's bundle empty. The filtered bundles have their own tokens (a browser that holds another app's bundle gets the app's again), and the app's settings name the prefixes (`settings.excluded`, sorted), so a page of that app that calls one gets `EXCLUDED_MESSAGE` from the browser runtime under `missing: error` — in SSR and in the browser — instead of `MISSING_MESSAGE` (with `missing: key` the key is shown and the runtime warns `I18N_EXCLUDED_KEY` once per prefix; @dokebi/template-inertia 0.4.31 or later). The server's `t()` (jobs, mail, other requests) and the other apps keep every key. A prefix that covers no key of any catalog warns `I18N_PAGE_EXCLUDE_UNMATCHED` (`app`, `prefixes`) at the start (a typo or a stale entry). Template words (`views/<template>/locales`, a template bundle's `locales/`) for a key the app leaves out are no error — the catalogs still have the key — and stay out of that app's pages while other apps on the template get them. Long lists are fine: a key costs one set lookup per dot in it, whatever the list's length, and the list rides in the app's settings (sent with the first HTML and when the version changes). Measured on 26,400 keys (22 namespaces, three locales, eight prefixes): the start builds the filtered bundles in about 8 ms more, choosing a page's prop costs the same, and the first HTML's messages shrank from 447 KB to 356 KB.
|
|
169
170
|
- **Locales per app (0.2.6, [D-0241](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0241-i18n-app-locales.md)).** A locale folder (`locales/en`) makes that locale every app's: an English browser gets English on every app, also on apps whose `en` catalogs are not written yet (half Korean, half English). `http.apps.<app>.locales` lists what that app offers (`apps: { admin: { locales: ['ko'] }, site: { locales: ['ko', 'en'] } }`): its negotiation — a path locale, the `dokebi-lang` cookie, `Accept-Language`, then the default — picks only from that list (a saved `en` cookie answers `ko` on the admin app), and the page's settings (`settings.locales`, the switcher's list, and `settings.defaultLocale`) are the app's, with their own catalog version. `defaultLocale` is that app's answer when nothing matches: unset, the plugin's `defaultLocale` when the app offers it, else the app's first locale. Apps not listed offer every locale. Ship `en` on the member site first and translate the staff apps later, or keep an app Korean-only for good.
|
|
170
171
|
- **Sent once per browser.** The runtime names what the document holds on every Inertia visit (request header `X-Dokebi-I18n: v=<version>; h=<token><token>…`, `PAGE_HEADER`, at most `http.maxPageHeaderBytes`); the prop then carries only bundles it lacks, and no `settings` while the version matches. The header is read **only on an Inertia visit** (`X-Inertia: true`): a full page request that carries it (any client can send it) gets the whole payload, so HTML that a cache keeps never lacks bundles. Tokens address content, so after a deploy a visit gets the settings again but only the bundles whose messages changed. Unknown tokens, another locale's tokens and a malformed or over-long header mean "nothing held" (never an error). Inertia answers name `X-Dokebi-I18n` in `Vary`.
|
|
171
172
|
- **Kept between page loads (D-0126, `http.pageCache`, on by default).** The runtime keeps the bundles it receives in localStorage (one item per bundle, bounded by `maxBundles` and `maxStoreCharacters`) and writes the cookie `dokebi-i18n-held` with their tokens (`maxCookieBytes`; 61 bundles take 488 bytes). On a full page load (no header) the server leaves the bundles the cookie names out of the HTML and lists them in `held`; the settings always come. Measured with 85 bundles (125 KB Korean, example 48): a home page that needs 60 is 93 KB of HTML (44 KB gzip) on the first load and 2.4 KB (1.4 KB gzip) on a reload; a visit is unchanged. The cookie is no proof: when the browser lacks a named bundle (storage cleared, the cookie changed, the quota full) the runtime fetches the missing messages (an Inertia partial reload of `i18n`) **before it mounts** the app, so no screen is drawn without them; SSR renders the left-out bundles from the server's own catalogs. A seal host never reads the cookie and tells the browser to keep nothing. Turning `pageCache.enabled` off makes the server ignore the cookie (it expires by itself). The cookie and the store are browser data like a cache: an app with a strict cookie policy can turn it off.
|
package/dist/options.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const options: import("@dokebi/core").OptionsDeclaration<{
|
|
|
5
5
|
readonly apps: Readonly<Record<string, {
|
|
6
6
|
readonly defaultLocale?: string;
|
|
7
7
|
readonly locales?: readonly string[];
|
|
8
|
+
readonly pageExclude?: readonly string[];
|
|
8
9
|
readonly pageMessages?: readonly string[];
|
|
9
10
|
}>>;
|
|
10
11
|
readonly cookieName: string;
|
package/dist/options.js
CHANGED
|
@@ -30,6 +30,14 @@ export const options = defineOptions({
|
|
|
30
30
|
maxItems: 64,
|
|
31
31
|
description: 'Namespaces every page of this app receives in place of http.pageMessages (D-0196); a route still adds more with pageMessages(request, ...). Unset: http.pageMessages.',
|
|
32
32
|
}),
|
|
33
|
+
pageExclude: o.array(o.string({
|
|
34
|
+
pattern: '^[a-zA-Z][a-zA-Z0-9_-]*(?:\\.[a-zA-Z][a-zA-Z0-9_-]*)*$',
|
|
35
|
+
maxLength: 256,
|
|
36
|
+
description: 'A key prefix on a dot boundary (game.settings leaves out game.settings and game.settings.*, not game.settingsX), or a whole namespace.',
|
|
37
|
+
}), {
|
|
38
|
+
maxItems: 4096,
|
|
39
|
+
description: "Keys this app's pages never receive (D-0312): left out of every bundle the app's first HTML and visits carry, its own and a route's pageMessages() alike. A page of the app that calls one gets EXCLUDED_MESSAGE (missing: error) instead of MISSING_MESSAGE. The server's t() (jobs, mail, other requests) and the other apps keep them. Unset: nothing left out.",
|
|
40
|
+
}),
|
|
33
41
|
locales: o.array(o.string({
|
|
34
42
|
minLength: 2,
|
|
35
43
|
maxLength: 35,
|
|
@@ -50,14 +58,14 @@ export const options = defineOptions({
|
|
|
50
58
|
refine: [
|
|
51
59
|
{
|
|
52
60
|
test: (value) => Object.values(value).some((field) => field !== undefined),
|
|
53
|
-
message: 'sets pageMessages, locales or defaultLocale',
|
|
61
|
+
message: 'sets pageMessages, pageExclude, locales or defaultLocale',
|
|
54
62
|
},
|
|
55
63
|
],
|
|
56
64
|
}), {
|
|
57
65
|
default: {},
|
|
58
66
|
keys: { pattern: '^[a-z][a-z0-9-]{0,31}$' },
|
|
59
67
|
maxProperties: 256,
|
|
60
|
-
description: 'Per @dokebi/app app (the app name of domains.<host>.app): its page messages (D-0196) and the locales it offers (D-0241). An app not listed gets http.pageMessages and every locale.',
|
|
68
|
+
description: 'Per @dokebi/app app (the app name of domains.<host>.app): its page messages (D-0196), the keys its pages never receive (D-0312) and the locales it offers (D-0241). An app not listed gets http.pageMessages and every locale.',
|
|
61
69
|
}),
|
|
62
70
|
maxPageHeaderBytes: o.integer({
|
|
63
71
|
default: 4096,
|
package/dist/page.d.ts
CHANGED
|
@@ -44,6 +44,11 @@ export interface PageI18nSettings {
|
|
|
44
44
|
/** Longest X-Dokebi-I18n header the server reads (http.maxPageHeaderBytes). */
|
|
45
45
|
readonly maxHeaderBytes: number;
|
|
46
46
|
readonly cache?: PageI18nCache;
|
|
47
|
+
/**
|
|
48
|
+
* D-0312: the key prefixes this app's pages never receive (http.apps.<app>.pageExclude), sorted.
|
|
49
|
+
* The runtime answers a call of one with EXCLUDED_MESSAGE, not MISSING_MESSAGE.
|
|
50
|
+
*/
|
|
51
|
+
readonly excluded?: readonly string[];
|
|
47
52
|
}
|
|
48
53
|
/** The `i18n` page prop (D-0099, D-0126). Field names are the protocol both packages document. */
|
|
49
54
|
export interface PageI18nPayload {
|
package/dist/page.js
CHANGED
|
@@ -124,6 +124,8 @@ export class PageMessages {
|
|
|
124
124
|
* their version: a browser on that app compares its claim with that version.
|
|
125
125
|
*/
|
|
126
126
|
#appSettings = new Map();
|
|
127
|
+
/** D-0312: app → the key prefixes its pages never receive (http.apps.<app>.pageExclude). */
|
|
128
|
+
#excluded = new Map();
|
|
127
129
|
constructor(options, input, logger, apps = new Map()) {
|
|
128
130
|
this.#logger = logger;
|
|
129
131
|
// The entry was validated by the provider (service.ts) already; this reads the same data.
|
|
@@ -159,6 +161,12 @@ export class PageMessages {
|
|
|
159
161
|
this.#maxJoined = options.http.maxJoinedSets;
|
|
160
162
|
this.#baseNamespaces = Object.freeze(configured.includes('*') ? [...namespaces].sort() : [...new Set(configured)]);
|
|
161
163
|
for (const [app, own] of Object.entries(options.http.apps)) {
|
|
164
|
+
if (own.pageExclude?.length) {
|
|
165
|
+
for (const prefix of own.pageExclude)
|
|
166
|
+
if (!namespaces.has(namespaceOf(prefix)))
|
|
167
|
+
throw new I18nError('UNKNOWN_NAMESPACE', `http.apps.${app}.pageExclude names ${JSON.stringify(prefix)}, whose namespace no catalog has`);
|
|
168
|
+
this.#excluded.set(app, Object.freeze([...new Set(own.pageExclude)].sort()));
|
|
169
|
+
}
|
|
162
170
|
// D-0241: an app entry may set only its locales; its page messages are then the base's.
|
|
163
171
|
if (own.pageMessages === undefined)
|
|
164
172
|
continue;
|
|
@@ -296,6 +304,53 @@ export class PageMessages {
|
|
|
296
304
|
}
|
|
297
305
|
}
|
|
298
306
|
this.templates = this.#templateScopes.size > 0;
|
|
307
|
+
// D-0312: for an app with pageExclude, each scope its requests resolve to (its own or the
|
|
308
|
+
// base's, and the template scopes over them) gets a twin without those keys. Only the
|
|
309
|
+
// namespaces the prefixes name are filtered and get new tokens; the others stay the scope's.
|
|
310
|
+
for (const [app, prefixes] of this.#excluded) {
|
|
311
|
+
const owner = this.#scopes.has(app) ? app : BASE;
|
|
312
|
+
const sources = new Set([owner]);
|
|
313
|
+
for (const scope of this.#templateScopes)
|
|
314
|
+
if (scope.startsWith(`${app}\u0001`) || scope.startsWith(`${owner}\u0001`))
|
|
315
|
+
sources.add(scope);
|
|
316
|
+
// A set, so a key costs one lookup per dot in it however long the list is (shop: 411).
|
|
317
|
+
const listed = new Set(prefixes);
|
|
318
|
+
const filtered = [...new Set(prefixes.map(namespaceOf))];
|
|
319
|
+
const matched = new Set();
|
|
320
|
+
for (const source of sources)
|
|
321
|
+
for (const locale of baseCatalogs.keys()) {
|
|
322
|
+
const from = slot(source, locale);
|
|
323
|
+
const at = slot(excludedScope(source, app), locale);
|
|
324
|
+
this.#chains.set(at, this.#chains.get(from));
|
|
325
|
+
const fromFragments = this.#fragments.get(from);
|
|
326
|
+
const fromTokens = this.#tokens.get(from);
|
|
327
|
+
const fragments = new Map(fromFragments);
|
|
328
|
+
const tokens = new Map(fromTokens);
|
|
329
|
+
const touched = new Set();
|
|
330
|
+
for (const namespace of filtered) {
|
|
331
|
+
const fragment = fromFragments.get(namespace);
|
|
332
|
+
if (!fragment)
|
|
333
|
+
continue;
|
|
334
|
+
const kept = without(fragment, listed, matched);
|
|
335
|
+
if (kept === fragment)
|
|
336
|
+
continue;
|
|
337
|
+
fragments.set(namespace, kept);
|
|
338
|
+
tokens.set(namespace, tokenOf(locale, namespace, kept));
|
|
339
|
+
touched.add(namespace);
|
|
340
|
+
}
|
|
341
|
+
if (!touched.size)
|
|
342
|
+
store(at, fromFragments, fromTokens, from);
|
|
343
|
+
else
|
|
344
|
+
store(at, fragments, tokens, this.#baseNamespaces.some((namespace) => touched.has(namespace)) ? undefined : from);
|
|
345
|
+
}
|
|
346
|
+
const unmatched = prefixes.filter((prefix) => !matched.has(prefix));
|
|
347
|
+
if (unmatched.length)
|
|
348
|
+
logger.log('warn', 'pageExclude names keys no catalog has', {
|
|
349
|
+
code: 'I18N_PAGE_EXCLUDE_UNMATCHED',
|
|
350
|
+
app,
|
|
351
|
+
prefixes: unmatched,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
299
354
|
// A token two bundles share (48 bits: not expected in practice) is never honored in a claim.
|
|
300
355
|
const byTokens = new Map();
|
|
301
356
|
for (const [at, tokens] of this.#tokens) {
|
|
@@ -370,8 +425,8 @@ export class PageMessages {
|
|
|
370
425
|
]);
|
|
371
426
|
this.#catalogHash = createHash('sha256').update(canonicalJson);
|
|
372
427
|
this.version = this.#versionOf(this.#settings);
|
|
373
|
-
for (const
|
|
374
|
-
this.#appSettings.set(app, this.#appScope(
|
|
428
|
+
for (const app of new Set([...apps.keys(), ...this.#excluded.keys()]))
|
|
429
|
+
this.#appSettings.set(app, this.#appScope(apps.get(app), this.#excluded.get(app)));
|
|
375
430
|
// SSR renders the bundles a full load leaves out from here (the runtime, in this process).
|
|
376
431
|
const shared = registry();
|
|
377
432
|
for (const [at, byNamespace] of this.#fragments)
|
|
@@ -393,25 +448,25 @@ export class PageMessages {
|
|
|
393
448
|
version: this.version,
|
|
394
449
|
namespaces: this.#baseNamespaces,
|
|
395
450
|
...(this.#appNamespaces.size ? { apps: Object.fromEntries(this.#appNamespaces) } : {}),
|
|
451
|
+
...(this.#excluded.size ? { excluded: Object.fromEntries(this.#excluded) } : {}),
|
|
396
452
|
bundles: this.#registered.size,
|
|
397
453
|
cache: cache.enabled,
|
|
398
454
|
});
|
|
399
455
|
}
|
|
400
|
-
/**
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
456
|
+
/**
|
|
457
|
+
* D-0241: the settings of an app with its own locales, from the current ones; D-0312: of an app
|
|
458
|
+
* with pageExclude, which its runtime reads to tell an excluded key from a missing one.
|
|
459
|
+
*/
|
|
460
|
+
#appScope(own, excluded) {
|
|
461
|
+
const extra = {
|
|
462
|
+
...(own ? { locales: own.locales, defaultLocale: own.defaultLocale } : {}),
|
|
463
|
+
...(excluded ? { excluded } : {}),
|
|
464
|
+
};
|
|
465
|
+
const sealed = Object.freeze({ ...this.#sealedSettings, ...extra });
|
|
407
466
|
const settings = this.#settings === this.#sealedSettings
|
|
408
467
|
? sealed
|
|
409
|
-
: Object.freeze({
|
|
410
|
-
|
|
411
|
-
locales: own.locales,
|
|
412
|
-
defaultLocale: own.defaultLocale,
|
|
413
|
-
});
|
|
414
|
-
return { settings, sealed, version: this.#versionOf(settings), own };
|
|
468
|
+
: Object.freeze({ ...this.#settings, ...extra });
|
|
469
|
+
return { settings, sealed, version: this.#versionOf(settings), own, excluded };
|
|
415
470
|
}
|
|
416
471
|
#versionOf(settings) {
|
|
417
472
|
return this.#catalogHash
|
|
@@ -434,7 +489,7 @@ export class PageMessages {
|
|
|
434
489
|
this.#settings = settings;
|
|
435
490
|
this.version = version;
|
|
436
491
|
for (const [app, scope] of this.#appSettings)
|
|
437
|
-
this.#appSettings.set(app, this.#appScope(scope.own));
|
|
492
|
+
this.#appSettings.set(app, this.#appScope(scope.own, scope.excluded));
|
|
438
493
|
}
|
|
439
494
|
/** Takes this catalog's bundles out of the SSR registry (the plugin's stop). */
|
|
440
495
|
close() {
|
|
@@ -471,6 +526,9 @@ export class PageMessages {
|
|
|
471
526
|
else if (this.#templateScopes.has(templateScope(owner, template)))
|
|
472
527
|
scope = templateScope(owner, template);
|
|
473
528
|
}
|
|
529
|
+
// D-0312: the app's twin of that scope, without its pageExclude keys.
|
|
530
|
+
if (app !== undefined && this.#excluded.has(app))
|
|
531
|
+
scope = excludedScope(scope, app);
|
|
474
532
|
const at = slot(scope, locale);
|
|
475
533
|
const fragments = this.#fragments.get(at);
|
|
476
534
|
const chain = this.#chains.get(at);
|
|
@@ -657,6 +715,44 @@ const SLOT = '\u0000';
|
|
|
657
715
|
const slot = (scope, locale) => `${scope}${SLOT}${locale}`;
|
|
658
716
|
/** D-0282: the scope of an app scope (or BASE) under one domain template. */
|
|
659
717
|
const templateScope = (owner, template) => `${owner}\u0001${template}`;
|
|
718
|
+
/** D-0312: a scope as one app with pageExclude sees it (app names never hold the separators). */
|
|
719
|
+
const excludedScope = (scope, app) => `${scope}\u0002${app}`;
|
|
720
|
+
/**
|
|
721
|
+
* D-0312: whether a listed prefix covers `key` (the key itself, or a part of it that ends at a
|
|
722
|
+
* dot); every covering prefix goes into `matched`. One set lookup per dot of the key.
|
|
723
|
+
*/
|
|
724
|
+
function excludedBy(key, prefixes, matched) {
|
|
725
|
+
let covered = false;
|
|
726
|
+
for (let dot = key.indexOf('.');; dot = key.indexOf('.', dot + 1)) {
|
|
727
|
+
const part = dot < 0 ? key : key.slice(0, dot);
|
|
728
|
+
if (prefixes.has(part)) {
|
|
729
|
+
matched.add(part);
|
|
730
|
+
covered = true;
|
|
731
|
+
}
|
|
732
|
+
if (dot < 0)
|
|
733
|
+
return covered;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
/** A bundle without the keys `prefixes` cover; the same object when none is in it. */
|
|
737
|
+
function without(fragment, prefixes, matched) {
|
|
738
|
+
const result = object();
|
|
739
|
+
let removed = false;
|
|
740
|
+
for (const [source, messages] of Object.entries(fragment)) {
|
|
741
|
+
const kept = object();
|
|
742
|
+
let any = false;
|
|
743
|
+
for (const [key, message] of Object.entries(messages)) {
|
|
744
|
+
if (excludedBy(key, prefixes, matched)) {
|
|
745
|
+
removed = true;
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
kept[key] = message;
|
|
749
|
+
any = true;
|
|
750
|
+
}
|
|
751
|
+
if (any)
|
|
752
|
+
result[source] = Object.freeze(kept);
|
|
753
|
+
}
|
|
754
|
+
return removed ? Object.freeze(result) : fragment;
|
|
755
|
+
}
|
|
660
756
|
function pick(tokens, namespaces) {
|
|
661
757
|
const result = object();
|
|
662
758
|
for (const name of namespaces) {
|
package/dist/plugin.js
CHANGED
package/options.schema.json
CHANGED
|
@@ -55,6 +55,17 @@
|
|
|
55
55
|
"maxItems": 64,
|
|
56
56
|
"description": "Namespaces every page of this app receives in place of http.pageMessages (D-0196); a route still adds more with pageMessages(request, ...). Unset: http.pageMessages."
|
|
57
57
|
},
|
|
58
|
+
"pageExclude": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"maxLength": 256,
|
|
63
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*(?:\\.[a-zA-Z][a-zA-Z0-9_-]*)*$",
|
|
64
|
+
"description": "A key prefix on a dot boundary (game.settings leaves out game.settings and game.settings.*, not game.settingsX), or a whole namespace."
|
|
65
|
+
},
|
|
66
|
+
"maxItems": 4096,
|
|
67
|
+
"description": "Keys this app's pages never receive (D-0312): left out of every bundle the app's first HTML and visits carry, its own and a route's pageMessages() alike. A page of the app that calls one gets EXCLUDED_MESSAGE (missing: error) instead of MISSING_MESSAGE. The server's t() (jobs, mail, other requests) and the other apps keep them. Unset: nothing left out."
|
|
68
|
+
},
|
|
58
69
|
"locales": {
|
|
59
70
|
"type": "array",
|
|
60
71
|
"items": {
|
|
@@ -78,7 +89,7 @@
|
|
|
78
89
|
}
|
|
79
90
|
},
|
|
80
91
|
"default": {},
|
|
81
|
-
"description": "Per @dokebi/app app (the app name of domains.<host>.app): its page messages (D-0196) and the locales it offers (D-0241). An app not listed gets http.pageMessages and every locale."
|
|
92
|
+
"description": "Per @dokebi/app app (the app name of domains.<host>.app): its page messages (D-0196), the keys its pages never receive (D-0312) and the locales it offers (D-0241). An app not listed gets http.pageMessages and every locale."
|
|
82
93
|
},
|
|
83
94
|
"maxPageHeaderBytes": {
|
|
84
95
|
"type": "integer",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dokebi/i18n",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Compiled translation catalogs, locale negotiation, cardinal plurals and named Intl formats.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dokebi",
|
|
@@ -98,6 +98,6 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@dokebi/web": "0.4.
|
|
101
|
+
"@dokebi/web": "0.4.28"
|
|
102
102
|
}
|
|
103
103
|
}
|