@griddo/core 11.3.2 → 11.3.3

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.
@@ -1,9 +1,8 @@
1
1
  import type { Locale } from "../types/core";
2
- type I18nTranslationFunction = (
3
- /** Key from the translation object that will be obtained */
4
- key: string,
5
- /** Fallback string in case `key` returns undefined */
6
- defaultString?: string) => string | Record<string, unknown>;
2
+ export interface UseI18nProps {
3
+ /** Locale code from where get the translation. This locale override the current page language */
4
+ locale?: Locale;
5
+ }
7
6
  /**
8
7
  * returns functions to get the translations from the context taking into
9
8
  * account the language (locale) of the current page.
@@ -15,11 +14,7 @@ defaultString?: string) => string | Record<string, unknown>;
15
14
  * const bar = getNestedTranslation("modules.backLabel")
16
15
  */
17
16
  declare function useI18n(props?: UseI18nProps): {
18
- getTranslation: I18nTranslationFunction;
19
- getNestedTranslation: I18nTranslationFunction;
17
+ getTranslation: <T = string>(key: string, defaultString?: string) => T;
18
+ getNestedTranslation: <T_1 = string>(key: string, defaultString?: string) => T_1;
20
19
  };
21
- export interface UseI18nProps {
22
- /** Locale code from where get the translation. This locale override the current page language */
23
- locale?: Locale;
24
- }
25
20
  export { useI18n };