@better-auth/i18n 1.5.0 → 1.5.1

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/client.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import "./types-m1nrvPWg.mjs";
2
- import { i18n } from "./index.mjs";
1
+ import { t as i18n } from "./index-CLmzQKXC.mjs";
3
2
 
4
3
  //#region src/client.d.ts
5
4
  /**
@@ -1,3 +1,4 @@
1
+ import * as better_call0 from "better-call";
1
2
  import { BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, UnionToIntersection } from "@better-auth/core";
2
3
 
3
4
  //#region src/types.d.ts
@@ -58,5 +59,54 @@ interface I18nOptions<Locales extends string[]> {
58
59
  getLocale?: undefined | ((ctx: GenericEndpointContext) => Promise<Locales[number] | null> | Locales[number] | null);
59
60
  }
60
61
  //#endregion
61
- export { LocaleDetectionStrategy as n, TranslationDictionary as r, I18nOptions as t };
62
- //# sourceMappingURL=types-m1nrvPWg.d.mts.map
62
+ //#region src/index.d.ts
63
+ declare module "@better-auth/core" {
64
+ interface BetterAuthPluginRegistry<AuthOptions, Options> {
65
+ i18n: {
66
+ creator: typeof i18n;
67
+ };
68
+ }
69
+ }
70
+ /**
71
+ * i18n plugin for Better Auth
72
+ *
73
+ * Translates error messages based on detected locale.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * import { betterAuth } from "better-auth";
78
+ * import { i18n } from "@better-auth/i18n";
79
+ *
80
+ * export const auth = betterAuth({
81
+ * plugins: [
82
+ * i18n({
83
+ * translations: {
84
+ * en: { USER_NOT_FOUND: "User not found" },
85
+ * fr: { USER_NOT_FOUND: "Utilisateur non trouvé" },
86
+ * },
87
+ * detection: ["header", "cookie"],
88
+ * }),
89
+ * ],
90
+ * });
91
+ * ```
92
+ */
93
+ declare const i18n: <Locales extends string[]>(options: I18nOptions<Locales>) => {
94
+ id: "i18n";
95
+ hooks: {
96
+ after: {
97
+ matcher: () => true;
98
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
99
+ }[];
100
+ };
101
+ options: {
102
+ translations: { [Locale in Locales[number]]: TranslationDictionary };
103
+ defaultLocale: Locales[number];
104
+ detection: LocaleDetectionStrategy[];
105
+ localeCookie: string;
106
+ userLocaleField: string;
107
+ getLocale?: ((ctx: GenericEndpointContext) => Locales[number] | Promise<Locales[number] | null> | null) | undefined;
108
+ };
109
+ };
110
+ //#endregion
111
+ export { TranslationDictionary as i, I18nOptions as n, LocaleDetectionStrategy as r, i18n as t };
112
+ //# sourceMappingURL=index-CLmzQKXC.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,55 +1,2 @@
1
- import { n as LocaleDetectionStrategy, r as TranslationDictionary, t as I18nOptions } from "./types-m1nrvPWg.mjs";
2
- import * as better_call0 from "better-call";
3
- import { GenericEndpointContext } from "@better-auth/core";
4
-
5
- //#region src/index.d.ts
6
- declare module "@better-auth/core" {
7
- interface BetterAuthPluginRegistry<AuthOptions, Options> {
8
- i18n: {
9
- creator: typeof i18n;
10
- };
11
- }
12
- }
13
- /**
14
- * i18n plugin for Better Auth
15
- *
16
- * Translates error messages based on detected locale.
17
- *
18
- * @example
19
- * ```ts
20
- * import { betterAuth } from "better-auth";
21
- * import { i18n } from "@better-auth/i18n";
22
- *
23
- * export const auth = betterAuth({
24
- * plugins: [
25
- * i18n({
26
- * translations: {
27
- * en: { USER_NOT_FOUND: "User not found" },
28
- * fr: { USER_NOT_FOUND: "Utilisateur non trouvé" },
29
- * },
30
- * detection: ["header", "cookie"],
31
- * }),
32
- * ],
33
- * });
34
- * ```
35
- */
36
- declare const i18n: <Locales extends string[]>(options: I18nOptions<Locales>) => {
37
- id: "i18n";
38
- hooks: {
39
- after: {
40
- matcher: () => true;
41
- handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
42
- }[];
43
- };
44
- options: {
45
- translations: { [Locale in Locales[number]]: TranslationDictionary };
46
- defaultLocale: Locales[number];
47
- detection: LocaleDetectionStrategy[];
48
- localeCookie: string;
49
- userLocaleField: string;
50
- getLocale?: ((ctx: GenericEndpointContext) => Locales[number] | Promise<Locales[number] | null> | null) | undefined;
51
- };
52
- };
53
- //#endregion
54
- export { type I18nOptions, type LocaleDetectionStrategy, type TranslationDictionary, i18n };
55
- //# sourceMappingURL=index.d.mts.map
1
+ import { i as TranslationDictionary, n as I18nOptions, r as LocaleDetectionStrategy, t as i18n } from "./index-CLmzQKXC.mjs";
2
+ export { I18nOptions, LocaleDetectionStrategy, TranslationDictionary, i18n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/i18n",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "i18n plugin for Better Auth - translate error messages",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,13 +49,13 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
- "tsdown": "^0.20.3",
53
- "@better-auth/core": "1.5.0",
54
- "better-auth": "1.5.0"
52
+ "tsdown": "0.21.0-beta.2",
53
+ "@better-auth/core": "1.5.1",
54
+ "better-auth": "1.5.1"
55
55
  },
56
56
  "peerDependencies": {
57
- "@better-auth/core": "1.5.0",
58
- "better-auth": "1.5.0"
57
+ "@better-auth/core": "1.5.1",
58
+ "better-auth": "1.5.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsdown",