@0xchain/i18n 1.1.0-beta.2 → 1.1.0-beta.21

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/dist/request.js CHANGED
@@ -1,15 +1,18 @@
1
- import { getRequestConfig as c } from "next-intl/server";
2
- import { hasLocale as m } from "next-intl";
3
- import { routing as s } from "./routing.js";
4
- import n from "fs";
5
- import f from "path";
6
- const g = c(async ({ requestLocale: t }) => {
7
- const e = await t, o = m(s.locales, e) ? e : s.defaultLocale, r = f.join(process.cwd(), "messages", `${o}.json`), a = JSON.parse(n.readFileSync(r, "utf8"));
1
+ import { getRequestConfig } from "next-intl/server";
2
+ import { hasLocale } from "next-intl";
3
+ import { routing } from "./routing.js";
4
+ import fs from "fs";
5
+ import path from "path";
6
+ const request = getRequestConfig(async ({ requestLocale }) => {
7
+ const requested = await requestLocale;
8
+ const locale = hasLocale(routing.locales, requested) ? requested : routing.defaultLocale;
9
+ const filePath = path.join(process.cwd(), "messages", `${locale}.json`);
10
+ const messages = JSON.parse(fs.readFileSync(filePath, "utf8"));
8
11
  return {
9
- locale: o,
10
- messages: a
12
+ locale,
13
+ messages
11
14
  };
12
15
  });
13
16
  export {
14
- g as default
17
+ request as default
15
18
  };
package/dist/routing.js CHANGED
@@ -1,12 +1,12 @@
1
- import { defineRouting as e } from "next-intl/routing";
2
- const n = e({
1
+ import { defineRouting } from "next-intl/routing";
2
+ const routing = defineRouting({
3
3
  // A list of all locales that are supported
4
4
  locales: ["en", "zh-hans", "zh-hant", "ko", "ja"],
5
5
  // Used when no locale matches
6
6
  defaultLocale: "en",
7
7
  localePrefix: "always",
8
- alternateLinks: !0
8
+ alternateLinks: true
9
9
  });
10
10
  export {
11
- n as routing
11
+ routing
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xchain/i18n",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.21",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -42,9 +42,18 @@
42
42
  "dist",
43
43
  "!**/*.tsbuildinfo"
44
44
  ],
45
- "dependencies": {
46
- "next-intl": "4.6.1",
47
- "next": "15.5.6"
45
+ "peerDependencies": {
46
+ "next": "16.1.6",
47
+ "next-intl": "4.8.2"
48
+ },
49
+ "devDependencies": {
50
+ "next": "16.1.6",
51
+ "next-intl": "4.8.2"
52
+ },
53
+ "nx": {
54
+ "tags": [
55
+ "type:util"
56
+ ]
48
57
  },
49
58
  "publishConfig": {
50
59
  "access": "public"