weifuwu 0.17.17 → 0.17.18

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1430,7 +1430,7 @@ function buildHeadPayload(opts) {
1430
1430
  result += `<link rel="stylesheet" href="${base}/__wfw/style.css" />
1431
1431
  `;
1432
1432
  }
1433
- const localeData = ctx.parsed?.__localeData;
1433
+ const localeData = ctx.parsed?.__localeData ?? globalThis.__LOCALE_DATA__;
1434
1434
  if (localeData && Object.keys(localeData).length > 0) {
1435
1435
  result += `<script>window.__LOCALE_DATA__=${JSON.stringify(localeData)}</script>
1436
1436
  `;
@@ -7227,6 +7227,7 @@ function preferences(options) {
7227
7227
  if (dir) {
7228
7228
  const msgs = await load(locale);
7229
7229
  ctx.t = (key, params, fallback) => translate(msgs, key, params, fallback);
7230
+ globalThis.__LOCALE_DATA__ = msgs;
7230
7231
  ctx.parsed = { ...ctx.parsed, __localeData: msgs };
7231
7232
  }
7232
7233
  ctx.setPref = (name, value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weifuwu",
3
- "version": "0.17.17",
3
+ "version": "0.17.18",
4
4
  "description": "Web-standard HTTP framework for Node.js — (req, ctx) => Response",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",