express-intlayer 2.0.13 → 3.0.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/README.md CHANGED
@@ -17,8 +17,6 @@
17
17
  </a>
18
18
  </div>
19
19
 
20
- Here's a draft for the `README.md` file for your `express-intlayer` package:
21
-
22
20
  # express-intlayer
23
21
 
24
22
  `express-intlayer` is a powerful internationalization (i18n) middleware for Express applications, designed to make your backend services globally accessible by providing localized responses based on the client's preferences.
@@ -48,7 +46,7 @@ By internationalizing the backend, your application not only respects cultural d
48
46
  To begin using `express-intlayer`, install the package using npm:
49
47
 
50
48
  ```bash
51
- npm install express-intlayer
49
+ npm install intlayer express-intlayer
52
50
  ```
53
51
 
54
52
  ### Setup
@@ -113,7 +111,7 @@ app.get("/error", (_req, res) => {
113
111
 
114
112
  // Start server
115
113
  app.listen(3000, () => {
116
- console.info(`Listening on port ${3000}`);
114
+ console.info(`Listening on port 3000`);
117
115
  });
118
116
  ```
119
117
 
@@ -130,15 +128,7 @@ It also works seamlessly with any internationalization solution across various e
130
128
  import { Locales, type IntlayerConfig } from "intlayer";
131
129
 
132
130
  const config: IntlayerConfig = {
133
- internationalization: {
134
- locales: [
135
- Locales.ENGLISH,
136
- Locales.FRENCH,
137
- Locales.SPANISH_MEXICO,
138
- Locales.SPANISH_SPAIN,
139
- ],
140
- defaultLocale: Locales.ENGLISH,
141
- },
131
+ // Other configuration options
142
132
  middleware: {
143
133
  headerName: "my-locale-header",
144
134
  cookieName: "my-locale-cookie",
@@ -148,12 +138,10 @@ const config: IntlayerConfig = {
148
138
 
149
139
  By default, `express-intlayer` will interpret the `Accept-Language` header to determine the client's preferred language.
150
140
 
141
+ > For more information on configuration and advanced topics, visit our [documentation](https://intlayer.org/doc/concept/configuration).
142
+
151
143
  ## Powered by TypeScript
152
144
 
153
145
  `express-intlayer` leverages the robust capabilities of TypeScript to enhance the internationalization process. TypeScript's static typing ensures that every translation key is accounted for, reducing the risk of missing translations and improving maintainability.
154
146
 
155
147
  > Ensure the generated types (by default at ./types/intlayer.d.ts) are included in your tsconfig.json file.
156
-
157
- ---
158
-
159
- For more information on configuration and advanced topics, visit our [documentation](https://intlayer.org/doc/concept/configuration).
@@ -34,7 +34,14 @@ const { headerName, cookieName } = middleware;
34
34
  const appNamespace = (0, import_cls_hooked.createNamespace)("app");
35
35
  (0, import_chokidar.createModuleAugmentation)();
36
36
  const translateFunction = (_req, res, _next) => (content) => {
37
- const locale = res.locals.locale;
37
+ const { locale, defaultLocale } = res.locals;
38
+ if (typeof content[locale] === "undefined") {
39
+ if (typeof content[defaultLocale] === "undefined") {
40
+ return content;
41
+ } else {
42
+ return (0, import_core.getTranslationContent)(content, defaultLocale);
43
+ }
44
+ }
38
45
  return (0, import_core.getTranslationContent)(content, locale);
39
46
  };
40
47
  const intlayer = () => (req, res, next) => {
@@ -57,6 +64,7 @@ const intlayer = () => (req, res, next) => {
57
64
  res.locals.locale_cookie = localeCookie;
58
65
  res.locals.locale_detected = localeDetected;
59
66
  res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;
67
+ res.locals.defaultLocale = internationalization.defaultLocale;
60
68
  const t2 = translateFunction(req, res, next);
61
69
  res.locals.t = t2;
62
70
  appNamespace.run(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { createModuleAugmentation } from '@intlayer/chokidar';\nimport { type Locales, getConfiguration } from '@intlayer/config';\nimport { getTranslationContent, localeDetector } from '@intlayer/core';\nimport { createNamespace } from 'cls-hooked';\nimport type { NextFunction, RequestHandler, Request, Response } from 'express';\nimport { type IConfigLocales } from 'intlayer';\n\nconst { middleware, internationalization } = getConfiguration({\n verbose: true,\n});\nconst { headerName, cookieName } = middleware;\n\nconst appNamespace = createNamespace('app');\n\ncreateModuleAugmentation();\n\nexport const translateFunction =\n (_req: Request, res: Response, _next?: NextFunction) =>\n <T extends string>(content: IConfigLocales<T>): T => {\n const locale: Locales = res.locals.locale;\n\n return getTranslationContent(content, locale);\n };\n\n/**\n * Detect locale used by the user and load it into res locale storage\n *\n * @returns\n */\nexport const intlayer = (): RequestHandler => (req, res, next) => {\n // Detect if locale is set by intlayer frontend lib in the cookies\n const localeCookie = req.cookies?.[cookieName];\n // Detect if locale is set by intlayer frontend lib in the headers\n const localeHeader = req.headers?.[headerName];\n // Interpret browser locale\n\n const negotiatorHeaders: Record<string, string> = {};\n\n // // Check if req.headers exists and is an object\n if (req && typeof req.headers === 'object') {\n // Copy all headers from the request to negotiatorHeaders\n for (const key in req.headers) {\n if (typeof req.headers[key] === 'string') {\n negotiatorHeaders[key] = req.headers[key];\n }\n }\n }\n\n const localeDetected = localeDetector(\n negotiatorHeaders,\n internationalization.locales,\n internationalization.defaultLocale\n );\n\n res.locals.locale_header = localeHeader;\n res.locals.locale_cookie = localeCookie;\n res.locals.locale_detected = localeDetected;\n res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;\n\n const t = translateFunction(req, res, next);\n res.locals.t = t;\n\n appNamespace.run(() => {\n appNamespace.set('t', t);\n\n next();\n });\n};\n\nexport const t = (content: IConfigLocales<string>) =>\n appNamespace.get('t')(content);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyC;AACzC,oBAA+C;AAC/C,kBAAsD;AACtD,wBAAgC;AAIhC,MAAM,EAAE,YAAY,qBAAqB,QAAI,gCAAiB;AAAA,EAC5D,SAAS;AACX,CAAC;AACD,MAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,MAAM,mBAAe,mCAAgB,KAAK;AAAA,IAE1C,0CAAyB;AAElB,MAAM,oBACX,CAAC,MAAe,KAAe,UAC/B,CAAmB,YAAkC;AACnD,QAAM,SAAkB,IAAI,OAAO;AAEnC,aAAO,mCAAsB,SAAS,MAAM;AAC9C;AAOK,MAAM,WAAW,MAAsB,CAAC,KAAK,KAAK,SAAS;AAEhE,QAAM,eAAe,IAAI,UAAU,UAAU;AAE7C,QAAM,eAAe,IAAI,UAAU,UAAU;AAG7C,QAAM,oBAA4C,CAAC;AAGnD,MAAI,OAAO,OAAO,IAAI,YAAY,UAAU;AAE1C,eAAW,OAAO,IAAI,SAAS;AAC7B,UAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,UAAU;AACxC,0BAAkB,GAAG,IAAI,IAAI,QAAQ,GAAG;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAEA,QAAM,qBAAiB;AAAA,IACrB;AAAA,IACA,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACvB;AAEA,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,kBAAkB;AAC7B,MAAI,OAAO,SAAS,gBAAgB,gBAAgB;AAEpD,QAAMA,KAAI,kBAAkB,KAAK,KAAK,IAAI;AAC1C,MAAI,OAAO,IAAIA;AAEf,eAAa,IAAI,MAAM;AACrB,iBAAa,IAAI,KAAKA,EAAC;AAEvB,SAAK;AAAA,EACP,CAAC;AACH;AAEO,MAAM,IAAI,CAAC,YAChB,aAAa,IAAI,GAAG,EAAE,OAAO;","names":["t"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { createModuleAugmentation } from '@intlayer/chokidar';\nimport { type Locales, getConfiguration } from '@intlayer/config';\nimport { getTranslationContent, localeDetector } from '@intlayer/core';\nimport { createNamespace } from 'cls-hooked';\nimport type { NextFunction, RequestHandler, Request, Response } from 'express';\nimport { type IConfigLocales } from 'intlayer';\n\nconst { middleware, internationalization } = getConfiguration({\n verbose: true,\n});\nconst { headerName, cookieName } = middleware;\n\nconst appNamespace = createNamespace('app');\n\ncreateModuleAugmentation();\n\nexport const translateFunction =\n (_req: Request, res: Response, _next?: NextFunction) =>\n <T extends string>(content: IConfigLocales<T>): T => {\n const { locale, defaultLocale } = res.locals as {\n locale: Locales;\n defaultLocale: Locales;\n };\n\n if (\n typeof content[locale as unknown as keyof IConfigLocales<T>] ===\n 'undefined'\n ) {\n if (\n typeof content[defaultLocale as unknown as keyof IConfigLocales<T>] ===\n 'undefined'\n ) {\n return content as unknown as T;\n } else {\n return getTranslationContent(content, defaultLocale);\n }\n }\n\n return getTranslationContent(content, locale);\n };\n\n/**\n * Detect locale used by the user and load it into res locale storage\n *\n * @returns\n */\nexport const intlayer = (): RequestHandler => (req, res, next) => {\n // Detect if locale is set by intlayer frontend lib in the cookies\n const localeCookie = req.cookies?.[cookieName];\n // Detect if locale is set by intlayer frontend lib in the headers\n const localeHeader = req.headers?.[headerName];\n // Interpret browser locale\n\n const negotiatorHeaders: Record<string, string> = {};\n\n // // Check if req.headers exists and is an object\n if (req && typeof req.headers === 'object') {\n // Copy all headers from the request to negotiatorHeaders\n for (const key in req.headers) {\n if (typeof req.headers[key] === 'string') {\n negotiatorHeaders[key] = req.headers[key];\n }\n }\n }\n\n const localeDetected = localeDetector(\n negotiatorHeaders,\n internationalization.locales,\n internationalization.defaultLocale\n );\n\n res.locals.locale_header = localeHeader;\n res.locals.locale_cookie = localeCookie;\n res.locals.locale_detected = localeDetected;\n res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;\n res.locals.defaultLocale = internationalization.defaultLocale;\n\n const t = translateFunction(req, res, next);\n res.locals.t = t;\n\n appNamespace.run(() => {\n appNamespace.set('t', t);\n\n next();\n });\n};\n\ntype LanguageContent<Content = string> = IConfigLocales<Content>;\n\nexport const t = <Content = string>(content: LanguageContent<Content>) =>\n appNamespace.get('t')(content);\n\nexport { LanguageContent };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyC;AACzC,oBAA+C;AAC/C,kBAAsD;AACtD,wBAAgC;AAIhC,MAAM,EAAE,YAAY,qBAAqB,QAAI,gCAAiB;AAAA,EAC5D,SAAS;AACX,CAAC;AACD,MAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,MAAM,mBAAe,mCAAgB,KAAK;AAAA,IAE1C,0CAAyB;AAElB,MAAM,oBACX,CAAC,MAAe,KAAe,UAC/B,CAAmB,YAAkC;AACnD,QAAM,EAAE,QAAQ,cAAc,IAAI,IAAI;AAKtC,MACE,OAAO,QAAQ,MAA4C,MAC3D,aACA;AACA,QACE,OAAO,QAAQ,aAAmD,MAClE,aACA;AACA,aAAO;AAAA,IACT,OAAO;AACL,iBAAO,mCAAsB,SAAS,aAAa;AAAA,IACrD;AAAA,EACF;AAEA,aAAO,mCAAsB,SAAS,MAAM;AAC9C;AAOK,MAAM,WAAW,MAAsB,CAAC,KAAK,KAAK,SAAS;AAEhE,QAAM,eAAe,IAAI,UAAU,UAAU;AAE7C,QAAM,eAAe,IAAI,UAAU,UAAU;AAG7C,QAAM,oBAA4C,CAAC;AAGnD,MAAI,OAAO,OAAO,IAAI,YAAY,UAAU;AAE1C,eAAW,OAAO,IAAI,SAAS;AAC7B,UAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,UAAU;AACxC,0BAAkB,GAAG,IAAI,IAAI,QAAQ,GAAG;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAEA,QAAM,qBAAiB;AAAA,IACrB;AAAA,IACA,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACvB;AAEA,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,kBAAkB;AAC7B,MAAI,OAAO,SAAS,gBAAgB,gBAAgB;AACpD,MAAI,OAAO,gBAAgB,qBAAqB;AAEhD,QAAMA,KAAI,kBAAkB,KAAK,KAAK,IAAI;AAC1C,MAAI,OAAO,IAAIA;AAEf,eAAa,IAAI,MAAM;AACrB,iBAAa,IAAI,KAAKA,EAAC;AAEvB,SAAK;AAAA,EACP,CAAC;AACH;AAIO,MAAM,IAAI,CAAmB,YAClC,aAAa,IAAI,GAAG,EAAE,OAAO;","names":["t"]}
@@ -9,7 +9,14 @@ const { headerName, cookieName } = middleware;
9
9
  const appNamespace = createNamespace("app");
10
10
  createModuleAugmentation();
11
11
  const translateFunction = (_req, res, _next) => (content) => {
12
- const locale = res.locals.locale;
12
+ const { locale, defaultLocale } = res.locals;
13
+ if (typeof content[locale] === "undefined") {
14
+ if (typeof content[defaultLocale] === "undefined") {
15
+ return content;
16
+ } else {
17
+ return getTranslationContent(content, defaultLocale);
18
+ }
19
+ }
13
20
  return getTranslationContent(content, locale);
14
21
  };
15
22
  const intlayer = () => (req, res, next) => {
@@ -32,6 +39,7 @@ const intlayer = () => (req, res, next) => {
32
39
  res.locals.locale_cookie = localeCookie;
33
40
  res.locals.locale_detected = localeDetected;
34
41
  res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;
42
+ res.locals.defaultLocale = internationalization.defaultLocale;
35
43
  const t2 = translateFunction(req, res, next);
36
44
  res.locals.t = t2;
37
45
  appNamespace.run(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { createModuleAugmentation } from '@intlayer/chokidar';\nimport { type Locales, getConfiguration } from '@intlayer/config';\nimport { getTranslationContent, localeDetector } from '@intlayer/core';\nimport { createNamespace } from 'cls-hooked';\nimport type { NextFunction, RequestHandler, Request, Response } from 'express';\nimport { type IConfigLocales } from 'intlayer';\n\nconst { middleware, internationalization } = getConfiguration({\n verbose: true,\n});\nconst { headerName, cookieName } = middleware;\n\nconst appNamespace = createNamespace('app');\n\ncreateModuleAugmentation();\n\nexport const translateFunction =\n (_req: Request, res: Response, _next?: NextFunction) =>\n <T extends string>(content: IConfigLocales<T>): T => {\n const locale: Locales = res.locals.locale;\n\n return getTranslationContent(content, locale);\n };\n\n/**\n * Detect locale used by the user and load it into res locale storage\n *\n * @returns\n */\nexport const intlayer = (): RequestHandler => (req, res, next) => {\n // Detect if locale is set by intlayer frontend lib in the cookies\n const localeCookie = req.cookies?.[cookieName];\n // Detect if locale is set by intlayer frontend lib in the headers\n const localeHeader = req.headers?.[headerName];\n // Interpret browser locale\n\n const negotiatorHeaders: Record<string, string> = {};\n\n // // Check if req.headers exists and is an object\n if (req && typeof req.headers === 'object') {\n // Copy all headers from the request to negotiatorHeaders\n for (const key in req.headers) {\n if (typeof req.headers[key] === 'string') {\n negotiatorHeaders[key] = req.headers[key];\n }\n }\n }\n\n const localeDetected = localeDetector(\n negotiatorHeaders,\n internationalization.locales,\n internationalization.defaultLocale\n );\n\n res.locals.locale_header = localeHeader;\n res.locals.locale_cookie = localeCookie;\n res.locals.locale_detected = localeDetected;\n res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;\n\n const t = translateFunction(req, res, next);\n res.locals.t = t;\n\n appNamespace.run(() => {\n appNamespace.set('t', t);\n\n next();\n });\n};\n\nexport const t = (content: IConfigLocales<string>) =>\n appNamespace.get('t')(content);\n"],"mappings":"AAAA,SAAS,gCAAgC;AACzC,SAAuB,wBAAwB;AAC/C,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,uBAAuB;AAIhC,MAAM,EAAE,YAAY,qBAAqB,IAAI,iBAAiB;AAAA,EAC5D,SAAS;AACX,CAAC;AACD,MAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,MAAM,eAAe,gBAAgB,KAAK;AAE1C,yBAAyB;AAElB,MAAM,oBACX,CAAC,MAAe,KAAe,UAC/B,CAAmB,YAAkC;AACnD,QAAM,SAAkB,IAAI,OAAO;AAEnC,SAAO,sBAAsB,SAAS,MAAM;AAC9C;AAOK,MAAM,WAAW,MAAsB,CAAC,KAAK,KAAK,SAAS;AAEhE,QAAM,eAAe,IAAI,UAAU,UAAU;AAE7C,QAAM,eAAe,IAAI,UAAU,UAAU;AAG7C,QAAM,oBAA4C,CAAC;AAGnD,MAAI,OAAO,OAAO,IAAI,YAAY,UAAU;AAE1C,eAAW,OAAO,IAAI,SAAS;AAC7B,UAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,UAAU;AACxC,0BAAkB,GAAG,IAAI,IAAI,QAAQ,GAAG;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAEA,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACvB;AAEA,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,kBAAkB;AAC7B,MAAI,OAAO,SAAS,gBAAgB,gBAAgB;AAEpD,QAAMA,KAAI,kBAAkB,KAAK,KAAK,IAAI;AAC1C,MAAI,OAAO,IAAIA;AAEf,eAAa,IAAI,MAAM;AACrB,iBAAa,IAAI,KAAKA,EAAC;AAEvB,SAAK;AAAA,EACP,CAAC;AACH;AAEO,MAAM,IAAI,CAAC,YAChB,aAAa,IAAI,GAAG,EAAE,OAAO;","names":["t"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { createModuleAugmentation } from '@intlayer/chokidar';\nimport { type Locales, getConfiguration } from '@intlayer/config';\nimport { getTranslationContent, localeDetector } from '@intlayer/core';\nimport { createNamespace } from 'cls-hooked';\nimport type { NextFunction, RequestHandler, Request, Response } from 'express';\nimport { type IConfigLocales } from 'intlayer';\n\nconst { middleware, internationalization } = getConfiguration({\n verbose: true,\n});\nconst { headerName, cookieName } = middleware;\n\nconst appNamespace = createNamespace('app');\n\ncreateModuleAugmentation();\n\nexport const translateFunction =\n (_req: Request, res: Response, _next?: NextFunction) =>\n <T extends string>(content: IConfigLocales<T>): T => {\n const { locale, defaultLocale } = res.locals as {\n locale: Locales;\n defaultLocale: Locales;\n };\n\n if (\n typeof content[locale as unknown as keyof IConfigLocales<T>] ===\n 'undefined'\n ) {\n if (\n typeof content[defaultLocale as unknown as keyof IConfigLocales<T>] ===\n 'undefined'\n ) {\n return content as unknown as T;\n } else {\n return getTranslationContent(content, defaultLocale);\n }\n }\n\n return getTranslationContent(content, locale);\n };\n\n/**\n * Detect locale used by the user and load it into res locale storage\n *\n * @returns\n */\nexport const intlayer = (): RequestHandler => (req, res, next) => {\n // Detect if locale is set by intlayer frontend lib in the cookies\n const localeCookie = req.cookies?.[cookieName];\n // Detect if locale is set by intlayer frontend lib in the headers\n const localeHeader = req.headers?.[headerName];\n // Interpret browser locale\n\n const negotiatorHeaders: Record<string, string> = {};\n\n // // Check if req.headers exists and is an object\n if (req && typeof req.headers === 'object') {\n // Copy all headers from the request to negotiatorHeaders\n for (const key in req.headers) {\n if (typeof req.headers[key] === 'string') {\n negotiatorHeaders[key] = req.headers[key];\n }\n }\n }\n\n const localeDetected = localeDetector(\n negotiatorHeaders,\n internationalization.locales,\n internationalization.defaultLocale\n );\n\n res.locals.locale_header = localeHeader;\n res.locals.locale_cookie = localeCookie;\n res.locals.locale_detected = localeDetected;\n res.locals.locale = localeCookie ?? localeHeader ?? localeDetected;\n res.locals.defaultLocale = internationalization.defaultLocale;\n\n const t = translateFunction(req, res, next);\n res.locals.t = t;\n\n appNamespace.run(() => {\n appNamespace.set('t', t);\n\n next();\n });\n};\n\ntype LanguageContent<Content = string> = IConfigLocales<Content>;\n\nexport const t = <Content = string>(content: LanguageContent<Content>) =>\n appNamespace.get('t')(content);\n\nexport { LanguageContent };\n"],"mappings":"AAAA,SAAS,gCAAgC;AACzC,SAAuB,wBAAwB;AAC/C,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,uBAAuB;AAIhC,MAAM,EAAE,YAAY,qBAAqB,IAAI,iBAAiB;AAAA,EAC5D,SAAS;AACX,CAAC;AACD,MAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,MAAM,eAAe,gBAAgB,KAAK;AAE1C,yBAAyB;AAElB,MAAM,oBACX,CAAC,MAAe,KAAe,UAC/B,CAAmB,YAAkC;AACnD,QAAM,EAAE,QAAQ,cAAc,IAAI,IAAI;AAKtC,MACE,OAAO,QAAQ,MAA4C,MAC3D,aACA;AACA,QACE,OAAO,QAAQ,aAAmD,MAClE,aACA;AACA,aAAO;AAAA,IACT,OAAO;AACL,aAAO,sBAAsB,SAAS,aAAa;AAAA,IACrD;AAAA,EACF;AAEA,SAAO,sBAAsB,SAAS,MAAM;AAC9C;AAOK,MAAM,WAAW,MAAsB,CAAC,KAAK,KAAK,SAAS;AAEhE,QAAM,eAAe,IAAI,UAAU,UAAU;AAE7C,QAAM,eAAe,IAAI,UAAU,UAAU;AAG7C,QAAM,oBAA4C,CAAC;AAGnD,MAAI,OAAO,OAAO,IAAI,YAAY,UAAU;AAE1C,eAAW,OAAO,IAAI,SAAS;AAC7B,UAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,UAAU;AACxC,0BAAkB,GAAG,IAAI,IAAI,QAAQ,GAAG;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AAEA,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EACvB;AAEA,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,gBAAgB;AAC3B,MAAI,OAAO,kBAAkB;AAC7B,MAAI,OAAO,SAAS,gBAAgB,gBAAgB;AACpD,MAAI,OAAO,gBAAgB,qBAAqB;AAEhD,QAAMA,KAAI,kBAAkB,KAAK,KAAK,IAAI;AAC1C,MAAI,OAAO,IAAIA;AAEf,eAAa,IAAI,MAAM;AACrB,iBAAa,IAAI,KAAKA,EAAC;AAEvB,SAAK;AAAA,EACP,CAAC;AACH;AAIO,MAAM,IAAI,CAAmB,YAClC,aAAa,IAAI,GAAG,EAAE,OAAO;","names":["t"]}
@@ -7,5 +7,7 @@ export declare const translateFunction: (_req: Request, res: Response, _next?: N
7
7
  * @returns
8
8
  */
9
9
  export declare const intlayer: () => RequestHandler;
10
- export declare const t: (content: IConfigLocales<string>) => any;
10
+ type LanguageContent<Content = string> = IConfigLocales<Content>;
11
+ export declare const t: <Content = string>(content: LanguageContent<Content>) => any;
12
+ export { LanguageContent };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAW/C,eAAO,MAAM,iBAAiB,SACrB,OAAO,OAAO,QAAQ,UAAU,YAAY,MAClD,CAAC,SAAS,MAAM,WAAW,cAAc,CAAC,CAAC,CAAC,KAAG,CAI/C,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAO,cAsC3B,CAAC;AAEF,eAAO,MAAM,CAAC,YAAa,cAAc,CAAC,MAAM,CAAC,QACjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAW/C,eAAO,MAAM,iBAAiB,SACrB,OAAO,OAAO,QAAQ,UAAU,YAAY,MAClD,CAAC,SAAS,MAAM,WAAW,cAAc,CAAC,CAAC,CAAC,KAAG,CAqB/C,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAO,cAuC3B,CAAC;AAEF,KAAK,eAAe,CAAC,OAAO,GAAG,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;AAEjE,eAAO,MAAM,CAAC,GAAI,OAAO,oBAAoB,eAAe,CAAC,OAAO,CAAC,QACrC,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-intlayer",
3
- "version": "2.0.13",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "description": "Manage internationalization in a simple way for express application.",
6
6
  "keywords": [
@@ -62,10 +62,10 @@
62
62
  "dependencies": {
63
63
  "cls-hooked": "^4.2.2",
64
64
  "webpack": "^5.92.1",
65
- "@intlayer/chokidar": "^2.0.13",
66
- "@intlayer/core": "^2.0.13",
67
- "@intlayer/config": "^2.0.13",
68
- "intlayer": "^2.0.13"
65
+ "@intlayer/core": "^3.0.1",
66
+ "intlayer": "^3.0.1",
67
+ "@intlayer/config": "^3.0.1",
68
+ "@intlayer/chokidar": "^3.0.1"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@changesets/changelog-github": "0.5.0",
@@ -81,9 +81,9 @@
81
81
  "tsc-alias": "^1.8.10",
82
82
  "tsup": "^8.3.0",
83
83
  "typescript": "^5.5.2",
84
+ "@utils/ts-config-types": "^1.0.4",
84
85
  "@utils/eslint-config": "^1.0.4",
85
86
  "@utils/ts-config": "^1.0.4",
86
- "@utils/ts-config-types": "^1.0.4",
87
87
  "@utils/tsup-config": "^1.0.4"
88
88
  },
89
89
  "engines": {