@intlayer/next-intl 8.12.5-canary.0
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 +330 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/client/NextIntlClientProvider.cjs +28 -0
- package/dist/cjs/client/NextIntlClientProvider.cjs.map +1 -0
- package/dist/cjs/client/helpers.cjs +66 -0
- package/dist/cjs/client/helpers.cjs.map +1 -0
- package/dist/cjs/client/index.cjs +19 -0
- package/dist/cjs/client/useLocale.cjs +18 -0
- package/dist/cjs/client/useLocale.cjs.map +1 -0
- package/dist/cjs/client/useTranslations.cjs +39 -0
- package/dist/cjs/client/useTranslations.cjs.map +1 -0
- package/dist/cjs/createFormatter.cjs +59 -0
- package/dist/cjs/createFormatter.cjs.map +1 -0
- package/dist/cjs/createTranslator.cjs +111 -0
- package/dist/cjs/createTranslator.cjs.map +1 -0
- package/dist/cjs/getDictionary.cjs +45 -0
- package/dist/cjs/getDictionary.cjs.map +1 -0
- package/dist/cjs/getDictionaryDynamic.cjs +35 -0
- package/dist/cjs/getDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/getTranslationsDictionary.cjs +31 -0
- package/dist/cjs/getTranslationsDictionary.cjs.map +1 -0
- package/dist/cjs/getTranslationsDictionaryDynamic.cjs +27 -0
- package/dist/cjs/getTranslationsDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/hasLocale.cjs +25 -0
- package/dist/cjs/hasLocale.cjs.map +1 -0
- package/dist/cjs/index.cjs +23 -0
- package/dist/cjs/middleware.cjs +37 -0
- package/dist/cjs/middleware.cjs.map +1 -0
- package/dist/cjs/navigation/Link.cjs +30 -0
- package/dist/cjs/navigation/Link.cjs.map +1 -0
- package/dist/cjs/navigation/createNavigation.cjs +40 -0
- package/dist/cjs/navigation/createNavigation.cjs.map +1 -0
- package/dist/cjs/navigation/hooks.cjs +42 -0
- package/dist/cjs/navigation/hooks.cjs.map +1 -0
- package/dist/cjs/navigation/index.cjs +10 -0
- package/dist/cjs/navigation/localizeHref.cjs +26 -0
- package/dist/cjs/navigation/localizeHref.cjs.map +1 -0
- package/dist/cjs/package.cjs +122 -0
- package/dist/cjs/package.cjs.map +1 -0
- package/dist/cjs/plugin/index.cjs +163 -0
- package/dist/cjs/plugin/index.cjs.map +1 -0
- package/dist/cjs/routing.cjs +30 -0
- package/dist/cjs/routing.cjs.map +1 -0
- package/dist/cjs/server/getLocale.cjs +13 -0
- package/dist/cjs/server/getLocale.cjs.map +1 -0
- package/dist/cjs/server/getMessages.cjs +30 -0
- package/dist/cjs/server/getMessages.cjs.map +1 -0
- package/dist/cjs/server/getTranslations.cjs +45 -0
- package/dist/cjs/server/getTranslations.cjs.map +1 -0
- package/dist/cjs/server/helpers.cjs +28 -0
- package/dist/cjs/server/helpers.cjs.map +1 -0
- package/dist/cjs/server/index.cjs +18 -0
- package/dist/cjs/server/setLocale.cjs +38 -0
- package/dist/cjs/server/setLocale.cjs.map +1 -0
- package/dist/cjs/useDictionary.cjs +45 -0
- package/dist/cjs/useDictionary.cjs.map +1 -0
- package/dist/cjs/useDictionaryDynamic.cjs +37 -0
- package/dist/cjs/useDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/useTranslationsDictionary.cjs +37 -0
- package/dist/cjs/useTranslationsDictionary.cjs.map +1 -0
- package/dist/cjs/useTranslationsDictionaryDynamic.cjs +29 -0
- package/dist/cjs/useTranslationsDictionaryDynamic.cjs.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/esm/client/NextIntlClientProvider.mjs +26 -0
- package/dist/esm/client/NextIntlClientProvider.mjs.map +1 -0
- package/dist/esm/client/helpers.mjs +59 -0
- package/dist/esm/client/helpers.mjs.map +1 -0
- package/dist/esm/client/index.mjs +8 -0
- package/dist/esm/client/useLocale.mjs +16 -0
- package/dist/esm/client/useLocale.mjs.map +1 -0
- package/dist/esm/client/useTranslations.mjs +37 -0
- package/dist/esm/client/useTranslations.mjs.map +1 -0
- package/dist/esm/createFormatter.mjs +57 -0
- package/dist/esm/createFormatter.mjs.map +1 -0
- package/dist/esm/createTranslator.mjs +108 -0
- package/dist/esm/createTranslator.mjs.map +1 -0
- package/dist/esm/getDictionary.mjs +43 -0
- package/dist/esm/getDictionary.mjs.map +1 -0
- package/dist/esm/getDictionaryDynamic.mjs +33 -0
- package/dist/esm/getDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/getTranslationsDictionary.mjs +29 -0
- package/dist/esm/getTranslationsDictionary.mjs.map +1 -0
- package/dist/esm/getTranslationsDictionaryDynamic.mjs +25 -0
- package/dist/esm/getTranslationsDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/hasLocale.mjs +23 -0
- package/dist/esm/hasLocale.mjs.map +1 -0
- package/dist/esm/index.mjs +10 -0
- package/dist/esm/middleware.mjs +34 -0
- package/dist/esm/middleware.mjs.map +1 -0
- package/dist/esm/navigation/Link.mjs +27 -0
- package/dist/esm/navigation/Link.mjs.map +1 -0
- package/dist/esm/navigation/createNavigation.mjs +37 -0
- package/dist/esm/navigation/createNavigation.mjs.map +1 -0
- package/dist/esm/navigation/hooks.mjs +39 -0
- package/dist/esm/navigation/hooks.mjs.map +1 -0
- package/dist/esm/navigation/index.mjs +5 -0
- package/dist/esm/navigation/localizeHref.mjs +24 -0
- package/dist/esm/navigation/localizeHref.mjs.map +1 -0
- package/dist/esm/package.mjs +119 -0
- package/dist/esm/package.mjs.map +1 -0
- package/dist/esm/plugin/index.mjs +159 -0
- package/dist/esm/plugin/index.mjs.map +1 -0
- package/dist/esm/routing.mjs +28 -0
- package/dist/esm/routing.mjs.map +1 -0
- package/dist/esm/server/getLocale.mjs +11 -0
- package/dist/esm/server/getLocale.mjs.map +1 -0
- package/dist/esm/server/getMessages.mjs +28 -0
- package/dist/esm/server/getMessages.mjs.map +1 -0
- package/dist/esm/server/getTranslations.mjs +44 -0
- package/dist/esm/server/getTranslations.mjs.map +1 -0
- package/dist/esm/server/helpers.mjs +25 -0
- package/dist/esm/server/helpers.mjs.map +1 -0
- package/dist/esm/server/index.mjs +9 -0
- package/dist/esm/server/setLocale.mjs +36 -0
- package/dist/esm/server/setLocale.mjs.map +1 -0
- package/dist/esm/useDictionary.mjs +43 -0
- package/dist/esm/useDictionary.mjs.map +1 -0
- package/dist/esm/useDictionaryDynamic.mjs +35 -0
- package/dist/esm/useDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/useTranslationsDictionary.mjs +35 -0
- package/dist/esm/useTranslationsDictionary.mjs.map +1 -0
- package/dist/esm/useTranslationsDictionaryDynamic.mjs +27 -0
- package/dist/esm/useTranslationsDictionaryDynamic.mjs.map +1 -0
- package/dist/types/client/NextIntlClientProvider.d.ts +28 -0
- package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -0
- package/dist/types/client/helpers.d.ts +45 -0
- package/dist/types/client/helpers.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +7 -0
- package/dist/types/client/useLocale.d.ts +10 -0
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useTranslations.d.ts +74 -0
- package/dist/types/client/useTranslations.d.ts.map +1 -0
- package/dist/types/createFormatter.d.ts +15 -0
- package/dist/types/createFormatter.d.ts.map +1 -0
- package/dist/types/createTranslator.d.ts +40 -0
- package/dist/types/createTranslator.d.ts.map +1 -0
- package/dist/types/getDictionary.d.ts +23 -0
- package/dist/types/getDictionary.d.ts.map +1 -0
- package/dist/types/getDictionaryDynamic.d.ts +15 -0
- package/dist/types/getDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/getTranslationsDictionary.d.ts +15 -0
- package/dist/types/getTranslationsDictionary.d.ts.map +1 -0
- package/dist/types/getTranslationsDictionaryDynamic.d.ts +12 -0
- package/dist/types/getTranslationsDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/hasLocale.d.ts +20 -0
- package/dist/types/hasLocale.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/middleware.d.ts +22 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/navigation/Link.d.ts +29 -0
- package/dist/types/navigation/Link.d.ts.map +1 -0
- package/dist/types/navigation/createNavigation.d.ts +21 -0
- package/dist/types/navigation/createNavigation.d.ts.map +1 -0
- package/dist/types/navigation/hooks.d.ts +33 -0
- package/dist/types/navigation/hooks.d.ts.map +1 -0
- package/dist/types/navigation/index.d.ts +5 -0
- package/dist/types/navigation/localizeHref.d.ts +23 -0
- package/dist/types/navigation/localizeHref.d.ts.map +1 -0
- package/dist/types/plugin/index.d.ts +12 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/routing.d.ts +28 -0
- package/dist/types/routing.d.ts.map +1 -0
- package/dist/types/server/getLocale.d.ts +10 -0
- package/dist/types/server/getLocale.d.ts.map +1 -0
- package/dist/types/server/getMessages.d.ts +22 -0
- package/dist/types/server/getMessages.d.ts.map +1 -0
- package/dist/types/server/getTranslations.d.ts +85 -0
- package/dist/types/server/getTranslations.d.ts.map +1 -0
- package/dist/types/server/helpers.d.ts +21 -0
- package/dist/types/server/helpers.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +8 -0
- package/dist/types/server/setLocale.d.ts +21 -0
- package/dist/types/server/setLocale.d.ts.map +1 -0
- package/dist/types/useDictionary.d.ts +22 -0
- package/dist/types/useDictionary.d.ts.map +1 -0
- package/dist/types/useDictionaryDynamic.d.ts +15 -0
- package/dist/types/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/useTranslationsDictionary.d.ts +19 -0
- package/dist/types/useTranslationsDictionary.d.ts.map +1 -0
- package/dist/types/useTranslationsDictionaryDynamic.d.ts +12 -0
- package/dist/types/useTranslationsDictionaryDynamic.d.ts.map +1 -0
- package/package.json +142 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { internationalization, routing } from "@intlayer/config/built";
|
|
2
|
+
|
|
3
|
+
//#region src/routing.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in replacement for next-intl's `defineRouting()`.
|
|
6
|
+
*
|
|
7
|
+
* Merges the provided config with Intlayer's own routing / internationalization
|
|
8
|
+
* configuration so you don't have to repeat locale lists. All fields are
|
|
9
|
+
* optional — omitted values are read from the Intlayer config at runtime.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* export default defineRouting({
|
|
14
|
+
* locales: ['en', 'fr'],
|
|
15
|
+
* defaultLocale: 'en',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
const defineRouting = (config) => ({
|
|
20
|
+
locales: config?.locales ?? internationalization?.locales ?? [],
|
|
21
|
+
defaultLocale: config?.defaultLocale ?? internationalization?.defaultLocale,
|
|
22
|
+
localePrefix: config?.localePrefix ?? (routing?.prefixDefault ? "always" : "as-needed"),
|
|
23
|
+
...config
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { defineRouting };
|
|
28
|
+
//# sourceMappingURL=routing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing.mjs","names":[],"sources":["../../src/routing.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport type Routing = {\n locales: LocalesValues[];\n defaultLocale: LocalesValues;\n localePrefix?: 'always' | 'as-needed' | 'never';\n pathnames?: Record<string, string | Record<string, string>>;\n};\n\n/**\n * Drop-in replacement for next-intl's `defineRouting()`.\n *\n * Merges the provided config with Intlayer's own routing / internationalization\n * configuration so you don't have to repeat locale lists. All fields are\n * optional — omitted values are read from the Intlayer config at runtime.\n *\n * @example\n * ```ts\n * export default defineRouting({\n * locales: ['en', 'fr'],\n * defaultLocale: 'en',\n * });\n * ```\n */\nexport const defineRouting: (config?: Partial<Routing>) => Routing = (\n config?: Partial<Routing>\n): Routing => ({\n locales:\n config?.locales ??\n ((internationalization?.locales ?? []) as LocalesValues[]),\n defaultLocale:\n config?.defaultLocale ??\n (internationalization?.defaultLocale as LocalesValues),\n localePrefix:\n config?.localePrefix ?? (routing?.prefixDefault ? 'always' : 'as-needed'),\n ...config,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAa,iBACX,YACa;CACb,SACE,QAAQ,WACN,sBAAsB,WAAW,EAAE;CACvC,eACE,QAAQ,iBACP,sBAAsB;CACzB,cACE,QAAQ,iBAAiB,SAAS,gBAAgB,WAAW;CAC/D,GAAG;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getLocale as getLocale$1 } from "next-intlayer/server";
|
|
2
|
+
|
|
3
|
+
//#region src/server/getLocale.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for next-intl's `getLocale()` server function.
|
|
6
|
+
*/
|
|
7
|
+
const getLocale = async () => await getLocale$1();
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getLocale };
|
|
11
|
+
//# sourceMappingURL=getLocale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLocale.mjs","names":["getLocaleIntlayer"],"sources":["../../../src/server/getLocale.ts"],"sourcesContent":["import type { getLocale as _getLocale } from 'next-intl/server';\nimport { getLocale as getLocaleIntlayer } from 'next-intlayer/server';\n\n/**\n * Drop-in for next-intl's `getLocale()` server function.\n */\nexport const getLocale: typeof _getLocale = async (): Promise<string> =>\n (await getLocaleIntlayer()) as string;\n"],"mappings":";;;;;;AAMA,MAAa,YAA+B,YACzC,MAAMA,aAAmB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { log } from "@intlayer/config/built";
|
|
2
|
+
import { CYAN } from "@intlayer/config/colors";
|
|
3
|
+
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
4
|
+
|
|
5
|
+
//#region src/server/getMessages.ts
|
|
6
|
+
/**
|
|
7
|
+
* Drop-in replacement for next-intl's `getMessages()` server function.
|
|
8
|
+
*
|
|
9
|
+
* Returns all compiled dictionary content for the current locale as a flat
|
|
10
|
+
* record keyed by dictionary name. Useful when you need to pass messages
|
|
11
|
+
* to a `NextIntlClientProvider`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const messages = await getMessages();
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @deprecated getMessages has no use case with intlayer.
|
|
19
|
+
* Messages are loaded automatically under the hood
|
|
20
|
+
*/
|
|
21
|
+
const getMessages = async () => {
|
|
22
|
+
getAppLogger({ log })(`${colorize("getMessages", CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`);
|
|
23
|
+
return {};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { getMessages };
|
|
28
|
+
//# sourceMappingURL=getMessages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMessages.mjs","names":[],"sources":["../../../src/server/getMessages.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { getMessages as _getMessages } from 'next-intl/server';\n\n/**\n * Drop-in replacement for next-intl's `getMessages()` server function.\n *\n * Returns all compiled dictionary content for the current locale as a flat\n * record keyed by dictionary name. Useful when you need to pass messages\n * to a `NextIntlClientProvider`.\n *\n * @example\n * ```ts\n * const messages = await getMessages();\n * ```\n *\n * @deprecated getMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood\n */\nexport const getMessages: typeof _getMessages = async () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('getMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,cAAmC,YAAY;AAGxD,CADkB,aAAa,EAAE,KAAK,CAC7B,CACP,GAAG,SAAS,eAAe,KAAK,CAAC,iHAClC;AAGH,QAAO,EAAE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getLocale } from "./getLocale.mjs";
|
|
2
|
+
import { createTranslator } from "../createTranslator.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/server/getTranslations.ts
|
|
5
|
+
/**
|
|
6
|
+
* Drop-in for next-intl's server `getTranslations()`.
|
|
7
|
+
*
|
|
8
|
+
* Messages support ICU MessageFormat syntax: simple arguments (`{name}`),
|
|
9
|
+
* plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted
|
|
10
|
+
* arguments (`{value, number}`). Rich text is available through `t.rich()`
|
|
11
|
+
* and `t.markup()`.
|
|
12
|
+
*
|
|
13
|
+
* Also accepts an options object `{ namespace, locale }` to match next-intl's
|
|
14
|
+
* full server API surface.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Bare namespace — fully typed dot-paths
|
|
19
|
+
* const t = await getTranslations('about');
|
|
20
|
+
* return <h1>{t('counter.label')}</h1>;
|
|
21
|
+
*
|
|
22
|
+
* // ICU plural
|
|
23
|
+
* t('items', { count: 3 });
|
|
24
|
+
*
|
|
25
|
+
* // Options object with locale override
|
|
26
|
+
* const t = await getTranslations({ namespace: 'about', locale: 'fr' });
|
|
27
|
+
*
|
|
28
|
+
* // Rich text
|
|
29
|
+
* t.rich('terms', { link: (chunks) => <a href="/terms">{chunks}</a> });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
const getTranslations = (async (namespaceOrOptions) => {
|
|
33
|
+
let namespace;
|
|
34
|
+
let localeOverride;
|
|
35
|
+
if (typeof namespaceOrOptions === "object" && namespaceOrOptions !== null) {
|
|
36
|
+
namespace = namespaceOrOptions.namespace;
|
|
37
|
+
localeOverride = namespaceOrOptions.locale;
|
|
38
|
+
} else namespace = namespaceOrOptions;
|
|
39
|
+
return createTranslator(localeOverride ?? await getLocale(), namespace);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { getTranslations };
|
|
44
|
+
//# sourceMappingURL=getTranslations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslations.mjs","names":[],"sources":["../../../src/server/getTranslations.ts"],"sourcesContent":["import type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { ReactNode } from 'react';\nimport {\n createTranslator,\n type MarkupChunkRenderer,\n type RichChunkRenderer,\n} from '../createTranslator';\nimport { getLocale } from './getLocale';\n\n/**\n * Options accepted by the options-object overload of {@link getTranslations}.\n */\ntype GetTranslationsOptions<N extends DictionaryKeys> = {\n /** The dictionary namespace to scope translations to. */\n namespace?: N;\n /** Override the locale instead of reading it from the current request. */\n locale?: LocalesValues;\n};\n\n/**\n * The translation function returned by {@link getTranslations}.\n *\n * Beyond the plain call signature, the function exposes:\n * - `has(key)` — returns `true` when the key exists in the namespace.\n * - `raw(key)` — returns the unprocessed message value.\n * - `rich(key, values)` — resolves `<tag>chunks</tag>` markup to React nodes.\n * - `markup(key, values)` — resolves `<tag>chunks</tag>` markup to a string.\n */\ntype TranslateFunction<N extends DictionaryKeys> = {\n /** Translate a key to a string, with optional ICU interpolation params. */\n <P extends ValidDotPathsFor<N>>(\n key: P,\n params?: Record<string, unknown>\n ): string;\n /** Returns `true` if the given key exists in the namespace. */\n has<P extends ValidDotPathsFor<N>>(key: P): boolean;\n /** Returns the raw unprocessed message for the given key. */\n raw<P extends ValidDotPathsFor<N>>(key: P): unknown;\n /** Resolves rich-text markup, mapping tags through React renderers. */\n rich<P extends ValidDotPathsFor<N>>(\n key: P,\n values?: Record<string, RichChunkRenderer | ReactNode>\n ): ReactNode;\n /** Resolves rich-text markup, mapping tags through string renderers. */\n markup<P extends ValidDotPathsFor<N>>(\n key: P,\n values?: Record<string, MarkupChunkRenderer | string | number>\n ): string;\n};\n\n/** Loosely-typed function returned for nested `'dict.scope'` namespaces. */\ntype LooseTranslateFunction = {\n (key: string, params?: Record<string, unknown>): string;\n has(key: string): boolean;\n raw(key: string): unknown;\n rich(\n key: string,\n values?: Record<string, RichChunkRenderer | ReactNode>\n ): ReactNode;\n markup(\n key: string,\n values?: Record<string, MarkupChunkRenderer | string | number>\n ): string;\n};\n\n/**\n * Overload set for {@link getTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. An options object `{ namespace?, locale? }` → typed when namespace is\n * a known `DictionaryKeys` value.\n * 3. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching next-intl's scoped-namespace behaviour.\n * 4. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n */\ntype GetTranslations = {\n <N extends DictionaryKeys>(namespace: N): Promise<TranslateFunction<N>>;\n <N extends DictionaryKeys>(\n options: GetTranslationsOptions<N>\n ): Promise<TranslateFunction<N>>;\n (namespace: `${string}.${string}`): Promise<LooseTranslateFunction>;\n (): Promise<LooseTranslateFunction>;\n};\n\n/**\n * Drop-in for next-intl's server `getTranslations()`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * Also accepts an options object `{ namespace, locale }` to match next-intl's\n * full server API surface.\n *\n * @example\n * ```ts\n * // Bare namespace — fully typed dot-paths\n * const t = await getTranslations('about');\n * return <h1>{t('counter.label')}</h1>;\n *\n * // ICU plural\n * t('items', { count: 3 });\n *\n * // Options object with locale override\n * const t = await getTranslations({ namespace: 'about', locale: 'fr' });\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const getTranslations: GetTranslations = (async (\n namespaceOrOptions?: string | GetTranslationsOptions<DictionaryKeys>\n) => {\n let namespace: string | undefined;\n let localeOverride: LocalesValues | undefined;\n\n if (typeof namespaceOrOptions === 'object' && namespaceOrOptions !== null) {\n namespace = namespaceOrOptions.namespace;\n localeOverride = namespaceOrOptions.locale;\n } else {\n namespace = namespaceOrOptions as string | undefined;\n }\n\n const locale = localeOverride ?? (await getLocale());\n\n return createTranslator(locale as LocalesValues, namespace);\n}) as GetTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,MAAa,mBAAoC,OAC/C,uBACG;CACH,IAAI;CACJ,IAAI;AAEJ,KAAI,OAAO,uBAAuB,YAAY,uBAAuB,MAAM;AACzE,cAAY,mBAAmB;AAC/B,mBAAiB,mBAAmB;OAEpC,aAAY;AAKd,QAAO,iBAFQ,kBAAmB,MAAM,WAAW,EAEF,UAAU"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createFormatter } from "../createFormatter.mjs";
|
|
2
|
+
import { getLocale } from "./getLocale.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/server/helpers.ts
|
|
5
|
+
/**
|
|
6
|
+
* Drop-in for next-intl's server `getFormatter()`.
|
|
7
|
+
* Returns locale-aware formatters backed by the native `Intl.*` APIs.
|
|
8
|
+
*/
|
|
9
|
+
const getFormatter = (async (options) => {
|
|
10
|
+
return createFormatter(options?.locale ?? await getLocale());
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Drop-in for next-intl's server `getNow()`.
|
|
14
|
+
* Returns the current `Date`.
|
|
15
|
+
*/
|
|
16
|
+
const getNow = (async () => /* @__PURE__ */ new Date());
|
|
17
|
+
/**
|
|
18
|
+
* Drop-in for next-intl's server `getTimeZone()`.
|
|
19
|
+
* Returns the system time zone resolved from `Intl.DateTimeFormat`.
|
|
20
|
+
*/
|
|
21
|
+
const getTimeZone = (async () => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { getFormatter, getNow, getTimeZone };
|
|
25
|
+
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../src/server/helpers.ts"],"sourcesContent":["import type {\n getFormatter as _getFormatter,\n getNow as _getNow,\n getTimeZone as _getTimeZone,\n} from 'next-intl/server';\nimport { createFormatter } from '../createFormatter';\nimport { getLocale } from './getLocale';\n\n/**\n * Drop-in for next-intl's server `getFormatter()`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs.\n */\nexport const getFormatter: typeof _getFormatter = (async (options?: {\n locale?: string;\n}) => {\n const locale = options?.locale ?? (await getLocale());\n return createFormatter(locale as string);\n}) as typeof _getFormatter;\n\n/**\n * Drop-in for next-intl's server `getNow()`.\n * Returns the current `Date`.\n */\nexport const getNow: typeof _getNow = (async () =>\n new Date()) as typeof _getNow;\n\n/**\n * Drop-in for next-intl's server `getTimeZone()`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const getTimeZone: typeof _getTimeZone = (async () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone) as typeof _getTimeZone;\n"],"mappings":";;;;;;;;AAYA,MAAa,gBAAsC,OAAO,YAEpD;AAEJ,QAAO,gBADQ,SAAS,UAAW,MAAM,WAAW,CACZ;;;;;;AAO1C,MAAa,UAA0B,4BACrC,IAAI,MAAM;;;;;AAMZ,MAAa,eAAoC,YAC/C,KAAK,gBAAgB,CAAC,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getLocale } from "./getLocale.mjs";
|
|
2
|
+
import { getDictionary } from "../getDictionary.mjs";
|
|
3
|
+
import { getDictionaryDynamic } from "../getDictionaryDynamic.mjs";
|
|
4
|
+
import { getFormatter, getNow, getTimeZone } from "./helpers.mjs";
|
|
5
|
+
import { setLocale } from "./setLocale.mjs";
|
|
6
|
+
import { getTranslations } from "./getTranslations.mjs";
|
|
7
|
+
import { getMessages } from "./getMessages.mjs";
|
|
8
|
+
|
|
9
|
+
export { getDictionary, getDictionaryDynamic, getFormatter, getLocale, getMessages, getNow, getTimeZone, getTranslations, setLocale };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { setLocaleInStorageServer } from "@intlayer/core/utils";
|
|
2
|
+
import { cookies } from "next/headers.js";
|
|
3
|
+
|
|
4
|
+
//#region src/server/setLocale.ts
|
|
5
|
+
/**
|
|
6
|
+
* Drop-in replacement for next-intl's `setLocale()` server action.
|
|
7
|
+
*
|
|
8
|
+
* Writes the locale to whichever cookie(s) the active `routing.storage`
|
|
9
|
+
* configuration specifies. When `createNextIntlPlugin` is used (the default),
|
|
10
|
+
* this is `NEXT_LOCALE`; when the user has configured a custom storage in
|
|
11
|
+
* `intlayer.config.ts`, that name is used instead.
|
|
12
|
+
*
|
|
13
|
+
* Must be called inside a Server Action.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* 'use server';
|
|
18
|
+
* await setLocale('fr');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const setLocale = async (locale) => {
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
setLocaleInStorageServer(locale, { setCookieStore: (name, value, attributes) => {
|
|
24
|
+
cookieStore.set(name, value, {
|
|
25
|
+
...attributes ?? {},
|
|
26
|
+
path: attributes?.path ?? "/",
|
|
27
|
+
sameSite: attributes?.sameSite ?? "lax",
|
|
28
|
+
httpOnly: attributes?.httpOnly ?? false,
|
|
29
|
+
secure: attributes?.secure ?? false
|
|
30
|
+
});
|
|
31
|
+
} });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { setLocale };
|
|
36
|
+
//# sourceMappingURL=setLocale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setLocale.mjs","names":[],"sources":["../../../src/server/setLocale.ts"],"sourcesContent":["import { setLocaleInStorageServer } from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { cookies } from 'next/headers.js';\n\n/**\n * Drop-in replacement for next-intl's `setLocale()` server action.\n *\n * Writes the locale to whichever cookie(s) the active `routing.storage`\n * configuration specifies. When `createNextIntlPlugin` is used (the default),\n * this is `NEXT_LOCALE`; when the user has configured a custom storage in\n * `intlayer.config.ts`, that name is used instead.\n *\n * Must be called inside a Server Action.\n *\n * @example\n * ```ts\n * 'use server';\n * await setLocale('fr');\n * ```\n */\nexport const setLocale = async (locale: string): Promise<void> => {\n const cookieStore = await cookies();\n\n setLocaleInStorageServer(locale as LocalesValues, {\n setCookieStore: (name, value, attributes) => {\n cookieStore.set(name, value, {\n ...(attributes ?? {}),\n path: attributes?.path ?? '/',\n sameSite: (attributes?.sameSite as 'lax') ?? 'lax',\n httpOnly: attributes?.httpOnly ?? false,\n secure: attributes?.secure ?? process.env.NODE_ENV === 'production',\n });\n },\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,YAAY,OAAO,WAAkC;CAChE,MAAM,cAAc,MAAM,SAAS;AAEnC,0BAAyB,QAAyB,EAChD,iBAAiB,MAAM,OAAO,eAAe;AAC3C,cAAY,IAAI,MAAM,OAAO;GAC3B,GAAI,cAAc,EAAE;GACpB,MAAM,YAAY,QAAQ;GAC1B,UAAW,YAAY,YAAsB;GAC7C,UAAU,YAAY,YAAY;GAClC,QAAQ,YAAY,UAAU;GAC/B,CAAC;IAEL,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useDictionary as useDictionary$1 } from "react-intlayer";
|
|
4
|
+
|
|
5
|
+
//#region src/useDictionary.ts
|
|
6
|
+
const navigatePath = (objectValue, path) => {
|
|
7
|
+
if (!path) return objectValue;
|
|
8
|
+
const parts = path.split(".");
|
|
9
|
+
let current = objectValue;
|
|
10
|
+
for (const part of parts) {
|
|
11
|
+
if (current === null || current === void 0 || typeof current !== "object") return;
|
|
12
|
+
current = current[part];
|
|
13
|
+
}
|
|
14
|
+
return current;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Dictionary-accepting variant of `useTranslations`.
|
|
18
|
+
*
|
|
19
|
+
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
20
|
+
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
21
|
+
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
22
|
+
*
|
|
23
|
+
* @example (generated by SWC, not written manually)
|
|
24
|
+
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
25
|
+
* const t = useDictionary(_abc);
|
|
26
|
+
*/
|
|
27
|
+
const useDictionary = (dictionary, namespacePrefix) => {
|
|
28
|
+
const content = useDictionary$1(dictionary);
|
|
29
|
+
const resolveKey = (key) => namespacePrefix ? `${namespacePrefix}.${key}` : key;
|
|
30
|
+
return Object.assign((lookup, params) => {
|
|
31
|
+
const rawValue = navigatePath(content, resolveKey(String(lookup)));
|
|
32
|
+
const str = String(rawValue ?? resolveKey(String(lookup)));
|
|
33
|
+
if (!params) return str;
|
|
34
|
+
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
35
|
+
}, {
|
|
36
|
+
has: (lookup) => navigatePath(content, resolveKey(String(lookup))) != null,
|
|
37
|
+
raw: (lookup) => navigatePath(content, resolveKey(String(lookup)))
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { useDictionary };
|
|
43
|
+
//# sourceMappingURL=useDictionary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionary.mjs","names":["useDictionaryBase"],"sources":["../../src/useDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer';\n\nconst navigatePath = (objectValue: unknown, path: string): unknown => {\n if (!path) return objectValue;\n const parts = path.split('.');\n let current: unknown = objectValue;\n for (const part of parts) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n\n/**\n * Dictionary-accepting variant of `useTranslations`.\n *\n * Used internally by the SWC optimization: instead of looking up the dictionary\n * at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time\n * and passes it directly here. This enables tree-shaking of unused locale content.\n *\n * @example (generated by SWC, not written manually)\n * import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };\n * const t = useDictionary(_abc);\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n namespacePrefix?: string\n) => {\n const content = useDictionaryBase(dictionary);\n\n const resolveKey = (key: string): string =>\n namespacePrefix ? `${namespacePrefix}.${key}` : key;\n\n return Object.assign(\n <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const rawValue = navigatePath(content, resolveKey(String(lookup)));\n const str = String(rawValue ?? resolveKey(String(lookup)));\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n },\n {\n has: <P extends ValidDotPathsFor<any>>(lookup: P): boolean =>\n navigatePath(content, resolveKey(String(lookup))) != null,\n raw: <P extends ValidDotPathsFor<any>>(lookup: P): unknown =>\n navigatePath(content, resolveKey(String(lookup))),\n }\n );\n};\n"],"mappings":";;;;;AAMA,MAAM,gBAAgB,aAAsB,SAA0B;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,OAAO;AACxB,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO;;;;;;;;;;;;;AAcT,MAAa,iBACX,YACA,oBACG;CACH,MAAM,UAAUA,gBAAkB,WAAW;CAE7C,MAAM,cAAc,QAClB,kBAAkB,GAAG,gBAAgB,GAAG,QAAQ;AAElD,QAAO,OAAO,QAEV,QACA,WACW;EACX,MAAM,WAAW,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EAClE,MAAM,MAAM,OAAO,YAAY,WAAW,OAAO,OAAO,CAAC,CAAC;AAC1D,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C;IAEH;EACE,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC,IAAI;EACvD,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EACpD,CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useDictionaryDynamic as useDictionaryDynamic$1 } from "react-intlayer";
|
|
4
|
+
|
|
5
|
+
//#region src/useDictionaryDynamic.ts
|
|
6
|
+
const navigatePath = (objectValue, path) => {
|
|
7
|
+
if (!path) return objectValue;
|
|
8
|
+
const parts = path.split(".");
|
|
9
|
+
let current = objectValue;
|
|
10
|
+
for (const part of parts) {
|
|
11
|
+
if (current === null || current === void 0 || typeof current !== "object") return;
|
|
12
|
+
current = current[part];
|
|
13
|
+
}
|
|
14
|
+
return current;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
18
|
+
*/
|
|
19
|
+
const useDictionaryDynamic = (dictionaryPromise, key, namespacePrefix) => {
|
|
20
|
+
const content = useDictionaryDynamic$1(dictionaryPromise, key);
|
|
21
|
+
const resolveKey = (lookupKey) => namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;
|
|
22
|
+
return Object.assign((lookup, params) => {
|
|
23
|
+
const rawValue = navigatePath(content, resolveKey(String(lookup)));
|
|
24
|
+
const str = String(rawValue ?? resolveKey(String(lookup)));
|
|
25
|
+
if (!params) return str;
|
|
26
|
+
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
27
|
+
}, {
|
|
28
|
+
has: (lookup) => navigatePath(content, resolveKey(String(lookup))) != null,
|
|
29
|
+
raw: (lookup) => navigatePath(content, resolveKey(String(lookup)))
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useDictionaryDynamic };
|
|
35
|
+
//# sourceMappingURL=useDictionaryDynamic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.mjs","names":["useDictionaryDynamicBase"],"sources":["../../src/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic as useDictionaryDynamicBase } from 'react-intlayer';\n\nconst navigatePath = (objectValue: unknown, path: string): unknown => {\n if (!path) return objectValue;\n const parts = path.split('.');\n let current: unknown = objectValue;\n for (const part of parts) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n\n/**\n * Dynamic dictionary-accepting variant of `useTranslations`.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends string,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const content = useDictionaryDynamicBase<T, any>(\n dictionaryPromise,\n key as any\n );\n\n const resolveKey = (lookupKey: string): string =>\n namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;\n\n return Object.assign(\n <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const rawValue = navigatePath(content, resolveKey(String(lookup)));\n const str = String(rawValue ?? resolveKey(String(lookup)));\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n },\n {\n has: <P extends ValidDotPathsFor<any>>(lookup: P): boolean =>\n navigatePath(content, resolveKey(String(lookup))) != null,\n raw: <P extends ValidDotPathsFor<any>>(lookup: P): unknown =>\n navigatePath(content, resolveKey(String(lookup))),\n }\n );\n};\n"],"mappings":";;;;;AAOA,MAAM,gBAAgB,aAAsB,SAA0B;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,OAAO;AACxB,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO;;;;;AAMT,MAAa,wBAIX,mBACA,KACA,oBACG;CACH,MAAM,UAAUA,uBACd,mBACA,IACD;CAED,MAAM,cAAc,cAClB,kBAAkB,GAAG,gBAAgB,GAAG,cAAc;AAExD,QAAO,OAAO,QAEV,QACA,WACW;EACX,MAAM,WAAW,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EAClE,MAAM,MAAM,OAAO,YAAY,WAAW,OAAO,OAAO,CAAC,CAAC;AAC1D,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C;IAEH;EACE,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC,IAAI;EACvD,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EACpD,CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useDictionary } from "react-intlayer";
|
|
4
|
+
|
|
5
|
+
//#region src/useTranslationsDictionary.ts
|
|
6
|
+
/**
|
|
7
|
+
* Dictionary-accepting variant of `useTranslations`.
|
|
8
|
+
*
|
|
9
|
+
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
10
|
+
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
11
|
+
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
12
|
+
*
|
|
13
|
+
* @example (generated by SWC, not written manually)
|
|
14
|
+
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
15
|
+
* const t = useTranslationsDictionary(_abc);
|
|
16
|
+
*/
|
|
17
|
+
const useTranslationsDictionary = (dictionary, namespacePrefix) => {
|
|
18
|
+
const content = useDictionary(dictionary);
|
|
19
|
+
return (lookup, params) => {
|
|
20
|
+
const lookupKey = namespacePrefix ? `${namespacePrefix}.${String(lookup)}` : String(lookup);
|
|
21
|
+
const parts = lookupKey.split(".");
|
|
22
|
+
let current = content;
|
|
23
|
+
for (const part of parts) {
|
|
24
|
+
if (current == null) break;
|
|
25
|
+
current = current[part];
|
|
26
|
+
}
|
|
27
|
+
const str = String(current ?? lookupKey);
|
|
28
|
+
if (!params) return str;
|
|
29
|
+
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useTranslationsDictionary };
|
|
35
|
+
//# sourceMappingURL=useTranslationsDictionary.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslationsDictionary.mjs","names":[],"sources":["../../src/useTranslationsDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useDictionary } from 'react-intlayer';\n\n/**\n * Dictionary-accepting variant of `useTranslations`.\n *\n * Used internally by the SWC optimization: instead of looking up the dictionary\n * at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time\n * and passes it directly here. This enables tree-shaking of unused locale content.\n *\n * @example (generated by SWC, not written manually)\n * import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };\n * const t = useTranslationsDictionary(_abc);\n */\nexport const useTranslationsDictionary = <T extends Dictionary>(\n dictionary: T,\n namespacePrefix?: string\n) => {\n const content = useDictionary(dictionary);\n\n return <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const lookupKey = namespacePrefix\n ? `${namespacePrefix}.${String(lookup)}`\n : String(lookup);\n const parts = lookupKey.split('.');\n let current: any = content;\n for (const part of parts) {\n if (current == null) break;\n current = current[part];\n }\n const str = String(current ?? lookupKey);\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAa,6BACX,YACA,oBACG;CACH,MAAM,UAAU,cAAc,WAAW;AAEzC,SACE,QACA,WACW;EACX,MAAM,YAAY,kBACd,GAAG,gBAAgB,GAAG,OAAO,OAAO,KACpC,OAAO,OAAO;EAClB,MAAM,QAAQ,UAAU,MAAM,IAAI;EAClC,IAAI,UAAe;AACnB,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,WAAW,KAAM;AACrB,aAAU,QAAQ;;EAEpB,MAAM,MAAM,OAAO,WAAW,UAAU;AACxC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useDictionaryDynamic } from "react-intlayer";
|
|
4
|
+
|
|
5
|
+
//#region src/useTranslationsDictionaryDynamic.ts
|
|
6
|
+
/**
|
|
7
|
+
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
8
|
+
*/
|
|
9
|
+
const useTranslationsDictionaryDynamic = (dictionaryPromise, key, namespacePrefix) => {
|
|
10
|
+
const content = useDictionaryDynamic(dictionaryPromise, key);
|
|
11
|
+
return (lookup, params) => {
|
|
12
|
+
const lookupKey = namespacePrefix ? `${namespacePrefix}.${String(lookup)}` : String(lookup);
|
|
13
|
+
const parts = lookupKey.split(".");
|
|
14
|
+
let current = content;
|
|
15
|
+
for (const part of parts) {
|
|
16
|
+
if (current == null) break;
|
|
17
|
+
current = current[part];
|
|
18
|
+
}
|
|
19
|
+
const str = String(current ?? lookupKey);
|
|
20
|
+
if (!params) return str;
|
|
21
|
+
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useTranslationsDictionaryDynamic };
|
|
27
|
+
//# sourceMappingURL=useTranslationsDictionaryDynamic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslationsDictionaryDynamic.mjs","names":[],"sources":["../../src/useTranslationsDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic } from 'react-intlayer';\n\n/**\n * Dynamic dictionary-accepting variant of `useTranslations`.\n */\nexport const useTranslationsDictionaryDynamic = <\n const T extends Dictionary,\n const K extends string,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const content = useDictionaryDynamic<T, any>(dictionaryPromise, key as any);\n\n return <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const lookupKey = namespacePrefix\n ? `${namespacePrefix}.${String(lookup)}`\n : String(lookup);\n const parts = lookupKey.split('.');\n let current: any = content;\n for (const part of parts) {\n if (current == null) break;\n current = current[part];\n }\n const str = String(current ?? lookupKey);\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n };\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,oCAIX,mBACA,KACA,oBACG;CACH,MAAM,UAAU,qBAA6B,mBAAmB,IAAW;AAE3E,SACE,QACA,WACW;EACX,MAAM,YAAY,kBACd,GAAG,gBAAgB,GAAG,OAAO,OAAO,KACpC,OAAO,OAAO;EAClB,MAAM,QAAQ,UAAU,MAAM,IAAI;EAClC,IAAI,UAAe;AACnB,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,WAAW,KAAM;AACrB,aAAU,QAAQ;;EAEpB,MAAM,MAAM,OAAO,WAAW,UAAU;AACxC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { NextIntlClientProvider as NextIntlClientProvider$1 } from "next-intl";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/client/NextIntlClientProvider.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Drop-in for next-intl's `NextIntlClientProvider`.
|
|
8
|
+
* `messages`, `timeZone`, and `now` are accepted for API compatibility
|
|
9
|
+
* but have no effect — Intlayer uses its own compiled dictionaries.
|
|
10
|
+
*/
|
|
11
|
+
declare const NextIntlClientProvider: typeof NextIntlClientProvider$1;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
type NextIntlClientProviderProps = Omit<ComponentProps<typeof NextIntlClientProvider$1>, 'messages'> & {
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
* has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason
|
|
19
|
+
*/
|
|
20
|
+
messages?: never;
|
|
21
|
+
/**
|
|
22
|
+
* locale
|
|
23
|
+
*/
|
|
24
|
+
locale: LocalesValues;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { NextIntlClientProvider, NextIntlClientProviderProps };
|
|
28
|
+
//# sourceMappingURL=NextIntlClientProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextIntlClientProvider.d.ts","names":[],"sources":["../../../src/client/NextIntlClientProvider.tsx"],"mappings":";;;;;;;AAeA;;;cAAa,sBAAA,SAA+B,wBAAA;;AAgC5C;;KAAY,2BAAA,GAA8B,IAAA,CACxC,cAAA,QAAsB,wBAAA;EAAA;;;;EAOtB,QAAA;EAIqB;;;EAArB,MAAA,EAAQ,aAAA;AAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IntlProvider as IntlProvider$1, useFormatter as useFormatter$1, useMessages as useMessages$1, useNow as useNow$1, useTimeZone as useTimeZone$1 } from "next-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/client/helpers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for next-intl's `useNow`.
|
|
6
|
+
* Returns the current `Date`. The `updateInterval` option is ignored.
|
|
7
|
+
*/
|
|
8
|
+
declare const useNow: typeof useNow$1;
|
|
9
|
+
/**
|
|
10
|
+
* Drop-in for next-intl's `useTimeZone`.
|
|
11
|
+
* Returns the system time zone resolved from `Intl.DateTimeFormat`.
|
|
12
|
+
*/
|
|
13
|
+
declare const useTimeZone: typeof useTimeZone$1;
|
|
14
|
+
/**
|
|
15
|
+
* Drop-in for next-intl's `useMessages`.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated useMessages has no use case with intlayer.
|
|
18
|
+
* Messages are loaded automatically under the hood.
|
|
19
|
+
* @returns An empty object.
|
|
20
|
+
*/
|
|
21
|
+
declare const useMessages: typeof useMessages$1;
|
|
22
|
+
/**
|
|
23
|
+
* Drop-in for next-intl's `useFormatter`.
|
|
24
|
+
* Returns locale-aware formatters backed by the native `Intl.*` APIs:
|
|
25
|
+
* `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and
|
|
26
|
+
* `displayName`.
|
|
27
|
+
*/
|
|
28
|
+
declare const useFormatter: typeof useFormatter$1;
|
|
29
|
+
/**
|
|
30
|
+
* Drop-in for next-intl's `IntlProvider`.
|
|
31
|
+
* Renders children as-is — Intlayer provides its own context via
|
|
32
|
+
* `IntlayerClientProvider`.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated IntlProvider has no use case with intlayer.
|
|
35
|
+
* Use `IntlayerClientProvider` or `NextIntlClientProvider` instead.
|
|
36
|
+
*/
|
|
37
|
+
declare const IntlProvider: typeof IntlProvider$1;
|
|
38
|
+
/**
|
|
39
|
+
* @internal Not part of the public next-intl API surface; provided for
|
|
40
|
+
* internal compatibility shims only.
|
|
41
|
+
*/
|
|
42
|
+
declare const useExtracted: (..._args: unknown[]) => {};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { IntlProvider, useExtracted, useFormatter, useMessages, useNow, useTimeZone };
|
|
45
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/client/helpers.tsx"],"mappings":";;;;;AAoBA;;cAAa,MAAA,SAAe,QAAA;;;AAM5B;;cAAa,WAAA,SAAoB,aAAA;;;AAUjC;;;;;cAAa,WAAA,SAAoB,aAAA;;;;;AAmCjC;;cAlBa,YAAA,SAAqB,cAAA;;;AA0BlC;;;;;;cARa,YAAA,SAAqB,cAAA;;;;;cAQrB,YAAA,MAAmB,KAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NextIntlClientProvider, NextIntlClientProviderProps } from "./NextIntlClientProvider.js";
|
|
2
|
+
import { IntlProvider, useExtracted, useFormatter, useMessages, useNow, useTimeZone } from "./helpers.js";
|
|
3
|
+
import { useDictionary } from "../useDictionary.js";
|
|
4
|
+
import { useDictionaryDynamic } from "../useDictionaryDynamic.js";
|
|
5
|
+
import { useLocale } from "./useLocale.js";
|
|
6
|
+
import { useTranslations } from "./useTranslations.js";
|
|
7
|
+
export { IntlProvider, NextIntlClientProvider, type NextIntlClientProviderProps, useDictionary, useDictionaryDynamic, useExtracted, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useLocale as useLocale$1 } from "next-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/client/useLocale.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for next-intl's `useLocale`.
|
|
6
|
+
*/
|
|
7
|
+
declare const useLocale: typeof useLocale$1;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { useLocale };
|
|
10
|
+
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;AAQA;cAAa,SAAA,SAAkB,WAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { MarkupChunkRenderer, RichChunkRenderer } from "../createTranslator.js";
|
|
2
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
5
|
+
|
|
6
|
+
//#region src/client/useTranslations.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The translation function returned by {@link useTranslations}.
|
|
9
|
+
*
|
|
10
|
+
* When the namespace is a bare dictionary key, `key` is validated against the
|
|
11
|
+
* dictionary's dot-paths. When the namespace is a nested scope
|
|
12
|
+
* (`'about.counter'`), `key` is a relative `string` path.
|
|
13
|
+
*
|
|
14
|
+
* Beyond the call signature, the function exposes:
|
|
15
|
+
* - `has(key)` — returns `true` when the key exists in the namespace.
|
|
16
|
+
* - `raw(key)` — returns the unprocessed content value.
|
|
17
|
+
* - `rich(key, values)` — resolves `<tag>chunks</tag>` markup to React nodes.
|
|
18
|
+
* - `markup(key, values)` — resolves `<tag>chunks</tag>` markup to a string.
|
|
19
|
+
*/
|
|
20
|
+
type TranslateFunction<N extends DictionaryKeys> = {
|
|
21
|
+
/** Translate a key to a string, with optional ICU interpolation params. */<P extends ValidDotPathsFor<N>>(key: P, params?: Record<string, unknown>): string; /** Returns `true` if the given key exists in the namespace. */
|
|
22
|
+
has<P extends ValidDotPathsFor<N>>(key: P): boolean; /** Returns the raw unprocessed content for the given key. */
|
|
23
|
+
raw<P extends ValidDotPathsFor<N>>(key: P): unknown; /** Resolves rich-text markup, mapping tags through React renderers. */
|
|
24
|
+
rich<P extends ValidDotPathsFor<N>>(key: P, values?: Record<string, RichChunkRenderer | ReactNode>): ReactNode; /** Resolves rich-text markup, mapping tags through string renderers. */
|
|
25
|
+
markup<P extends ValidDotPathsFor<N>>(key: P, values?: Record<string, MarkupChunkRenderer | string | number>): string;
|
|
26
|
+
};
|
|
27
|
+
/** Loosely-typed function returned for nested `'dict.scope'` namespaces. */
|
|
28
|
+
type LooseTranslateFunction = {
|
|
29
|
+
(key: string, params?: Record<string, unknown>): string;
|
|
30
|
+
has(key: string): boolean;
|
|
31
|
+
raw(key: string): unknown;
|
|
32
|
+
rich(key: string, values?: Record<string, RichChunkRenderer | ReactNode>): ReactNode;
|
|
33
|
+
markup(key: string, values?: Record<string, MarkupChunkRenderer | string | number>): string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Overload set for {@link useTranslations}:
|
|
37
|
+
*
|
|
38
|
+
* 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).
|
|
39
|
+
* 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative
|
|
40
|
+
* `string` paths, matching next-intl's scoped-namespace behaviour.
|
|
41
|
+
* 3. No namespace → root scope; the first segment of each key designates
|
|
42
|
+
* the dictionary (`t('about.title')`).
|
|
43
|
+
*/
|
|
44
|
+
type UseTranslations = {
|
|
45
|
+
<N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;
|
|
46
|
+
(namespace: `${string}.${string}`): LooseTranslateFunction;
|
|
47
|
+
(): LooseTranslateFunction;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Drop-in for next-intl's `useTranslations`.
|
|
51
|
+
*
|
|
52
|
+
* Messages support ICU MessageFormat syntax: simple arguments (`{name}`),
|
|
53
|
+
* plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted
|
|
54
|
+
* arguments (`{value, number}`). Rich text is available through `t.rich()`
|
|
55
|
+
* and `t.markup()`.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const t = useTranslations('about');
|
|
60
|
+
* t('counter.label'); // ✓ typed
|
|
61
|
+
* t('items', { count: 3 }); // ICU plural
|
|
62
|
+
*
|
|
63
|
+
* // Scoped to a nested object (next-intl idiom)
|
|
64
|
+
* const t = useTranslations('about.counter');
|
|
65
|
+
* t('label'); // resolves about → counter.label
|
|
66
|
+
*
|
|
67
|
+
* // Rich text
|
|
68
|
+
* t.rich('terms', { link: (chunks) => <a href="/terms">{chunks}</a> });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const useTranslations: UseTranslations;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { useTranslations };
|
|
74
|
+
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../src/client/useTranslations.ts"],"mappings":";;;;;;;;AAa6B;;;;;;;;;;;KAexB,iBAAA,WAA4B,cAAA;EASjB,sFAPH,gBAAA,CAAiB,CAAA,GAC1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,4BAOqB;EAJhC,GAAA,WAAc,gBAAA,CAAiB,CAAA,GAAI,GAAA,EAAK,CAAA,YAKjC;EAHP,GAAA,WAAc,gBAAA,CAAiB,CAAA,GAAI,GAAA,EAAK,CAAA,YAIM;EAF9C,IAAA,WAAe,gBAAA,CAAiB,CAAA,GAC9B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,SAAe,iBAAA,GAAoB,SAAA,IAC3C,SAAA,EAAA;EAEH,MAAA,WAAiB,gBAAA,CAAiB,CAAA,GAChC,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,SAAe,mBAAA;AAAA;;KAKvB,sBAAA;EAAA,CACF,GAAA,UAAa,MAAA,GAAS,MAAA;EACvB,GAAA,CAAI,GAAA;EACJ,GAAA,CAAI,GAAA;EACJ,IAAA,CACE,GAAA,UACA,MAAA,GAAS,MAAA,SAAe,iBAAA,GAAoB,SAAA,IAC3C,SAAA;EACH,MAAA,CACE,GAAA,UACA,MAAA,GAAS,MAAA,SAAe,mBAAA;AAAA;;;;;;;;;;KAavB,eAAA;EAAA,WACQ,cAAA,EAAgB,SAAA,EAAW,CAAA,GAAI,iBAAA,CAAkB,CAAA;EAAA,CAC3D,SAAA,0BAAmC,sBAAA;EAAA,IAChC,sBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;cAyBO,eAAA,EAOP,eAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useFormatter } from "next-intl";
|
|
2
|
+
|
|
3
|
+
//#region src/createFormatter.d.ts
|
|
4
|
+
/** The formatter object shape exposed by next-intl. */
|
|
5
|
+
type Formatter = ReturnType<typeof useFormatter>;
|
|
6
|
+
/**
|
|
7
|
+
* Builds a next-intl compatible formatter backed by the native `Intl.*`
|
|
8
|
+
* APIs for the given locale.
|
|
9
|
+
*
|
|
10
|
+
* Shared by `useFormatter` (client) and `getFormatter` (server).
|
|
11
|
+
*/
|
|
12
|
+
declare const createFormatter: (locale: string) => Formatter;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Formatter, createFormatter };
|
|
15
|
+
//# sourceMappingURL=createFormatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFormatter.d.ts","names":[],"sources":["../../src/createFormatter.ts"],"mappings":";;;;KAGY,SAAA,GAAY,UAAA,QAAkB,YAAA;AAA1C;;;;;AAsBA;AAtBA,cAsBa,eAAA,GAAmB,MAAA,aAAiB,SAAA"}
|