intor 2.2.5 → 2.2.7

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.
@@ -23,7 +23,7 @@ var Keyv__default = /*#__PURE__*/_interopDefault(Keyv);
23
23
  // src/adapters/next/shared/constants/pathname-header-name.ts
24
24
  var PATHNAME_HEADER_NAME = "x-intor-pathname";
25
25
 
26
- // src/shared/logger/global-logger-pool.ts
26
+ // src/server/shared/logger/global-logger-pool.ts
27
27
  function getGlobalLoggerPool() {
28
28
  if (!globalThis.__INTOR_LOGGER_POOL__) {
29
29
  globalThis.__INTOR_LOGGER_POOL__ = /* @__PURE__ */ new Map();
@@ -31,7 +31,7 @@ function getGlobalLoggerPool() {
31
31
  return globalThis.__INTOR_LOGGER_POOL__;
32
32
  }
33
33
 
34
- // src/shared/logger/get-logger.ts
34
+ // src/server/shared/logger/get-logger.ts
35
35
  var DEFAULT_FORMATTER_CONFIG = {
36
36
  node: { meta: { compact: true }, lineBreaksAfter: 1 }
37
37
  };
@@ -241,7 +241,7 @@ var getI18nContext = async (config) => {
241
241
  };
242
242
  };
243
243
 
244
- // src/modules/config/constants/cache.constants.ts
244
+ // src/config/constants/cache.constants.ts
245
245
  var DEFAULT_CACHE_OPTIONS = {
246
246
  enabled: process.env.NODE_ENV === "production",
247
247
  ttl: 60 * 60 * 1e3
@@ -309,7 +309,7 @@ async function collectFileEntries({
309
309
  return results;
310
310
  }
311
311
 
312
- // src/modules/messages/shared/utils/is-valid-messages.ts
312
+ // src/server/messages/shared/utils/is-valid-messages.ts
313
313
  function isPlainObject(value) {
314
314
  return typeof value === "object" && value !== null && !Array.isArray(value);
315
315
  }
@@ -335,7 +335,7 @@ async function jsonReader(filePath, readFile = fs__default.default.readFile) {
335
335
  return parsed;
336
336
  }
337
337
 
338
- // src/modules/messages/load-local-messages/read-locale-messages/parse-file-entries/utils/nest-object-from-path.ts
338
+ // src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/utils/nest-object-from-path.ts
339
339
  function nestObjectFromPath(path5, value) {
340
340
  let obj = value;
341
341
  for (let i = path5.length - 1; i >= 0; i--) {
@@ -344,7 +344,7 @@ function nestObjectFromPath(path5, value) {
344
344
  return obj;
345
345
  }
346
346
 
347
- // src/modules/messages/load-local-messages/read-locale-messages/parse-file-entries/parse-file-entries.ts
347
+ // src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/parse-file-entries.ts
348
348
  async function parseFileEntries({
349
349
  fileEntries,
350
350
  limit,
@@ -392,7 +392,7 @@ async function parseFileEntries({
392
392
  return result;
393
393
  }
394
394
 
395
- // src/modules/messages/load-local-messages/read-locale-messages/read-locale-messages.ts
395
+ // src/server/messages/load-local-messages/read-locale-messages/read-locale-messages.ts
396
396
  var readLocaleMessages = async ({
397
397
  limit,
398
398
  rootDir = "messages",
@@ -421,7 +421,7 @@ function getGlobalMessagesPool() {
421
421
  return globalThis.__INTOR_MESSAGES_POOL__;
422
422
  }
423
423
 
424
- // src/modules/messages/load-local-messages/load-local-messages.ts
424
+ // src/server/messages/load-local-messages/load-local-messages.ts
425
425
  var loadLocalMessages = async ({
426
426
  pool = getGlobalMessagesPool(),
427
427
  rootDir = "messages",
@@ -494,7 +494,7 @@ var loadLocalMessages = async ({
494
494
  return messages;
495
495
  };
496
496
 
497
- // src/modules/messages/load-remote-messages/fetch-locale-messages/fetch-locale-messages.ts
497
+ // src/server/messages/load-remote-messages/fetch-locale-messages/fetch-locale-messages.ts
498
498
  var fetchLocaleMessages = async ({
499
499
  remoteUrl,
500
500
  remoteHeaders,
@@ -536,7 +536,7 @@ var fetchLocaleMessages = async ({
536
536
  }
537
537
  };
538
538
 
539
- // src/modules/messages/load-remote-messages/fetch-locale-messages/utils/build-search-params.ts
539
+ // src/server/messages/load-remote-messages/fetch-locale-messages/utils/build-search-params.ts
540
540
  var buildSearchParams = (params) => {
541
541
  const searchParams = new URLSearchParams();
542
542
  const appendParam = (key, value) => {
@@ -554,7 +554,7 @@ var buildSearchParams = (params) => {
554
554
  return searchParams;
555
555
  };
556
556
 
557
- // src/modules/messages/load-remote-messages/load-remote-messages.ts
557
+ // src/server/messages/load-remote-messages/load-remote-messages.ts
558
558
  var loadRemoteMessages = async ({
559
559
  pool = getGlobalMessagesPool(),
560
560
  rootDir,
@@ -623,7 +623,7 @@ var loadRemoteMessages = async ({
623
623
  return messages;
624
624
  };
625
625
 
626
- // src/modules/messages/load-messages.ts
626
+ // src/server/messages/load-messages.ts
627
627
  var loadMessages = async ({
628
628
  config,
629
629
  locale,
@@ -689,17 +689,22 @@ var loadMessages = async ({
689
689
  return loadedMessages;
690
690
  };
691
691
 
692
- // src/modules/translator/get-translator.ts
693
- async function getTranslator(opts) {
694
- const { config, locale, pathname = "", preKey, handlers } = opts;
695
- const messages = await loadMessages({ config, locale, pathname });
692
+ // src/server/translator/get-translator.ts
693
+ async function getTranslator(options) {
694
+ const { config, locale, pathname = "", preKey } = options;
695
+ const messages = await loadMessages({
696
+ config,
697
+ locale,
698
+ pathname,
699
+ extraOptions: options.extraOptions
700
+ });
696
701
  const translator = new intorTranslator.Translator({
697
702
  locale,
698
703
  messages,
699
704
  fallbackLocales: config.fallbackLocales,
700
705
  loadingMessage: config.translator?.loadingMessage,
701
706
  placeholder: config.translator?.placeholder,
702
- handlers
707
+ handlers: options.handlers
703
708
  });
704
709
  const props = { messages, locale };
705
710
  const scoped = translator.scoped(preKey);
@@ -711,12 +716,15 @@ async function getTranslator(opts) {
711
716
  }
712
717
 
713
718
  // src/adapters/next/server/get-translator.ts
714
- async function getTranslator2(config, preKey) {
719
+ async function getTranslator2(options) {
720
+ const { config, preKey, handlers, extraOptions } = options;
715
721
  const { locale, pathname } = await getI18nContext(config);
716
722
  const translatorInstance = getTranslator({
717
723
  config,
718
724
  locale,
719
725
  pathname,
726
+ handlers,
727
+ extraOptions,
720
728
  preKey
721
729
  });
722
730
  return translatorInstance;
@@ -1,5 +1,7 @@
1
1
  import { Level, NormalizerConfig, FormatterConfig, LoggerPreset } from 'logry/edge';
2
- import { Locale, LocaleMessages, FallbackLocalesMap, ScopedLeafKeys, LocalizedLeafKeys, Replacement, LocalizedNodeKeys } from 'intor-translator';
2
+ import { Locale, LocaleMessages, FallbackLocalesMap, NestedMessage, ScopedLeafKeys, LocalizedLeafKeys, Replacement, TranslateHandlers, LocalizedNodeKeys } from 'intor-translator';
3
+ import Keyv from 'keyv';
4
+ import { Logger } from 'logry';
3
5
 
4
6
  type CookieRawOptions = {
5
7
  /** Completely disable cookie usage (no read, no write, no lookup by name) - default: false */
@@ -162,6 +164,53 @@ interface I18nContext {
162
164
  */
163
165
  declare const getI18nContext: <CK extends GenConfigKeys = "__default__">(config: IntorResolvedConfig) => Promise<I18nContext>;
164
166
 
167
+ /**
168
+ * Represents a collection of localized messages.
169
+ *
170
+ * - Each key is a namespace or message identifier, and the value is a
171
+ * `NestedMessage` object that can contain nested message structures.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const messages: Messages = {
176
+ * ui: {
177
+ * greeting: "Hello",
178
+ * farewell: "Goodbye"
179
+ * },
180
+ * errors: {
181
+ * network: "Network error occurred"
182
+ * }
183
+ * };
184
+ * ```
185
+ */
186
+ type Messages = Record<string, NestedMessage>;
187
+ /**
188
+ * A function that reads messages from a given file path.
189
+ *
190
+ * - This function is expected to return a `Promise` that resolves to a `Messages` object.
191
+ * - It can be implemented to support different file formats such as JSON, YAML, or others.
192
+ *
193
+ * @param filePath - The path to the message file to read.
194
+ * @returns A Promise that resolves to a `Messages` object.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * const reader: MessagesReader = async (filePath) => {
199
+ * const content = await fs.promises.readFile(filePath, "utf-8");
200
+ * return JSON.parse(content) as Messages;
201
+ * };
202
+ * ```
203
+ */
204
+ type MessagesReader = (filePath: string) => Promise<Messages>;
205
+
206
+ /**
207
+ * Global messages pool (cross-module + hot-reload safe)
208
+ */
209
+ type MessagesPool = Keyv<LocaleMessages>;
210
+ declare global {
211
+ var __INTOR_MESSAGES_POOL__: MessagesPool | undefined;
212
+ }
213
+
165
214
  /** Base properties shared by all translator instances. */
166
215
  interface TranslatorBaseProps<M = unknown> {
167
216
  /** `messages`: The message object containing all translations. */
@@ -193,16 +242,38 @@ type TranslatorInstance<M, PK extends string | undefined = undefined> = {
193
242
  t: <Result = string>(key?: Key<M, PK>, replacements?: Replacement) => Result;
194
243
  } & TranslatorBaseProps<M> & TranslatorClientProps<M>;
195
244
 
245
+ /**
246
+ * Global logger pool (cross-module + hot-reload safe)
247
+ */
248
+ type LoggerPool = Map<string, Logger>;
249
+ declare global {
250
+ var __INTOR_LOGGER_POOL__: LoggerPool | undefined;
251
+ }
252
+
196
253
  /**
197
254
  * Create a translator instance ready for the current Next.js SSR environment.
198
255
  *
199
- * - Automatically resolves the current locale and pathname using the Next.js adapter.
200
- * - Loads all corresponding messages for the resolved locale and pathname.
201
- * - Returns a translator object containing `t`, `hasKey`, `messages`, and other helpers.
202
- * - Supports optional `preKey` to create a scoped translator for nested translation keys.
203
- * - Allows passing additional `TranslateConfig` options to the underlying translator.
256
+ * - **Automatically resolves the current locale and pathname using the Next.js adapter.**
257
+ * - Loads messages using the provided config, locale, and pathname.
258
+ * - Initializes a translator with `t`, `hasKey`, and optional scoped methods.
259
+ * - Supports optional `preKey` to create a scoped translator for nested keys.
204
260
  */
205
- declare function getTranslator<CK extends GenConfigKeys = "__default__">(config: IntorResolvedConfig): Promise<TranslatorInstance<GenMessages<CK>>>;
206
- declare function getTranslator<CK extends GenConfigKeys = "__default__", PK extends string = LocalizedNodeKeys<GenMessages<CK>>>(config: IntorResolvedConfig, preKey: IfGen<PK, string>): Promise<TranslatorInstance<GenMessages<CK>, PK>>;
261
+ declare function getTranslator<CK extends GenConfigKeys = "__default__">(options: {
262
+ config: IntorResolvedConfig;
263
+ handlers?: TranslateHandlers;
264
+ extraOptions?: {
265
+ exts?: string[];
266
+ messagesReader?: MessagesReader;
267
+ };
268
+ }): Promise<TranslatorInstance<GenMessages<CK>>>;
269
+ declare function getTranslator<CK extends GenConfigKeys = "__default__", PK extends string = LocalizedNodeKeys<GenMessages<CK>>>(options: {
270
+ config: IntorResolvedConfig;
271
+ handlers?: TranslateHandlers;
272
+ extraOptions?: {
273
+ exts?: string[];
274
+ messagesReader?: MessagesReader;
275
+ };
276
+ preKey: IfGen<PK, string>;
277
+ }): Promise<TranslatorInstance<GenMessages<CK>, PK>>;
207
278
 
208
279
  export { getI18nContext, getTranslator };
@@ -1,5 +1,7 @@
1
1
  import { Level, NormalizerConfig, FormatterConfig, LoggerPreset } from 'logry/edge';
2
- import { Locale, LocaleMessages, FallbackLocalesMap, ScopedLeafKeys, LocalizedLeafKeys, Replacement, LocalizedNodeKeys } from 'intor-translator';
2
+ import { Locale, LocaleMessages, FallbackLocalesMap, NestedMessage, ScopedLeafKeys, LocalizedLeafKeys, Replacement, TranslateHandlers, LocalizedNodeKeys } from 'intor-translator';
3
+ import Keyv from 'keyv';
4
+ import { Logger } from 'logry';
3
5
 
4
6
  type CookieRawOptions = {
5
7
  /** Completely disable cookie usage (no read, no write, no lookup by name) - default: false */
@@ -162,6 +164,53 @@ interface I18nContext {
162
164
  */
163
165
  declare const getI18nContext: <CK extends GenConfigKeys = "__default__">(config: IntorResolvedConfig) => Promise<I18nContext>;
164
166
 
167
+ /**
168
+ * Represents a collection of localized messages.
169
+ *
170
+ * - Each key is a namespace or message identifier, and the value is a
171
+ * `NestedMessage` object that can contain nested message structures.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const messages: Messages = {
176
+ * ui: {
177
+ * greeting: "Hello",
178
+ * farewell: "Goodbye"
179
+ * },
180
+ * errors: {
181
+ * network: "Network error occurred"
182
+ * }
183
+ * };
184
+ * ```
185
+ */
186
+ type Messages = Record<string, NestedMessage>;
187
+ /**
188
+ * A function that reads messages from a given file path.
189
+ *
190
+ * - This function is expected to return a `Promise` that resolves to a `Messages` object.
191
+ * - It can be implemented to support different file formats such as JSON, YAML, or others.
192
+ *
193
+ * @param filePath - The path to the message file to read.
194
+ * @returns A Promise that resolves to a `Messages` object.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * const reader: MessagesReader = async (filePath) => {
199
+ * const content = await fs.promises.readFile(filePath, "utf-8");
200
+ * return JSON.parse(content) as Messages;
201
+ * };
202
+ * ```
203
+ */
204
+ type MessagesReader = (filePath: string) => Promise<Messages>;
205
+
206
+ /**
207
+ * Global messages pool (cross-module + hot-reload safe)
208
+ */
209
+ type MessagesPool = Keyv<LocaleMessages>;
210
+ declare global {
211
+ var __INTOR_MESSAGES_POOL__: MessagesPool | undefined;
212
+ }
213
+
165
214
  /** Base properties shared by all translator instances. */
166
215
  interface TranslatorBaseProps<M = unknown> {
167
216
  /** `messages`: The message object containing all translations. */
@@ -193,16 +242,38 @@ type TranslatorInstance<M, PK extends string | undefined = undefined> = {
193
242
  t: <Result = string>(key?: Key<M, PK>, replacements?: Replacement) => Result;
194
243
  } & TranslatorBaseProps<M> & TranslatorClientProps<M>;
195
244
 
245
+ /**
246
+ * Global logger pool (cross-module + hot-reload safe)
247
+ */
248
+ type LoggerPool = Map<string, Logger>;
249
+ declare global {
250
+ var __INTOR_LOGGER_POOL__: LoggerPool | undefined;
251
+ }
252
+
196
253
  /**
197
254
  * Create a translator instance ready for the current Next.js SSR environment.
198
255
  *
199
- * - Automatically resolves the current locale and pathname using the Next.js adapter.
200
- * - Loads all corresponding messages for the resolved locale and pathname.
201
- * - Returns a translator object containing `t`, `hasKey`, `messages`, and other helpers.
202
- * - Supports optional `preKey` to create a scoped translator for nested translation keys.
203
- * - Allows passing additional `TranslateConfig` options to the underlying translator.
256
+ * - **Automatically resolves the current locale and pathname using the Next.js adapter.**
257
+ * - Loads messages using the provided config, locale, and pathname.
258
+ * - Initializes a translator with `t`, `hasKey`, and optional scoped methods.
259
+ * - Supports optional `preKey` to create a scoped translator for nested keys.
204
260
  */
205
- declare function getTranslator<CK extends GenConfigKeys = "__default__">(config: IntorResolvedConfig): Promise<TranslatorInstance<GenMessages<CK>>>;
206
- declare function getTranslator<CK extends GenConfigKeys = "__default__", PK extends string = LocalizedNodeKeys<GenMessages<CK>>>(config: IntorResolvedConfig, preKey: IfGen<PK, string>): Promise<TranslatorInstance<GenMessages<CK>, PK>>;
261
+ declare function getTranslator<CK extends GenConfigKeys = "__default__">(options: {
262
+ config: IntorResolvedConfig;
263
+ handlers?: TranslateHandlers;
264
+ extraOptions?: {
265
+ exts?: string[];
266
+ messagesReader?: MessagesReader;
267
+ };
268
+ }): Promise<TranslatorInstance<GenMessages<CK>>>;
269
+ declare function getTranslator<CK extends GenConfigKeys = "__default__", PK extends string = LocalizedNodeKeys<GenMessages<CK>>>(options: {
270
+ config: IntorResolvedConfig;
271
+ handlers?: TranslateHandlers;
272
+ extraOptions?: {
273
+ exts?: string[];
274
+ messagesReader?: MessagesReader;
275
+ };
276
+ preKey: IfGen<PK, string>;
277
+ }): Promise<TranslatorInstance<GenMessages<CK>, PK>>;
207
278
 
208
279
  export { getI18nContext, getTranslator };
@@ -13,7 +13,7 @@ import Keyv from 'keyv';
13
13
  // src/adapters/next/shared/constants/pathname-header-name.ts
14
14
  var PATHNAME_HEADER_NAME = "x-intor-pathname";
15
15
 
16
- // src/shared/logger/global-logger-pool.ts
16
+ // src/server/shared/logger/global-logger-pool.ts
17
17
  function getGlobalLoggerPool() {
18
18
  if (!globalThis.__INTOR_LOGGER_POOL__) {
19
19
  globalThis.__INTOR_LOGGER_POOL__ = /* @__PURE__ */ new Map();
@@ -21,7 +21,7 @@ function getGlobalLoggerPool() {
21
21
  return globalThis.__INTOR_LOGGER_POOL__;
22
22
  }
23
23
 
24
- // src/shared/logger/get-logger.ts
24
+ // src/server/shared/logger/get-logger.ts
25
25
  var DEFAULT_FORMATTER_CONFIG = {
26
26
  node: { meta: { compact: true }, lineBreaksAfter: 1 }
27
27
  };
@@ -231,7 +231,7 @@ var getI18nContext = async (config) => {
231
231
  };
232
232
  };
233
233
 
234
- // src/modules/config/constants/cache.constants.ts
234
+ // src/config/constants/cache.constants.ts
235
235
  var DEFAULT_CACHE_OPTIONS = {
236
236
  enabled: process.env.NODE_ENV === "production",
237
237
  ttl: 60 * 60 * 1e3
@@ -299,7 +299,7 @@ async function collectFileEntries({
299
299
  return results;
300
300
  }
301
301
 
302
- // src/modules/messages/shared/utils/is-valid-messages.ts
302
+ // src/server/messages/shared/utils/is-valid-messages.ts
303
303
  function isPlainObject(value) {
304
304
  return typeof value === "object" && value !== null && !Array.isArray(value);
305
305
  }
@@ -325,7 +325,7 @@ async function jsonReader(filePath, readFile = fs.readFile) {
325
325
  return parsed;
326
326
  }
327
327
 
328
- // src/modules/messages/load-local-messages/read-locale-messages/parse-file-entries/utils/nest-object-from-path.ts
328
+ // src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/utils/nest-object-from-path.ts
329
329
  function nestObjectFromPath(path5, value) {
330
330
  let obj = value;
331
331
  for (let i = path5.length - 1; i >= 0; i--) {
@@ -334,7 +334,7 @@ function nestObjectFromPath(path5, value) {
334
334
  return obj;
335
335
  }
336
336
 
337
- // src/modules/messages/load-local-messages/read-locale-messages/parse-file-entries/parse-file-entries.ts
337
+ // src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/parse-file-entries.ts
338
338
  async function parseFileEntries({
339
339
  fileEntries,
340
340
  limit,
@@ -382,7 +382,7 @@ async function parseFileEntries({
382
382
  return result;
383
383
  }
384
384
 
385
- // src/modules/messages/load-local-messages/read-locale-messages/read-locale-messages.ts
385
+ // src/server/messages/load-local-messages/read-locale-messages/read-locale-messages.ts
386
386
  var readLocaleMessages = async ({
387
387
  limit,
388
388
  rootDir = "messages",
@@ -411,7 +411,7 @@ function getGlobalMessagesPool() {
411
411
  return globalThis.__INTOR_MESSAGES_POOL__;
412
412
  }
413
413
 
414
- // src/modules/messages/load-local-messages/load-local-messages.ts
414
+ // src/server/messages/load-local-messages/load-local-messages.ts
415
415
  var loadLocalMessages = async ({
416
416
  pool = getGlobalMessagesPool(),
417
417
  rootDir = "messages",
@@ -484,7 +484,7 @@ var loadLocalMessages = async ({
484
484
  return messages;
485
485
  };
486
486
 
487
- // src/modules/messages/load-remote-messages/fetch-locale-messages/fetch-locale-messages.ts
487
+ // src/server/messages/load-remote-messages/fetch-locale-messages/fetch-locale-messages.ts
488
488
  var fetchLocaleMessages = async ({
489
489
  remoteUrl,
490
490
  remoteHeaders,
@@ -526,7 +526,7 @@ var fetchLocaleMessages = async ({
526
526
  }
527
527
  };
528
528
 
529
- // src/modules/messages/load-remote-messages/fetch-locale-messages/utils/build-search-params.ts
529
+ // src/server/messages/load-remote-messages/fetch-locale-messages/utils/build-search-params.ts
530
530
  var buildSearchParams = (params) => {
531
531
  const searchParams = new URLSearchParams();
532
532
  const appendParam = (key, value) => {
@@ -544,7 +544,7 @@ var buildSearchParams = (params) => {
544
544
  return searchParams;
545
545
  };
546
546
 
547
- // src/modules/messages/load-remote-messages/load-remote-messages.ts
547
+ // src/server/messages/load-remote-messages/load-remote-messages.ts
548
548
  var loadRemoteMessages = async ({
549
549
  pool = getGlobalMessagesPool(),
550
550
  rootDir,
@@ -613,7 +613,7 @@ var loadRemoteMessages = async ({
613
613
  return messages;
614
614
  };
615
615
 
616
- // src/modules/messages/load-messages.ts
616
+ // src/server/messages/load-messages.ts
617
617
  var loadMessages = async ({
618
618
  config,
619
619
  locale,
@@ -679,17 +679,22 @@ var loadMessages = async ({
679
679
  return loadedMessages;
680
680
  };
681
681
 
682
- // src/modules/translator/get-translator.ts
683
- async function getTranslator(opts) {
684
- const { config, locale, pathname = "", preKey, handlers } = opts;
685
- const messages = await loadMessages({ config, locale, pathname });
682
+ // src/server/translator/get-translator.ts
683
+ async function getTranslator(options) {
684
+ const { config, locale, pathname = "", preKey } = options;
685
+ const messages = await loadMessages({
686
+ config,
687
+ locale,
688
+ pathname,
689
+ extraOptions: options.extraOptions
690
+ });
686
691
  const translator = new Translator({
687
692
  locale,
688
693
  messages,
689
694
  fallbackLocales: config.fallbackLocales,
690
695
  loadingMessage: config.translator?.loadingMessage,
691
696
  placeholder: config.translator?.placeholder,
692
- handlers
697
+ handlers: options.handlers
693
698
  });
694
699
  const props = { messages, locale };
695
700
  const scoped = translator.scoped(preKey);
@@ -701,12 +706,15 @@ async function getTranslator(opts) {
701
706
  }
702
707
 
703
708
  // src/adapters/next/server/get-translator.ts
704
- async function getTranslator2(config, preKey) {
709
+ async function getTranslator2(options) {
710
+ const { config, preKey, handlers, extraOptions } = options;
705
711
  const { locale, pathname } = await getI18nContext(config);
706
712
  const translatorInstance = getTranslator({
707
713
  config,
708
714
  locale,
709
715
  pathname,
716
+ handlers,
717
+ extraOptions,
710
718
  preKey
711
719
  });
712
720
  return translatorInstance;