react-intlayer 2.0.13 → 3.0.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 +49 -49
- package/dist/cjs/client/IntlayerProvider.cjs +2 -2
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs.map +1 -1
- package/dist/cjs/client/index.cjs +6 -0
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/t.cjs +37 -0
- package/dist/cjs/client/t.cjs.map +1 -0
- package/dist/cjs/client/useDictionary.cjs +37 -0
- package/dist/cjs/client/useDictionary.cjs.map +1 -0
- package/dist/cjs/client/useIntlayer.cjs +2 -2
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/processDictionary/index.cjs +3 -2
- package/dist/cjs/processDictionary/index.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +6 -0
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/serverContext.cjs.map +1 -1
- package/dist/cjs/server/t.cjs +36 -0
- package/dist/cjs/server/t.cjs.map +1 -0
- package/dist/cjs/server/useDictionary.cjs +35 -0
- package/dist/cjs/server/useDictionary.cjs.map +1 -0
- package/dist/cjs/server/useIntlayer.cjs +2 -2
- package/dist/cjs/server/useIntlayer.cjs.map +1 -1
- package/dist/cjs/useDictionaryBase.cjs +69 -0
- package/dist/cjs/useDictionaryBase.cjs.map +1 -0
- package/dist/cjs/useIntlayerBase.cjs +10 -29
- package/dist/cjs/useIntlayerBase.cjs.map +1 -1
- package/dist/cjs/vite/intlayerPlugin.cjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +1 -1
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
- package/dist/esm/client/getBrowserLocale.mjs.map +1 -1
- package/dist/esm/client/index.mjs +4 -0
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/t.mjs +14 -0
- package/dist/esm/client/t.mjs.map +1 -0
- package/dist/esm/client/useDictionary.mjs +14 -0
- package/dist/esm/client/useDictionary.mjs.map +1 -0
- package/dist/esm/client/useIntlayer.mjs +2 -2
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/index.mjs +5 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/processDictionary/index.mjs +3 -2
- package/dist/esm/processDictionary/index.mjs.map +1 -1
- package/dist/esm/server/index.mjs +4 -0
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/serverContext.mjs.map +1 -1
- package/dist/esm/server/t.mjs +13 -0
- package/dist/esm/server/t.mjs.map +1 -0
- package/dist/esm/server/useDictionary.mjs +12 -0
- package/dist/esm/server/useDictionary.mjs.map +1 -0
- package/dist/esm/server/useIntlayer.mjs +2 -2
- package/dist/esm/server/useIntlayer.mjs.map +1 -1
- package/dist/esm/useDictionaryBase.mjs +45 -0
- package/dist/esm/useDictionaryBase.mjs.map +1 -0
- package/dist/esm/useIntlayerBase.mjs +12 -28
- package/dist/esm/useIntlayerBase.mjs.map +1 -1
- package/dist/esm/vite/intlayerPlugin.mjs.map +1 -1
- package/dist/types/cli/react-intlayer.d.ts +9 -0
- package/dist/types/cli/react-intlayer.d.ts.map +1 -0
- package/dist/types/client/IntlayerProvider.d.ts +25 -0
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -0
- package/dist/{cjs → types}/client/getBrowserLocale.d.ts +5 -6
- package/dist/types/client/getBrowserLocale.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +10 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/t.d.ts +9 -0
- package/dist/types/client/t.d.ts.map +1 -0
- package/dist/types/client/useContent.d.ts +10 -0
- package/dist/types/client/useContent.d.ts.map +1 -0
- package/dist/types/client/useDictionary.d.ts +8 -0
- package/dist/types/client/useDictionary.d.ts.map +1 -0
- package/dist/types/client/useIntlayer.d.ts +8 -0
- package/dist/types/client/useIntlayer.d.ts.map +1 -0
- package/dist/types/client/useLocale.d.ts +11 -0
- package/dist/types/client/useLocale.d.ts.map +1 -0
- package/dist/types/client/useLocaleBase.d.ts +11 -0
- package/dist/types/client/useLocaleBase.d.ts.map +1 -0
- package/dist/types/client/useLocaleCookie.d.ts +17 -0
- package/dist/types/client/useLocaleCookie.d.ts.map +1 -0
- package/dist/{cjs → types}/client/useTraduction.d.ts +3 -5
- package/dist/types/client/useTraduction.d.ts.map +1 -0
- package/dist/types/craco/craco.config.d.ts +2 -0
- package/dist/types/craco/craco.config.d.ts.map +1 -0
- package/dist/types/craco/intlayerCracoPlugin.d.ts +24 -0
- package/dist/types/craco/intlayerCracoPlugin.d.ts.map +1 -0
- package/dist/{cjs → types}/getEnumeration.d.ts +3 -5
- package/dist/types/getEnumeration.d.ts.map +1 -0
- package/dist/{cjs → types}/getTranslation.d.ts +4 -6
- package/dist/types/getTranslation.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/processDictionary/contentDictionary.d.ts +14 -0
- package/dist/types/processDictionary/contentDictionary.d.ts.map +1 -0
- package/dist/types/processDictionary/index.d.ts +9 -0
- package/dist/types/processDictionary/index.d.ts.map +1 -0
- package/dist/types/server/IntlayerServerProvider.d.ts +34 -0
- package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -0
- package/dist/types/server/getLocaleTranslation.d.ts +9 -0
- package/dist/types/server/getLocaleTranslation.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/{cjs → types}/server/serverContext.d.ts +4 -15
- package/dist/types/server/serverContext.d.ts.map +1 -0
- package/dist/types/server/t.d.ts +9 -0
- package/dist/types/server/t.d.ts.map +1 -0
- package/dist/types/server/useDictionary.d.ts +8 -0
- package/dist/types/server/useDictionary.d.ts.map +1 -0
- package/dist/types/server/useIntlayer.d.ts +8 -0
- package/dist/types/server/useIntlayer.d.ts.map +1 -0
- package/dist/{cjs → types}/server/useTraduction.d.ts +3 -5
- package/dist/types/server/useTraduction.d.ts.map +1 -0
- package/dist/types/useDictionaryBase.d.ts +37 -0
- package/dist/types/useDictionaryBase.d.ts.map +1 -0
- package/dist/types/useIntlayerBase.d.ts +39 -0
- package/dist/types/useIntlayerBase.d.ts.map +1 -0
- package/dist/{cjs → types}/vite/intlayerPlugin.d.ts +4 -5
- package/dist/types/vite/intlayerPlugin.d.ts.map +1 -0
- package/package.json +38 -28
- package/dist/cjs/cli/react-intlayer.d.ts +0 -1
- package/dist/cjs/client/IntlayerProvider.d.ts +0 -27
- package/dist/cjs/client/index.d.ts +0 -13
- package/dist/cjs/client/useContent.d.ts +0 -13
- package/dist/cjs/client/useIntlayer.d.ts +0 -14
- package/dist/cjs/client/useLocale.d.ts +0 -14
- package/dist/cjs/client/useLocaleBase.d.ts +0 -14
- package/dist/cjs/client/useLocaleCookie.d.ts +0 -19
- package/dist/cjs/craco/craco.config.d.ts +0 -2
- package/dist/cjs/craco/intlayerCracoPlugin.d.ts +0 -26
- package/dist/cjs/index.d.ts +0 -14
- package/dist/cjs/processDictionary/contentDictionary.d.ts +0 -16
- package/dist/cjs/processDictionary/index.d.ts +0 -12
- package/dist/cjs/server/IntlayerServerProvider.d.ts +0 -36
- package/dist/cjs/server/getLocaleTranslation.d.ts +0 -12
- package/dist/cjs/server/index.d.ts +0 -10
- package/dist/cjs/server/useIntlayer.d.ts +0 -14
- package/dist/cjs/useIntlayerBase.d.ts +0 -70
- package/dist/esm/cli/react-intlayer.d.mts +0 -1
- package/dist/esm/client/IntlayerProvider.d.mts +0 -27
- package/dist/esm/client/getBrowserLocale.d.mts +0 -26
- package/dist/esm/client/index.d.mts +0 -13
- package/dist/esm/client/useContent.d.mts +0 -13
- package/dist/esm/client/useIntlayer.d.mts +0 -14
- package/dist/esm/client/useLocale.d.mts +0 -14
- package/dist/esm/client/useLocaleBase.d.mts +0 -14
- package/dist/esm/client/useLocaleCookie.d.mts +0 -19
- package/dist/esm/client/useTraduction.d.mts +0 -26
- package/dist/esm/craco/craco.config.d.mts +0 -2
- package/dist/esm/craco/intlayerCracoPlugin.d.mts +0 -26
- package/dist/esm/getEnumeration.d.mts +0 -33
- package/dist/esm/getTranslation.d.mts +0 -27
- package/dist/esm/index.d.mts +0 -14
- package/dist/esm/processDictionary/contentDictionary.d.mts +0 -16
- package/dist/esm/processDictionary/index.d.mts +0 -12
- package/dist/esm/server/IntlayerServerProvider.d.mts +0 -36
- package/dist/esm/server/getLocaleTranslation.d.mts +0 -12
- package/dist/esm/server/index.d.mts +0 -10
- package/dist/esm/server/serverContext.d.mts +0 -35
- package/dist/esm/server/useIntlayer.d.mts +0 -14
- package/dist/esm/server/useTraduction.d.mts +0 -26
- package/dist/esm/useIntlayerBase.d.mts +0 -70
- package/dist/esm/vite/intlayerPlugin.d.mts +0 -17
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Locales } from '@intlayer/config/client';
|
|
2
|
+
import type { LanguageContent } from '@intlayer/core';
|
|
3
|
+
/**
|
|
4
|
+
* On the service side, this function returns the translation of the provided multilang content.
|
|
5
|
+
*
|
|
6
|
+
* If the locale is not provided, it will use the locale from the server context
|
|
7
|
+
*/
|
|
8
|
+
export declare const t: <Content = string>(multilangContent: LanguageContent<Content>, locale?: Locales) => Content;
|
|
9
|
+
//# sourceMappingURL=t.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../../../src/server/t.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,CAAC,GAAI,OAAO,6BACL,eAAe,CAAC,OAAO,CAAC,WACjC,OAAO,YAMjB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type UseDictionary } from '../useDictionaryBase';
|
|
2
|
+
/**
|
|
3
|
+
* On the server side, Hook that transform a dictionary and return the content
|
|
4
|
+
*
|
|
5
|
+
* If the locale is not provided, it will use the locale from the server context
|
|
6
|
+
*/
|
|
7
|
+
export declare const useDictionary: UseDictionary;
|
|
8
|
+
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/server/useDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI7E;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,aAQ3B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type UseIntlayer } from '../useIntlayerBase';
|
|
2
|
+
/**
|
|
3
|
+
* On the server side, Hook that picking one dictionary by its key and return the content
|
|
4
|
+
*
|
|
5
|
+
* If the locale is not provided, it will use the locale from the server context
|
|
6
|
+
*/
|
|
7
|
+
export declare const useIntlayer: UseIntlayer;
|
|
8
|
+
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/server/useIntlayer.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAI5B;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAQzB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LanguageContent } from '@intlayer/core';
|
|
2
|
-
|
|
1
|
+
import type { LanguageContent } from '@intlayer/core';
|
|
3
2
|
/**
|
|
4
3
|
* On the server side, hook to get the translation content based on the locale
|
|
5
4
|
*
|
|
@@ -21,6 +20,5 @@ import { LanguageContent } from '@intlayer/core';
|
|
|
21
20
|
* - this function will require each locale to be defined if defined in the project configuration.
|
|
22
21
|
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
23
22
|
*/
|
|
24
|
-
declare const useTraduction: <Content = string>(languageContent: LanguageContent<Content>) => Content;
|
|
25
|
-
|
|
26
|
-
export { useTraduction };
|
|
23
|
+
export declare const useTraduction: <Content = string>(languageContent: LanguageContent<Content>) => Content;
|
|
24
|
+
//# sourceMappingURL=useTraduction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTraduction.d.ts","sourceRoot":"","sources":["../../../src/server/useTraduction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,4BAClB,eAAe,CAAC,OAAO,CAAC,YAK1C,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Locales } from '@intlayer/config';
|
|
2
|
+
import type { DeclarationContent, NodeType } from '@intlayer/core';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
export type IntlayerNode<T = string> = ReactNode & {
|
|
5
|
+
value: T;
|
|
6
|
+
};
|
|
7
|
+
type TransformNodeType<T, L extends Locales> = T extends {
|
|
8
|
+
[NodeType.Enumeration]: {
|
|
9
|
+
'1': any;
|
|
10
|
+
};
|
|
11
|
+
} ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L> : T extends {
|
|
12
|
+
[NodeType.Translation]: object;
|
|
13
|
+
} ? L extends keyof T[NodeType.Translation] ? DeepTransformContent<T[NodeType.Translation][L], L> : never : T;
|
|
14
|
+
export type DeepTransformContent<T, L extends Locales> = T extends object ? T extends (infer U)[] ? DeepTransformContent<U, L>[] : T extends {
|
|
15
|
+
nodeType: NodeType | string;
|
|
16
|
+
} ? TransformNodeType<T, L> : T extends {
|
|
17
|
+
_owner: any;
|
|
18
|
+
key: any;
|
|
19
|
+
props: any;
|
|
20
|
+
ref: any;
|
|
21
|
+
} ? ReactNode : {
|
|
22
|
+
[K in keyof T]: DeepTransformContent<T[K], L>;
|
|
23
|
+
} : T extends undefined ? never : IntlayerNode<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.
|
|
26
|
+
*/
|
|
27
|
+
export declare const recursiveTransformContent: (value: any, isContentSelectable?: boolean) => object;
|
|
28
|
+
type DataFromDictionary<T extends DeclarationContent, K extends Locales> = DeepTransformContent<T['content'], K>;
|
|
29
|
+
export type UseDictionary = <T extends DeclarationContent, L extends Locales>(dictionary: T, locale?: L) => DataFromDictionary<T, L>;
|
|
30
|
+
/**
|
|
31
|
+
* Hook that picks one dictionary by its id and return the content
|
|
32
|
+
*
|
|
33
|
+
* If the locale is not provided, it will use the locale from the client context
|
|
34
|
+
*/
|
|
35
|
+
export declare const useDictionaryBase: UseDictionary;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=useDictionaryBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryBase.d.ts","sourceRoot":"","sources":["../../src/useDictionaryBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,kBAAkB,EAElB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,GAAG;IACjD,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS;IACvD,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,GAAG,CAAA;KAAE,CAAC;CACtC,GACG,CAAC,QAAQ,EAAE,MAAM,KAAK,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAC3E,CAAC,SAAS;IACN,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAChC,GACD,CAAC,SAAS,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACnD,KAAK,GACP,CAAC,CAAC;AAER,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,MAAM,GACrE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAC5B,CAAC,SAAS;IACN,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B,GACD,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,CAAC,SAAS;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GACvD,SAAS,GACT;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAC9C,GACP,CAAC,SAAS,SAAS,GACjB,KAAK,GACL,YAAY,CAAC,CAAC,CAAC,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAC7B,GAAG,oCAET,MAyBF,CAAC;AAEF,KAAK,kBAAkB,CACrB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,OAAO,IACf,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,kBAAkB,EAAE,CAAC,SAAS,OAAO,EAC1E,UAAU,EAAE,CAAC,EACb,MAAM,CAAC,EAAE,CAAC,KACP,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAG9B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAoB/B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Locales } from '@intlayer/config';
|
|
2
|
+
import type { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
3
|
+
import { type DeepTransformContent } from './useDictionaryBase';
|
|
4
|
+
/**
|
|
5
|
+
* Provides a fallback to string type if the generic type T is never,
|
|
6
|
+
* otherwise returns T. This is useful for handling cases where no keys are found.
|
|
7
|
+
* Example: StringFallback<never> -> string; StringFallback<'key'> -> 'key'
|
|
8
|
+
*/
|
|
9
|
+
export type StringFallback<T> = T extends never ? string : T;
|
|
10
|
+
/**
|
|
11
|
+
* Represents the keys of the IntlayerDictionaryTypesConnector,
|
|
12
|
+
* ensuring they are valid dictionary keys or fallback to string if none exist.
|
|
13
|
+
*
|
|
14
|
+
* Example:
|
|
15
|
+
* ```ts
|
|
16
|
+
* DictionaryKeys -> 'key1' | 'key2'
|
|
17
|
+
* // or if IntlayerDictionaryTypesConnector is not defined,
|
|
18
|
+
* DictionaryKeys -> string
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type DictionaryKeys = StringFallback<keyof IntlayerDictionaryTypesConnector>;
|
|
22
|
+
/**
|
|
23
|
+
* Represents the data type returned by the useIntlayer hook,
|
|
24
|
+
* excluding the 'id' and 'filePath' keys from the dictionary content.
|
|
25
|
+
*/
|
|
26
|
+
type DataFromDictionaryKey<T extends DictionaryKeys, K extends Locales> = DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content'], K>;
|
|
27
|
+
/**
|
|
28
|
+
* Type definition for the useIntlayer hook, which takes a dictionary ID and an optional locale,
|
|
29
|
+
* and returns the deeply transformed dictionary content.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export type UseIntlayer = <T extends DictionaryKeys, L extends Locales>(key: T, locale?: L) => DataFromDictionaryKey<T, L>;
|
|
33
|
+
/**
|
|
34
|
+
* Hook that picks one dictionary by its ID and returns the content,
|
|
35
|
+
* deeply transformed according to the dictionary structure and metadata.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useIntlayerBase: UseIntlayer;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=useIntlayerBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntlayerBase.d.ts","sourceRoot":"","sources":["../../src/useIntlayerBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAQhD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAEjE,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,CACzC,MAAM,gCAAgC,CACvC,CAAC;AAEF;;;GAGG;AACH,KAAK,qBAAqB,CACxB,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,IACf,oBAAoB,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,OAAO,EACpE,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,KACP,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,WAuB7B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
|
-
|
|
1
|
+
import { type Plugin } from '../vite';
|
|
3
2
|
type PluginOptions = {};
|
|
4
3
|
/**
|
|
5
4
|
*
|
|
@@ -12,6 +11,6 @@ type PluginOptions = {};
|
|
|
12
11
|
* });
|
|
13
12
|
* ```
|
|
14
13
|
* */
|
|
15
|
-
declare const intLayerPlugin: (_pluginOptions?: PluginOptions) => Plugin;
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export declare const intLayerPlugin: (_pluginOptions?: PluginOptions) => Plugin;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=intlayerPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAG5C,KAAK,aAAa,GAAG,EAEpB,CAAC;AAEF;;;;;;;;;;MAUM;AACN,eAAO,MAAM,cAAc,oBAAoB,aAAa,KAAQ,MAgDlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Internationalization layer for React applications. Declare your multilingual contant in the same lever than your component. Powered by TypeScript, declaration files.",
|
|
6
6
|
"keywords": [
|
|
@@ -16,47 +16,47 @@
|
|
|
16
16
|
],
|
|
17
17
|
"homepage": "https://intlayer.org",
|
|
18
18
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/
|
|
23
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"author": {
|
|
27
27
|
"name": "Aymeric PINEAU",
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/aymericzip"
|
|
29
29
|
},
|
|
30
30
|
"contributors": [
|
|
31
31
|
{
|
|
32
32
|
"name": "Aymeric Pineau",
|
|
33
33
|
"email": "ay.pineau@gmail.com",
|
|
34
|
-
"url": "https://github.com/
|
|
34
|
+
"url": "https://github.com/aymericzip"
|
|
35
35
|
}
|
|
36
36
|
],
|
|
37
37
|
"exports": {
|
|
38
38
|
".": {
|
|
39
|
-
"types": "./dist/
|
|
39
|
+
"types": "./dist/types/index.d.ts",
|
|
40
40
|
"require": "./dist/cjs/index.cjs",
|
|
41
41
|
"import": "./dist/esm/index.mjs"
|
|
42
42
|
},
|
|
43
43
|
"./server": {
|
|
44
|
-
"types": "./dist/
|
|
44
|
+
"types": "./dist/types/server/index.d.ts",
|
|
45
45
|
"require": "./dist/cjs/server/index.cjs",
|
|
46
46
|
"import": "./dist/esm/server/index.mjs"
|
|
47
47
|
},
|
|
48
48
|
"./craco-plugin": {
|
|
49
|
-
"types": "./dist/
|
|
49
|
+
"types": "./dist/types/craco/intlayerCracoPlugin.d.ts",
|
|
50
50
|
"require": "./dist/cjs/craco/intlayerCracoPlugin.cjs",
|
|
51
51
|
"import": "./dist/esm/craco/intlayerCracoPlugin.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./craco-config": {
|
|
54
|
-
"types": "./dist/
|
|
54
|
+
"types": "./dist/types/craco/craco.config.d.ts",
|
|
55
55
|
"require": "./dist/cjs/craco/craco.config.cjs",
|
|
56
56
|
"import": "./dist/esm/craco/craco.config.mjs"
|
|
57
57
|
},
|
|
58
58
|
"./vite-plugin": {
|
|
59
|
-
"types": "./dist/
|
|
59
|
+
"types": "./dist/types/vite/intlayerPlugin.d.ts",
|
|
60
60
|
"require": "./dist/cjs/vite/intlayerPlugin.cjs",
|
|
61
61
|
"import": "./dist/esm/vite/intlayerPlugin.mjs"
|
|
62
62
|
},
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"main": "dist/cjs/index.cjs",
|
|
66
66
|
"module": "dist/esm/index.mjs",
|
|
67
|
+
"types": "dist/types/index.d.ts",
|
|
67
68
|
"typesVersions": {
|
|
68
69
|
"*": {
|
|
69
70
|
"package.json": [
|
|
@@ -83,15 +84,14 @@
|
|
|
83
84
|
"cross-spawn": "^7.0.3",
|
|
84
85
|
"js-cookie": "^3.0.5",
|
|
85
86
|
"react-cookie": "^7.1.4",
|
|
86
|
-
"vite": "^5.
|
|
87
|
+
"vite": "^5.4.8",
|
|
87
88
|
"webpack": "^5.92.1",
|
|
88
|
-
"@intlayer/
|
|
89
|
-
"@intlayer/core": "^
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"@intlayer/
|
|
93
|
-
"intlayer": "^
|
|
94
|
-
"intlayer-editor": "^2.1.12"
|
|
89
|
+
"@intlayer/chokidar": "^3.0.0",
|
|
90
|
+
"@intlayer/core": "^3.0.0",
|
|
91
|
+
"intlayer": "^3.0.0",
|
|
92
|
+
"intlayer-editor": "^2.1.12",
|
|
93
|
+
"@intlayer/webpack": "^3.0.0",
|
|
94
|
+
"@intlayer/config": "^3.0.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@craco/types": "^7.1.0",
|
|
@@ -99,32 +99,42 @@
|
|
|
99
99
|
"@types/js-cookie": "^3.0.6",
|
|
100
100
|
"@types/node": "^20.14.9",
|
|
101
101
|
"@types/react": "^18.3.3",
|
|
102
|
+
"concurrently": "^8.2.2",
|
|
103
|
+
"eslint": "^9.11.1",
|
|
104
|
+
"prettier": "3.3.3",
|
|
102
105
|
"react": "^18.3.1",
|
|
103
106
|
"react-dom": "^18.3.1",
|
|
104
107
|
"rimraf": "5.0.5",
|
|
105
|
-
"
|
|
108
|
+
"tsc-alias": "^1.8.10",
|
|
109
|
+
"tsup": "^8.3.0",
|
|
106
110
|
"typescript": "^5.5.2",
|
|
107
111
|
"@utils/eslint-config": "^1.0.4",
|
|
108
|
-
"@utils/ts-config": "^1.0.4"
|
|
112
|
+
"@utils/ts-config": "^1.0.4",
|
|
113
|
+
"@utils/ts-config-types": "^1.0.4",
|
|
114
|
+
"@utils/tsup-config": "^1.0.4"
|
|
109
115
|
},
|
|
110
116
|
"peerDependencies": {
|
|
111
117
|
"react": "^18.2.0",
|
|
112
|
-
"react-dom": "^18.2.0"
|
|
118
|
+
"react-dom": "^18.2.0",
|
|
119
|
+
"@intlayer/dictionaries-entry": "^3.0.0"
|
|
113
120
|
},
|
|
114
121
|
"engines": {
|
|
115
122
|
"node": ">=14.18"
|
|
116
123
|
},
|
|
117
124
|
"bug": {
|
|
118
|
-
"url": "https://github.com/
|
|
125
|
+
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
119
126
|
},
|
|
120
127
|
"scripts": {
|
|
121
|
-
"build": "
|
|
128
|
+
"build": "pnpm build:package & pnpm build:types",
|
|
129
|
+
"build:package": "tsup",
|
|
130
|
+
"build:types": "tsc --project ./tsconfig.types.json && tsc-alias --project ./tsconfig.types.json",
|
|
122
131
|
"clean": "rimraf ./dist",
|
|
123
|
-
"dev": "tsup --watch",
|
|
124
|
-
"lint": "eslint . --
|
|
125
|
-
"lint:fix": "eslint . --
|
|
126
|
-
"prettier
|
|
132
|
+
"dev": "concurrently --prefix none \"tsup --watch\" \"tsc --project ./tsconfig.types.json --watch\" \"tsc-alias --project ./tsconfig.types.json --watch\"",
|
|
133
|
+
"lint": "eslint . --cache",
|
|
134
|
+
"lint:fix": "eslint . --cache --fix",
|
|
135
|
+
"prettier": "prettier . --check",
|
|
136
|
+
"prettier:fix": "prettier . --write",
|
|
127
137
|
"test": "",
|
|
128
|
-
"typecheck": "tsup--project ./tsconfig.json --noEmit"
|
|
138
|
+
"typecheck": "tsup --project ./tsconfig.json --noEmit"
|
|
129
139
|
}
|
|
130
140
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { PropsWithChildren, FC } from 'react';
|
|
3
|
-
import { Locales } from '@intlayer/config/client';
|
|
4
|
-
|
|
5
|
-
type IntlayerValue = {
|
|
6
|
-
locale: Locales;
|
|
7
|
-
setLocale: (newLocale: Locales) => void;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Context that store the current locale on the client side
|
|
11
|
-
*/
|
|
12
|
-
declare const IntlayerClientContext: react.Context<IntlayerValue>;
|
|
13
|
-
/**
|
|
14
|
-
* Hook that provides the current locale
|
|
15
|
-
*/
|
|
16
|
-
declare const useIntlayerContext: () => IntlayerValue;
|
|
17
|
-
type IntlayerProviderProps = PropsWithChildren & {
|
|
18
|
-
locale?: Locales;
|
|
19
|
-
setLocale?: (locale: Locales) => void;
|
|
20
|
-
editorEnabled?: boolean;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Provider that store the current locale on the client side
|
|
24
|
-
*/
|
|
25
|
-
declare const IntlayerProvider: FC<IntlayerProviderProps>;
|
|
26
|
-
|
|
27
|
-
export { IntlayerClientContext, IntlayerProvider, type IntlayerProviderProps, useIntlayerContext };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderProps, useIntlayerContext } from './IntlayerProvider.js';
|
|
2
|
-
export { useIntlayer } from './useIntlayer.js';
|
|
3
|
-
export { useLocaleBase } from './useLocaleBase.js';
|
|
4
|
-
export { useLocale } from './useLocale.js';
|
|
5
|
-
export { useTraduction } from './useTraduction.js';
|
|
6
|
-
export { localeCookie, setLocaleCookie, useLocaleCookie } from './useLocaleCookie.js';
|
|
7
|
-
export { getBrowserLocale } from './getBrowserLocale.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '@intlayer/config/client';
|
|
10
|
-
import '../useIntlayerBase.js';
|
|
11
|
-
import '@intlayer/config';
|
|
12
|
-
import '@intlayer/core';
|
|
13
|
-
import 'intlayer';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as intlayer from 'intlayer';
|
|
2
|
-
import { LanguageContent } from '@intlayer/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* On the client side, hook to get the translation content based on the locale
|
|
6
|
-
*/
|
|
7
|
-
declare const useContent: <Content>(languageContent: LanguageContent<Content>) => {
|
|
8
|
-
locale: intlayer.Locales;
|
|
9
|
-
content: Content;
|
|
10
|
-
t: <Content_1 = string>(languageContent: LanguageContent<Content_1>) => Content_1;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { useContent };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UseIntlayer } from '../useIntlayerBase.js';
|
|
2
|
-
import '@intlayer/config';
|
|
3
|
-
import '@intlayer/core';
|
|
4
|
-
import 'intlayer';
|
|
5
|
-
import 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* On the client side, Hook that picking one dictionary by its id and return the content
|
|
9
|
-
*
|
|
10
|
-
* If the locale is not provided, it will use the locale from the client context
|
|
11
|
-
*/
|
|
12
|
-
declare const useIntlayer: UseIntlayer;
|
|
13
|
-
|
|
14
|
-
export { useIntlayer };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* On the client side, hook to get the current locale and all related fields
|
|
5
|
-
*/
|
|
6
|
-
declare const useLocale: () => {
|
|
7
|
-
locale: _intlayer_config_client.Locales;
|
|
8
|
-
defaultLocale: _intlayer_config_client.Locales;
|
|
9
|
-
availableLocales: _intlayer_config_client.Locales[];
|
|
10
|
-
localeList: _intlayer_config_client.Locales[];
|
|
11
|
-
setLocale: (newLocale: _intlayer_config_client.Locales) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { useLocale };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* On the client side, hook to get the current locale and all related fields
|
|
5
|
-
*/
|
|
6
|
-
declare const useLocaleBase: () => {
|
|
7
|
-
locale: _intlayer_config_client.Locales;
|
|
8
|
-
defaultLocale: _intlayer_config_client.Locales;
|
|
9
|
-
availableLocales: _intlayer_config_client.Locales[];
|
|
10
|
-
localeList: _intlayer_config_client.Locales[];
|
|
11
|
-
setLocale: (newLocale: _intlayer_config_client.Locales) => void;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { useLocaleBase };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Locales } from '@intlayer/config/client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the locale cookie
|
|
5
|
-
*/
|
|
6
|
-
declare const localeCookie: Locales | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Set the locale cookie
|
|
9
|
-
*/
|
|
10
|
-
declare const setLocaleCookie: (locale: Locales) => void;
|
|
11
|
-
/**
|
|
12
|
-
* Hook that provides the locale cookie and a function to set it
|
|
13
|
-
*/
|
|
14
|
-
declare const useLocaleCookie: () => {
|
|
15
|
-
localeCookie: Locales | undefined;
|
|
16
|
-
setLocaleCookie: (locale: Locales) => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { localeCookie, setLocaleCookie, useLocaleCookie };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { WebpackConfigOverride, CracoConfigOverride, CracoConfig, CracoPlugin } from '@craco/types';
|
|
2
|
-
import { Configuration } from 'webpack';
|
|
3
|
-
|
|
4
|
-
declare const overrideWebpackConfig: ({ webpackConfig, }: WebpackConfigOverride) => Configuration;
|
|
5
|
-
declare const overrideCracoConfig: ({ cracoConfig, }: CracoConfigOverride) => CracoConfig;
|
|
6
|
-
/**
|
|
7
|
-
* A CRACO plugin that adds the IntLayer configuration to the webpack configuration and sets the environment variables.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* const cracoConfig: CracoConfig = {
|
|
13
|
-
* plugins: [
|
|
14
|
-
* {
|
|
15
|
-
* plugin: intlayerCracoPlugin(),
|
|
16
|
-
* },
|
|
17
|
-
* ],
|
|
18
|
-
* };
|
|
19
|
-
*
|
|
20
|
-
* export default cracoConfig;
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
declare const plugin: CracoPlugin;
|
|
25
|
-
|
|
26
|
-
export { overrideCracoConfig, overrideWebpackConfig, plugin };
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { getTranslation } from './getTranslation.js';
|
|
2
|
-
export { IntlayerClientContext, IntlayerProvider, IntlayerProviderProps } from './client/IntlayerProvider.js';
|
|
3
|
-
export { useIntlayer } from './client/useIntlayer.js';
|
|
4
|
-
export { useLocaleBase } from './client/useLocaleBase.js';
|
|
5
|
-
export { useLocale } from './client/useLocale.js';
|
|
6
|
-
export { useTraduction } from './client/useTraduction.js';
|
|
7
|
-
export { localeCookie, setLocaleCookie, useLocaleCookie } from './client/useLocaleCookie.js';
|
|
8
|
-
export { getBrowserLocale } from './client/getBrowserLocale.js';
|
|
9
|
-
export { IntlayerNode } from './useIntlayerBase.js';
|
|
10
|
-
import '@intlayer/config/client';
|
|
11
|
-
import '@intlayer/core';
|
|
12
|
-
import 'react';
|
|
13
|
-
import '@intlayer/config';
|
|
14
|
-
import 'intlayer';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { KeyPath, Locales } from '@intlayer/core';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type TransformedContentValue = string | ReactNode | {
|
|
5
|
-
[key: string]: TransformedContentValue;
|
|
6
|
-
} | undefined | ((quantity: number) => TransformedContentValue);
|
|
7
|
-
type TransformedContentObject = {
|
|
8
|
-
dictionaryId: string;
|
|
9
|
-
dictionaryPath: string;
|
|
10
|
-
keyPath: KeyPath[];
|
|
11
|
-
locale: Locales;
|
|
12
|
-
content: TransformedContentValue | TransformedContentValue[] | undefined;
|
|
13
|
-
};
|
|
14
|
-
type TransformedContent = Record<string, TransformedContentValue | TransformedContentValue[] | TransformedContentObject | undefined> | ReactNode;
|
|
15
|
-
|
|
16
|
-
export type { TransformedContent, TransformedContentObject, TransformedContentValue };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Locales } from '@intlayer/config/client';
|
|
2
|
-
import { DictionaryValue, KeyPath, Dictionary } from '@intlayer/core';
|
|
3
|
-
import { TransformedContentValue, TransformedContent } from './contentDictionary.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
|
|
6
|
-
declare const processNode: (field: DictionaryValue | undefined, locale: Locales, dictionaryId: string, dictionaryPath: string, keyPath?: KeyPath[]) => TransformedContentValue;
|
|
7
|
-
/**
|
|
8
|
-
* Function that process a dictionary and return the result to be used in the application.
|
|
9
|
-
*/
|
|
10
|
-
declare const processDictionary: (content: Dictionary | DictionaryValue, dictionaryId: string, dictionaryPath: string, keyPath?: KeyPath[], locale?: Locales) => TransformedContent;
|
|
11
|
-
|
|
12
|
-
export { processDictionary, processNode };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Locales } from '@intlayer/config/client';
|
|
2
|
-
import { PropsWithChildren, FC } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Context that store the current locale on the server side
|
|
6
|
-
*/
|
|
7
|
-
declare const IntlayerServerContext: {
|
|
8
|
-
Provider: ({ children, value, }: {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
value: Locales;
|
|
11
|
-
}) => React.ReactNode;
|
|
12
|
-
Consumer: ({ children, }: {
|
|
13
|
-
children: (context: Locales | undefined) => React.ReactNode;
|
|
14
|
-
}) => React.ReactNode;
|
|
15
|
-
_storage: () => {
|
|
16
|
-
value: Locales | undefined;
|
|
17
|
-
};
|
|
18
|
-
_defaultValue: Locales | undefined;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Hook that provides the current locale
|
|
22
|
-
*/
|
|
23
|
-
declare const useIntlayer: () => Locales | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Get the current locale
|
|
26
|
-
*/
|
|
27
|
-
declare const locale: Locales | undefined;
|
|
28
|
-
type IntlayerServerProviderProps = PropsWithChildren & {
|
|
29
|
-
locale?: Locales;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Provider that store the current locale on the server side
|
|
33
|
-
*/
|
|
34
|
-
declare const IntlayerServerProvider: FC<IntlayerServerProviderProps>;
|
|
35
|
-
|
|
36
|
-
export { IntlayerServerContext, IntlayerServerProvider, type IntlayerServerProviderProps, locale, useIntlayer };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
|
-
import { LanguageContent } from '@intlayer/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* On the server side, get the translation content based on the locale
|
|
6
|
-
*/
|
|
7
|
-
declare const getLocaleTranslation: <Content>(languageContent: LanguageContent<Content>) => {
|
|
8
|
-
locale: _intlayer_config_client.Locales | undefined;
|
|
9
|
-
content: Content;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { getLocaleTranslation };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { getLocaleTranslation as getLocaleContent } from './getLocaleTranslation.js';
|
|
2
|
-
export { useTraduction } from './useTraduction.js';
|
|
3
|
-
export { IntlayerServerContext as IntlayerServer, IntlayerServerProvider, locale } from './IntlayerServerProvider.js';
|
|
4
|
-
export { useIntlayer } from './useIntlayer.js';
|
|
5
|
-
import '@intlayer/config/client';
|
|
6
|
-
import '@intlayer/core';
|
|
7
|
-
import 'react';
|
|
8
|
-
import '../useIntlayerBase.js';
|
|
9
|
-
import '@intlayer/config';
|
|
10
|
-
import 'intlayer';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UseIntlayer } from '../useIntlayerBase.js';
|
|
2
|
-
import '@intlayer/config';
|
|
3
|
-
import '@intlayer/core';
|
|
4
|
-
import 'intlayer';
|
|
5
|
-
import 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* On the server side, Hook that picking one dictionary by its id and return the content
|
|
9
|
-
*
|
|
10
|
-
* If the locale is not provided, it will use the locale from the server context
|
|
11
|
-
*/
|
|
12
|
-
declare const useIntlayer: UseIntlayer;
|
|
13
|
-
|
|
14
|
-
export { useIntlayer };
|