@snack-uikit/locale 0.12.3-preview-efee8b3e.0 → 0.13.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +17 -70
  3. package/dist/cjs/components/LocaleProvider/LocaleProvider.d.ts +8 -36
  4. package/dist/cjs/components/LocaleProvider/LocaleProvider.js +34 -78
  5. package/dist/cjs/components/LocaleProvider/hooks.d.ts +16 -0
  6. package/dist/cjs/components/LocaleProvider/hooks.js +38 -0
  7. package/dist/cjs/components/LocaleProvider/index.d.ts +2 -1
  8. package/dist/cjs/components/LocaleProvider/index.js +3 -8
  9. package/dist/cjs/locales/en_GB.d.ts +9 -0
  10. package/dist/cjs/locales/en_GB.js +9 -0
  11. package/dist/cjs/locales/index.d.ts +18 -0
  12. package/dist/cjs/locales/ru_RU.js +9 -0
  13. package/dist/cjs/types.d.ts +5 -10
  14. package/dist/esm/components/LocaleProvider/LocaleProvider.d.ts +8 -36
  15. package/dist/esm/components/LocaleProvider/LocaleProvider.js +23 -62
  16. package/dist/esm/components/LocaleProvider/hooks.d.ts +16 -0
  17. package/dist/esm/components/LocaleProvider/hooks.js +30 -0
  18. package/dist/esm/components/LocaleProvider/index.d.ts +2 -1
  19. package/dist/esm/components/LocaleProvider/index.js +2 -1
  20. package/dist/esm/locales/en_GB.d.ts +9 -0
  21. package/dist/esm/locales/en_GB.js +9 -0
  22. package/dist/esm/locales/index.d.ts +18 -0
  23. package/dist/esm/locales/ru_RU.js +9 -0
  24. package/dist/esm/types.d.ts +5 -10
  25. package/package.json +2 -2
  26. package/src/components/LocaleProvider/LocaleProvider.tsx +32 -113
  27. package/src/components/LocaleProvider/hooks.ts +62 -0
  28. package/src/components/LocaleProvider/index.ts +3 -1
  29. package/src/locales/en_GB.ts +10 -3
  30. package/src/locales/ru_RU.ts +9 -0
  31. package/src/types.ts +8 -18
  32. package/dist/cjs/components/LocaleProvider/Sample.d.ts +0 -10
  33. package/dist/cjs/components/LocaleProvider/Sample.js +0 -111
  34. package/dist/esm/components/LocaleProvider/Sample.d.ts +0 -10
  35. package/dist/esm/components/LocaleProvider/Sample.js +0 -62
  36. package/src/components/LocaleProvider/Sample.tsx +0 -95
@@ -1,67 +1,28 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import merge from 'lodash.merge';
3
- import { createContext, useCallback, useContext, useMemo } from 'react';
3
+ import { createContext, useMemo } from 'react';
4
4
  import { LOCALES } from '../../locales';
5
5
  export const DEFAULT_LANG = 'en_GB';
6
- function mergeLocaleWithExtension(extension) {
7
- return merge({}, LOCALES, extension);
6
+ export const LocaleContext = createContext({
7
+ lang: DEFAULT_LANG,
8
+ locales: LOCALES,
9
+ localesByLang: LOCALES.en_GB,
10
+ });
11
+ export function LocaleProvider({ lang: langProp, locales: localesProp, children }) {
12
+ const locales = useMemo(() => {
13
+ if (localesProp) {
14
+ return merge({}, LOCALES, localesProp);
15
+ }
16
+ return LOCALES;
17
+ }, [localesProp]);
18
+ const lang = useMemo(() => langProp.replace('-', '_'), [langProp]);
19
+ const localesByLang = useMemo(() => {
20
+ let localesObj = locales[lang];
21
+ if (!localesObj) {
22
+ console.warn(`Snack-uikit: localization for lang ${lang} was not found. Make sure you are using correct lang or passed proper locales to LocaleProvider. For now default language (${DEFAULT_LANG}) will be used`);
23
+ localesObj = locales[DEFAULT_LANG];
24
+ }
25
+ return localesObj;
26
+ }, [lang, locales]);
27
+ return _jsx(LocaleContext.Provider, { value: { lang, locales, localesByLang }, children: children });
8
28
  }
9
- export function createLocaleContext({ extendedDictionary }) {
10
- const locales = mergeLocaleWithExtension(extendedDictionary);
11
- const LocaleContext = createContext({
12
- lang: DEFAULT_LANG,
13
- locales,
14
- localesByLang: locales.en_GB,
15
- });
16
- function LocaleProvider({ lang: langProp, children }) {
17
- const lang = useMemo(() => langProp.replace('-', '_'), [langProp]);
18
- const localesByLang = useMemo(() => {
19
- let localesObj = locales[lang];
20
- if (!localesObj) {
21
- console.warn(`Snack-uikit: localization for lang ${lang} was not found. Make sure you are using correct lang or passed proper locales to LocaleProvider. For now default language (${DEFAULT_LANG}) will be used`);
22
- localesObj = locales[DEFAULT_LANG];
23
- }
24
- return localesObj;
25
- }, [lang]);
26
- return _jsx(LocaleContext.Provider, { value: { lang, locales, localesByLang }, children: children });
27
- }
28
- function useLocale(componentName) {
29
- const { localesByLang, lang } = useContext(LocaleContext);
30
- const locales = useMemo(() => {
31
- if (!componentName) {
32
- return localesByLang;
33
- }
34
- return (localesByLang[componentName] || {});
35
- }, [componentName, localesByLang]);
36
- const getLocaleText = useCallback(key => {
37
- let translation = '';
38
- const complexKey = key.split('.');
39
- if (complexKey.length === 1) {
40
- translation = locales[key];
41
- }
42
- else {
43
- translation = complexKey.reduce((acc, cur) => {
44
- if (typeof acc === 'string') {
45
- return acc;
46
- }
47
- return acc[cur];
48
- }, locales);
49
- }
50
- if (!(translation === null || translation === void 0 ? void 0 : translation.length)) {
51
- console.warn(`Snack-uikit: the '${key}' key is not found in the current locale '${lang}'.`);
52
- return key;
53
- }
54
- return translation;
55
- }, [lang, locales]);
56
- return {
57
- t: getLocaleText,
58
- lang,
59
- };
60
- }
61
- return {
62
- LocaleContext,
63
- LocaleProvider,
64
- useLocale,
65
- };
66
- }
67
- export const { LocaleProvider, useLocale } = createLocaleContext({});
@@ -0,0 +1,16 @@
1
+ import { DottedTranslationKey, LocaleDictionary, LocaleLang } from '../../types';
2
+ type LocaleComponentName = keyof LocaleDictionary;
3
+ type GetLocaleText<T extends keyof LocaleDictionary | undefined = undefined> = (key: DottedTranslationKey<T>) => string;
4
+ /**
5
+ * Inner hook to use translations
6
+ * @function helper
7
+ */
8
+ export declare function useLocale(): {
9
+ t: GetLocaleText;
10
+ lang: LocaleLang;
11
+ };
12
+ export declare function useLocale<C extends LocaleComponentName = LocaleComponentName>(componentName: C): {
13
+ t: GetLocaleText<C>;
14
+ lang: LocaleLang;
15
+ };
16
+ export {};
@@ -0,0 +1,30 @@
1
+ import { useCallback, useContext, useMemo } from 'react';
2
+ import { LocaleContext } from './LocaleProvider';
3
+ export function useLocale(componentName) {
4
+ const { localesByLang, lang } = useContext(LocaleContext);
5
+ const locales = useMemo(() => {
6
+ if (!componentName) {
7
+ return localesByLang;
8
+ }
9
+ return (localesByLang[componentName] || {});
10
+ }, [componentName, localesByLang]);
11
+ const getLocaleText = useCallback(key => {
12
+ let translation = '';
13
+ const complexKey = key.split('.');
14
+ if (complexKey.length === 1) {
15
+ translation = locales[key];
16
+ }
17
+ else {
18
+ translation = complexKey.reduce((acc, cur) => acc[cur], locales);
19
+ }
20
+ if (!(translation === null || translation === void 0 ? void 0 : translation.length)) {
21
+ console.warn(`Snack-uikit: the '${key}' key is not found in the current locale '${lang}'.`);
22
+ return key;
23
+ }
24
+ return translation;
25
+ }, [lang, locales]);
26
+ return {
27
+ t: getLocaleText,
28
+ lang,
29
+ };
30
+ }
@@ -1 +1,2 @@
1
- export { type LocaleProviderProps, LocaleProvider, useLocale, createLocaleContext } from './LocaleProvider';
1
+ export { type LocaleProviderProps, LocaleProvider } from './LocaleProvider';
2
+ export { useLocale } from './hooks';
@@ -1 +1,2 @@
1
- export { LocaleProvider, useLocale, createLocaleContext } from './LocaleProvider';
1
+ export { LocaleProvider } from './LocaleProvider';
2
+ export { useLocale } from './hooks';
@@ -65,4 +65,13 @@ export declare const en_GB: {
65
65
  hideFilters: string;
66
66
  showFilters: string;
67
67
  };
68
+ ToastUpload: {
69
+ title: {
70
+ loading: string;
71
+ error: string;
72
+ pause: string;
73
+ errorUploaded: string;
74
+ uploaded: string;
75
+ };
76
+ };
68
77
  };
@@ -65,4 +65,13 @@ export const en_GB = {
65
65
  hideFilters: 'Hide filters',
66
66
  showFilters: 'Show filters',
67
67
  },
68
+ ToastUpload: {
69
+ title: {
70
+ loading: 'Loading...',
71
+ error: 'Error loading...',
72
+ pause: 'Paused loading',
73
+ errorUploaded: 'Error uploaded',
74
+ uploaded: 'Uploaded',
75
+ },
76
+ },
68
77
  };
@@ -66,6 +66,15 @@ export declare const LOCALES: {
66
66
  hideFilters: string;
67
67
  showFilters: string;
68
68
  };
69
+ ToastUpload: {
70
+ title: {
71
+ loading: string;
72
+ error: string;
73
+ pause: string;
74
+ errorUploaded: string;
75
+ uploaded: string;
76
+ };
77
+ };
69
78
  };
70
79
  readonly ru_RU: {
71
80
  Table: {
@@ -134,5 +143,14 @@ export declare const LOCALES: {
134
143
  hideFilters: string;
135
144
  showFilters: string;
136
145
  };
146
+ ToastUpload: {
147
+ title: {
148
+ loading: string;
149
+ error: string;
150
+ pause: string;
151
+ errorUploaded: string;
152
+ uploaded: string;
153
+ };
154
+ };
137
155
  };
138
156
  };
@@ -65,4 +65,13 @@ export const ru_RU = {
65
65
  hideFilters: 'Скрыть фильтры',
66
66
  showFilters: 'Показать фильтры',
67
67
  },
68
+ ToastUpload: {
69
+ title: {
70
+ loading: 'Загрузка...',
71
+ error: 'Ошибка загрузки...',
72
+ pause: 'Загрузка приостановлена',
73
+ errorUploaded: 'Ошибка при загрузке',
74
+ uploaded: 'Загружено',
75
+ },
76
+ },
68
77
  };
@@ -1,12 +1,7 @@
1
1
  import { LOCALES } from './locales';
2
- import { PathsToProps } from './typeUtils';
2
+ import { PartialDeep, PathsToProps } from './typeUtils';
3
3
  export type KnownLocaleLang = keyof typeof LOCALES;
4
- export type LocaleLang = KnownLocaleLang;
5
- export type TranslatedEntity = {
6
- [key: string]: string | TranslatedEntity;
7
- };
8
- export type Dictionary = Record<string, TranslatedEntity>;
9
- export type LocaleDictionary<D extends Dictionary> = typeof LOCALES.en_GB & D;
10
- export type Locales<D extends Dictionary> = Record<LocaleLang, LocaleDictionary<D>>;
11
- export type DottedTranslationKey<D extends Dictionary, C extends keyof LocaleDictionary<D> | undefined = undefined> = C extends keyof LocaleDictionary<D> ? PathsToProps<LocaleDictionary<D>[C], string> : PathsToProps<LocaleDictionary<D>, string>;
12
- export type ExtendedDictionary<D> = Record<KnownLocaleLang, D>;
4
+ export type LocaleLang = KnownLocaleLang | string;
5
+ export type LocaleDictionary = typeof LOCALES.en_GB;
6
+ export type OverrideLocales = PartialDeep<Record<LocaleLang, LocaleDictionary>>;
7
+ export type DottedTranslationKey<C extends keyof LocaleDictionary | undefined = undefined> = C extends keyof LocaleDictionary ? PathsToProps<LocaleDictionary[C], string> : PathsToProps<LocaleDictionary, string>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Locale",
7
- "version": "0.12.3-preview-efee8b3e.0",
7
+ "version": "0.13.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -41,5 +41,5 @@
41
41
  "devDependencies": {
42
42
  "@types/lodash.merge": "4.6.9"
43
43
  },
44
- "gitHead": "e92f39600ead583b808a1f1f145890efb62ea70b"
44
+ "gitHead": "b27699a7db8812f2d06c49346d1b4ab6d0d8c24e"
45
45
  }
@@ -1,134 +1,53 @@
1
1
  import merge from 'lodash.merge';
2
- import { createContext, ReactNode, useCallback, useContext, useMemo } from 'react';
2
+ import { createContext, ReactNode, useMemo } from 'react';
3
3
 
4
4
  import { LOCALES } from '../../locales';
5
- import {
6
- Dictionary,
7
- DottedTranslationKey,
8
- ExtendedDictionary,
9
- KnownLocaleLang,
10
- LocaleDictionary,
11
- LocaleLang,
12
- Locales,
13
- TranslatedEntity,
14
- } from '../../types';
5
+ import { KnownLocaleLang, LocaleDictionary, LocaleLang, OverrideLocales } from '../../types';
15
6
 
16
7
  export const DEFAULT_LANG = 'en_GB';
17
8
 
18
- export type LocaleContextType<D extends Dictionary> = {
9
+ export type LocaleContextType = {
19
10
  lang: LocaleLang;
20
- locales: Locales<D>;
21
- localesByLang: LocaleDictionary<D>;
11
+ locales: OverrideLocales;
12
+ localesByLang: LocaleDictionary;
22
13
  };
23
14
 
24
- export type LocaleProviderProps<D extends Dictionary> = {
15
+ export const LocaleContext = createContext<LocaleContextType>({
16
+ lang: DEFAULT_LANG,
17
+ locales: LOCALES,
18
+ localesByLang: LOCALES.en_GB,
19
+ });
20
+
21
+ export type LocaleProviderProps = {
25
22
  lang: LocaleLang;
26
- locales?: Locales<D>;
23
+ locales?: OverrideLocales;
27
24
  children: ReactNode;
28
25
  };
29
26
 
30
- export type ContextOptions<D extends Dictionary> = {
31
- extendedDictionary?: ExtendedDictionary<D>;
32
- };
33
-
34
- function mergeLocaleWithExtension<D extends Dictionary>(extension?: ExtendedDictionary<D>): Locales<D> {
35
- return merge({}, LOCALES, extension);
36
- }
37
-
38
- type ValueOf<T> = T[keyof T];
39
-
40
- type LocaleComponentName<D extends Dictionary> = keyof LocaleDictionary<D>;
41
-
42
- type GetLocaleText<D extends Dictionary, T extends keyof LocaleDictionary<D> | undefined = undefined> = (
43
- key: DottedTranslationKey<D, T>,
44
- ) => string;
45
-
46
- export function createLocaleContext<D extends Dictionary>({ extendedDictionary }: ContextOptions<D>) {
47
- const locales = mergeLocaleWithExtension(extendedDictionary);
48
-
49
- const LocaleContext = createContext<LocaleContextType<D>>({
50
- lang: DEFAULT_LANG,
51
- locales,
52
- localesByLang: locales.en_GB,
53
- });
54
-
55
- function LocaleProvider({ lang: langProp, children }: LocaleProviderProps<D>) {
56
- const lang = useMemo(() => langProp.replace('-', '_') as LocaleLang, [langProp]);
57
-
58
- const localesByLang = useMemo(() => {
59
- let localesObj = locales[lang as KnownLocaleLang];
27
+ export function LocaleProvider({ lang: langProp, locales: localesProp, children }: LocaleProviderProps) {
28
+ const locales = useMemo(() => {
29
+ if (localesProp) {
30
+ return merge({}, LOCALES, localesProp);
31
+ }
60
32
 
61
- if (!localesObj) {
62
- console.warn(
63
- `Snack-uikit: localization for lang ${lang} was not found. Make sure you are using correct lang or passed proper locales to LocaleProvider. For now default language (${DEFAULT_LANG}) will be used`,
64
- );
33
+ return LOCALES;
34
+ }, [localesProp]);
65
35
 
66
- localesObj = locales[DEFAULT_LANG] as LocaleDictionary<D>;
67
- }
36
+ const lang = useMemo(() => langProp.replace('-', '_') as LocaleLang, [langProp]);
68
37
 
69
- return localesObj;
70
- }, [lang]);
38
+ const localesByLang = useMemo(() => {
39
+ let localesObj = locales[lang as KnownLocaleLang];
71
40
 
72
- return <LocaleContext.Provider value={{ lang, locales, localesByLang }}>{children}</LocaleContext.Provider>;
73
- }
41
+ if (!localesObj) {
42
+ console.warn(
43
+ `Snack-uikit: localization for lang ${lang} was not found. Make sure you are using correct lang or passed proper locales to LocaleProvider. For now default language (${DEFAULT_LANG}) will be used`,
44
+ );
74
45
 
75
- function useLocale(): { t: GetLocaleText<D>; lang: LocaleLang };
76
- function useLocale<C extends LocaleComponentName<D> = LocaleComponentName<D>>(
77
- componentName: C,
78
- ): { t: GetLocaleText<D, C>; lang: LocaleLang };
79
- function useLocale<C extends LocaleComponentName<D> = LocaleComponentName<D>>(componentName?: C) {
80
- const { localesByLang, lang } = useContext<LocaleContextType<D>>(LocaleContext);
46
+ localesObj = locales[DEFAULT_LANG] as LocaleDictionary;
47
+ }
81
48
 
82
- const locales = useMemo(() => {
83
- if (!componentName) {
84
- return localesByLang;
85
- }
49
+ return localesObj;
50
+ }, [lang, locales]);
86
51
 
87
- return (localesByLang[componentName] || {}) as LocaleDictionary<D>[C];
88
- }, [componentName, localesByLang]);
89
-
90
- const getLocaleText: GetLocaleText<D, C> = useCallback(
91
- key => {
92
- let translation = '';
93
-
94
- const complexKey = key.split('.');
95
-
96
- if (complexKey.length === 1) {
97
- translation = locales[key as keyof typeof locales] as unknown as string;
98
- } else {
99
- translation = complexKey.reduce<
100
- LocaleDictionary<D> | ValueOf<LocaleDictionary<D>> | TranslatedEntity | string
101
- >((acc, cur) => {
102
- if (typeof acc === 'string') {
103
- return acc;
104
- }
105
-
106
- return acc[cur as keyof typeof acc];
107
- }, locales) as string;
108
- }
109
-
110
- if (!translation?.length) {
111
- console.warn(`Snack-uikit: the '${key}' key is not found in the current locale '${lang}'.`);
112
-
113
- return key;
114
- }
115
-
116
- return translation;
117
- },
118
- [lang, locales],
119
- );
120
-
121
- return {
122
- t: getLocaleText,
123
- lang,
124
- };
125
- }
126
-
127
- return {
128
- LocaleContext,
129
- LocaleProvider,
130
- useLocale,
131
- };
52
+ return <LocaleContext.Provider value={{ lang, locales, localesByLang }}>{children}</LocaleContext.Provider>;
132
53
  }
133
-
134
- export const { LocaleProvider, useLocale } = createLocaleContext({});
@@ -0,0 +1,62 @@
1
+ import { useCallback, useContext, useMemo } from 'react';
2
+
3
+ import { DottedTranslationKey, LocaleDictionary, LocaleLang } from '../../types';
4
+ import { LocaleContext, LocaleContextType } from './LocaleProvider';
5
+
6
+ type ValueOf<T> = T[keyof T];
7
+
8
+ type LocaleComponentName = keyof LocaleDictionary;
9
+
10
+ type GetLocaleText<T extends keyof LocaleDictionary | undefined = undefined> = (key: DottedTranslationKey<T>) => string;
11
+
12
+ /**
13
+ * Inner hook to use translations
14
+ * @function helper
15
+ */
16
+ export function useLocale(): { t: GetLocaleText; lang: LocaleLang };
17
+ export function useLocale<C extends LocaleComponentName = LocaleComponentName>(
18
+ componentName: C,
19
+ ): { t: GetLocaleText<C>; lang: LocaleLang };
20
+
21
+ export function useLocale<C extends LocaleComponentName = LocaleComponentName>(componentName?: C) {
22
+ const { localesByLang, lang } = useContext<LocaleContextType>(LocaleContext);
23
+
24
+ const locales = useMemo(() => {
25
+ if (!componentName) {
26
+ return localesByLang;
27
+ }
28
+
29
+ return (localesByLang[componentName] || {}) as LocaleDictionary[C];
30
+ }, [componentName, localesByLang]);
31
+
32
+ const getLocaleText: GetLocaleText<C> = useCallback(
33
+ key => {
34
+ let translation = '';
35
+
36
+ const complexKey = key.split('.');
37
+
38
+ if (complexKey.length === 1) {
39
+ translation = locales[key as keyof typeof locales] as unknown as string;
40
+ } else {
41
+ translation = complexKey.reduce<LocaleDictionary | ValueOf<LocaleDictionary> | string>(
42
+ (acc, cur) => acc[cur as keyof typeof acc],
43
+ locales,
44
+ ) as string;
45
+ }
46
+
47
+ if (!translation?.length) {
48
+ console.warn(`Snack-uikit: the '${key}' key is not found in the current locale '${lang}'.`);
49
+
50
+ return key;
51
+ }
52
+
53
+ return translation;
54
+ },
55
+ [lang, locales],
56
+ );
57
+
58
+ return {
59
+ t: getLocaleText,
60
+ lang,
61
+ };
62
+ }
@@ -1 +1,3 @@
1
- export { type LocaleProviderProps, LocaleProvider, useLocale, createLocaleContext } from './LocaleProvider';
1
+ export { type LocaleProviderProps, LocaleProvider } from './LocaleProvider';
2
+
3
+ export { useLocale } from './hooks';
@@ -1,5 +1,3 @@
1
- import { Dictionary } from '../types';
2
-
3
1
  export const en_GB = {
4
2
  Table: {
5
3
  searchPlaceholder: 'Search',
@@ -67,4 +65,13 @@ export const en_GB = {
67
65
  hideFilters: 'Hide filters',
68
66
  showFilters: 'Show filters',
69
67
  },
70
- } satisfies Dictionary;
68
+ ToastUpload: {
69
+ title: {
70
+ loading: 'Loading...',
71
+ error: 'Error loading...',
72
+ pause: 'Paused loading',
73
+ errorUploaded: 'Error uploaded',
74
+ uploaded: 'Uploaded',
75
+ },
76
+ },
77
+ };
@@ -67,4 +67,13 @@ export const ru_RU: typeof en_GB = {
67
67
  hideFilters: 'Скрыть фильтры',
68
68
  showFilters: 'Показать фильтры',
69
69
  },
70
+ ToastUpload: {
71
+ title: {
72
+ loading: 'Загрузка...',
73
+ error: 'Ошибка загрузки...',
74
+ pause: 'Загрузка приостановлена',
75
+ errorUploaded: 'Ошибка при загрузке',
76
+ uploaded: 'Загружено',
77
+ },
78
+ },
70
79
  };
package/src/types.ts CHANGED
@@ -1,25 +1,15 @@
1
1
  import { LOCALES } from './locales';
2
- import { PathsToProps } from './typeUtils';
2
+ import { PartialDeep, PathsToProps } from './typeUtils';
3
3
 
4
4
  export type KnownLocaleLang = keyof typeof LOCALES;
5
5
 
6
- export type LocaleLang = KnownLocaleLang;
6
+ export type LocaleLang = KnownLocaleLang | string;
7
7
 
8
- export type TranslatedEntity = {
9
- [key: string]: string | TranslatedEntity;
10
- };
8
+ export type LocaleDictionary = typeof LOCALES.en_GB;
11
9
 
12
- export type Dictionary = Record<string, TranslatedEntity>;
10
+ // TODO: temporary changed type to fix typings mismatch for "locale" prop in LocaleProvider
11
+ // export type OverrideLocales = PartialDeep<Record<KnownLocaleLang, LocaleDictionary>> | Record<string, LocaleDictionary>;
12
+ export type OverrideLocales = PartialDeep<Record<LocaleLang, LocaleDictionary>>;
13
13
 
14
- export type LocaleDictionary<D extends Dictionary> = typeof LOCALES.en_GB & D;
15
-
16
- export type Locales<D extends Dictionary> = Record<LocaleLang, LocaleDictionary<D>>;
17
-
18
- export type DottedTranslationKey<
19
- D extends Dictionary,
20
- C extends keyof LocaleDictionary<D> | undefined = undefined,
21
- > = C extends keyof LocaleDictionary<D>
22
- ? PathsToProps<LocaleDictionary<D>[C], string>
23
- : PathsToProps<LocaleDictionary<D>, string>;
24
-
25
- export type ExtendedDictionary<D> = Record<KnownLocaleLang, D>;
14
+ export type DottedTranslationKey<C extends keyof LocaleDictionary | undefined = undefined> =
15
+ C extends keyof LocaleDictionary ? PathsToProps<LocaleDictionary[C], string> : PathsToProps<LocaleDictionary, string>;
@@ -1,10 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type SampleWrapperProps = {
3
- children: ReactNode;
4
- };
5
- export declare function SampleWrapper({ children }: SampleWrapperProps): import("react/jsx-runtime").JSX.Element;
6
- export declare function OldDictionaryItemSample(): import("react/jsx-runtime").JSX.Element;
7
- export declare function NewDictionarySample(): import("react/jsx-runtime").JSX.Element;
8
- export declare function NewDictSimpleTranslationComponent(): import("react/jsx-runtime").JSX.Element;
9
- export declare function NewDictDeepTranslationComponent(): import("react/jsx-runtime").JSX.Element;
10
- export {};