@linagora/linid-im-front-corelib 0.0.82 → 0.0.83

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.
@@ -35,3 +35,30 @@ export declare function useScopedI18n(scope: string): {
35
35
  */
36
36
  translateOrDefault: (defaultValue: string, ...args: unknown[]) => ReturnType<ComposerTranslation>;
37
37
  };
38
+ /**
39
+ * Resolves the effective locale to apply, without any side effect.
40
+ *
41
+ * The locale is resolved by priority: the stored user preference first, then the locally persisted language.
42
+ * If neither the stored preference nor the localStorage value is a supported language, the UI store locale is used as the fallback.
43
+ * @returns The locale code the caller should apply to its i18n target.
44
+ */
45
+ export declare function resolveLocale(): string;
46
+ /**
47
+ * Synchronises the persisted state with the given locale.
48
+ *
49
+ * The locale is always written to localStorage. The server-side user preference is updated only when it differs from
50
+ * the currently stored one.
51
+ * @param locale - The locale to persist.
52
+ * @returns A promise that resolves once the persisted state has been synchronised.
53
+ */
54
+ export declare function syncLocale(locale: string): Promise<void>;
55
+ /**
56
+ * Applies the given locale to the application and persists the choice.
57
+ *
58
+ * Updates the active i18n locale, reflects it in the UI store, and synchronises the persisted state. This assumes the
59
+ * shared i18n instance runs in Composition mode (legacy: false), as guaranteed by the corelib LinidI18n convention;
60
+ * on a legacy instance the locale assignment would be a silent no-op at runtime.
61
+ * @param locale - The locale code to apply (e.g. "fr-FR").
62
+ * @returns A promise that resolves once the locale has been applied and persisted.
63
+ */
64
+ export declare function changeLocale(locale: string): Promise<void>;
@@ -8,7 +8,7 @@ export { usePagination } from './composables/usePagination';
8
8
  export { QDATE_DEFAULT_MASK, useQuasarDate } from './composables/useQuasarDate';
9
9
  export { useQuasarFieldValidation } from './composables/useQuasarFieldValidation';
10
10
  export { useQuasarRules } from './composables/useQuasarRules';
11
- export { useScopedI18n } from './composables/useScopedI18n';
11
+ export { changeLocale, resolveLocale, syncLocale, useScopedI18n, } from './composables/useScopedI18n';
12
12
  export { useTree } from './composables/useTree';
13
13
  export { useUiDesign } from './composables/useUiDesign';
14
14
  export { useLinidFilterUrl } from './composables/useLinidFilterUrl';
@@ -5,6 +5,13 @@ import type { NavigationMenuItem } from '../types/linidUi';
5
5
  interface LinidUiState {
6
6
  /** List of main navigation menu items. */
7
7
  mainNavigationItems: NavigationMenuItem[];
8
+ /** Internationalization state: active locale and available languages. */
9
+ i18n: {
10
+ /** Currently active locale code (e.g. "fr-FR"). */
11
+ locale: string;
12
+ /** List of available locale codes declared in the configuration. */
13
+ languages: string[];
14
+ };
8
15
  }
9
16
  /**
10
17
  * Returns the Linid UI Store instance.
@@ -16,5 +23,15 @@ export declare const useLinidUiStore: () => import("pinia").Store<"LinidUiStore"
16
23
  * @param items - The navigation menu items to add.
17
24
  */
18
25
  addMainNavigationMenuItems(...items: NavigationMenuItem[]): void;
26
+ /**
27
+ * Sets the list of available locale codes.
28
+ * @param languages - The available locale codes (e.g. ["fr-FR", "en-US"]).
29
+ */
30
+ setAvailableLanguages(languages: string[]): void;
31
+ /**
32
+ * Sets the active locale code.
33
+ * @param locale - The locale code to activate (e.g. "fr-FR").
34
+ */
35
+ setLocale(locale: string): void;
19
36
  }>;
20
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linagora/linid-im-front-corelib",
3
- "version": "0.0.82",
3
+ "version": "0.0.83",
4
4
  "description": "Core library of the LinID Identity Manager project. Provides shared types, services, components, and utilities for front-end and plugin, enabling consistent integration across the LinID ecosystem.",
5
5
  "type": "module",
6
6
  "files": [