@grasp-labs/ds-microfrontends-integration 0.12.1 → 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.
@@ -2,3 +2,4 @@ export * from './schemaFields';
2
2
  export * from './toast';
3
3
  export * from './vault';
4
4
  export * from './translation';
5
+ export * from './language';
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Gets the currently selected language from localStorage.
4
+ */
5
+ export declare const getLanguage: () => string;
6
+ type LanguageContextValue = {
7
+ language: string;
8
+ setLanguage: (language: string) => void;
9
+ };
10
+ export type LanguageProviderProps = {
11
+ children: ReactNode;
12
+ };
13
+ /**
14
+ * Provides language context to child components.
15
+ * Manages language state and persists selection to localStorage.
16
+ * Default language is "en".
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <LanguageProvider>
21
+ * <App />
22
+ * </LanguageProvider>
23
+ * ```
24
+ */
25
+ export declare const LanguageProvider: ({ children }: LanguageProviderProps) => import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * Hook to access language context.
28
+ *
29
+ * @returns The current language and setter function.
30
+ * @throws Error if used outside of LanguageProvider.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * const { language, setLanguage } = useLanguage();
35
+ * ```
36
+ */
37
+ export declare const useLanguage: () => LanguageContextValue;
38
+ export {};
@@ -0,0 +1 @@
1
+ export * from './LanguageProvider';
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
1
  import { InitOptions, Resource } from 'i18next';
2
+ import { ReactNode } from 'react';
3
3
  import { TranslationFn } from '../../../types';
4
4
  type TranslationContextValue = {
5
5
  t: TranslationFn;
@@ -17,6 +17,10 @@ export type TranslationProviderProps = {
17
17
  /**
18
18
  * Translation provider with simple reactive updates.
19
19
  *
20
+ * @deprecated Applications should handle their translations independently.
21
+ * Use LanguageProvider for shared language state management across microfrontends,
22
+ * and implement translation handling individually within each microfrontend.
23
+ *
20
24
  * @example
21
25
  * ```tsx
22
26
  * <TranslationProvider language="en" resources={customResources}>