@sixbell-telco/sdk 1.1.0 → 1.2.1

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 (40) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +600 -166
  3. package/_index.css +34 -4
  4. package/components/badge/src/badge.component.d.ts +0 -4
  5. package/components/dialog/dialog-actions/dialog-actions.component.d.ts +8 -0
  6. package/components/dialog/dialog-content/dialog-content.component.d.ts +5 -0
  7. package/components/dialog/dialog-sub-title/dialog-sub-title.component.d.ts +5 -0
  8. package/components/dialog/dialog-title/dialog-title.component.d.ts +9 -0
  9. package/components/{modal → dialog}/index.d.ts +1 -1
  10. package/components/dialog/public-api.d.ts +5 -0
  11. package/components/dialog/src/dialog.component.d.ts +146 -0
  12. package/directives/auto-focus/src/autofocus.directive.d.ts +3 -3
  13. package/fesm2022/sixbell-telco-sdk-components-badge.mjs +1 -1
  14. package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
  15. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +356 -0
  16. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -0
  17. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +3 -0
  18. package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
  19. package/fesm2022/sixbell-telco-sdk-components-toast.mjs +2 -2
  20. package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
  21. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +3 -3
  22. package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -1
  23. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs +221 -65
  24. package/fesm2022/sixbell-telco-sdk-utils-theme.mjs.map +1 -1
  25. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +210 -62
  26. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  27. package/package.json +17 -17
  28. package/utils/theme/README.md +185 -0
  29. package/utils/theme/src/theme.service.d.ts +168 -17
  30. package/utils/translation/README.md +274 -0
  31. package/utils/translation/public-api.d.ts +3 -0
  32. package/utils/translation/src/translation.service.d.ts +134 -49
  33. package/components/modal/modal-actions/modal-actions.component.d.ts +0 -8
  34. package/components/modal/modal-content/modal-content.component.d.ts +0 -5
  35. package/components/modal/modal-title/modal-title.component.d.ts +0 -5
  36. package/components/modal/public-api.d.ts +0 -4
  37. package/components/modal/src/modal.component.d.ts +0 -102
  38. package/fesm2022/sixbell-telco-sdk-components-modal.mjs +0 -202
  39. package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +0 -1
  40. package/sixbell-telco-sdk-1.1.0.tgz +0 -0
@@ -0,0 +1,185 @@
1
+ # Theme Service
2
+
3
+ A modern Angular service for theme management with reactive signals and TypeScript IntelliSense support.
4
+
5
+ ## What it does
6
+
7
+ The Theme Service provides:
8
+
9
+ - **Reactive theme management** using Angular signals
10
+ - **TypeScript IntelliSense** for theme codes and color schemes
11
+ - **Automatic persistence** to localStorage
12
+ - **System theme detection** for light/dark preferences
13
+ - **Provider-based setup** for Angular applications
14
+
15
+ ## How to use
16
+
17
+ ### Basic setup
18
+
19
+ ```typescript
20
+ // app.config.ts
21
+ import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
22
+
23
+ export const appConfig: ApplicationConfig = {
24
+ providers: [
25
+ provideTheme({
26
+ defaultScheme: 'system',
27
+ defaultTheme: 'sixbell_telco', // IntelliSense: 'sixbell_telco'
28
+ }),
29
+ ],
30
+ };
31
+ ```
32
+
33
+ ### With additional themes
34
+
35
+ ```typescript
36
+ // app.config.ts
37
+ import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
38
+
39
+ export const appConfig: ApplicationConfig = {
40
+ providers: [
41
+ provideTheme({
42
+ additionalThemes: ['custom', 'dark_mode'],
43
+ defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | 'custom' | 'dark_mode'
44
+ excludeThemes: ['sixbell_telco'], // IntelliSense: all available themes
45
+ defaultScheme: 'dark',
46
+ }),
47
+ ],
48
+ };
49
+ ```
50
+
51
+ ### Using in components
52
+
53
+ ```typescript
54
+ // component.ts
55
+ import { ThemeService } from '@sixbell-telco/sdk/utils/theme';
56
+
57
+ @Component({
58
+ template: `
59
+ <div [class]="theme.finalTheme()">
60
+ <p>Current theme: {{ theme.selectedTheme() }}</p>
61
+ <p>Dark mode: {{ theme.isDarkTheme() ? 'Yes' : 'No' }}</p>
62
+ </div>
63
+ `,
64
+ })
65
+ export class MyComponent {
66
+ theme = inject(ThemeService);
67
+
68
+ changeTheme(themeName: string) {
69
+ this.theme.setTheme(themeName);
70
+ }
71
+
72
+ toggleScheme() {
73
+ const current = this.theme.selectedScheme();
74
+ this.theme.setScheme(current === 'dark' ? 'light' : 'dark');
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Reactive themes in templates
80
+
81
+ ```html
82
+ <!-- Conditional rendering based on theme -->
83
+ <div [class]="theme.finalTheme()">Content with reactive theme classes</div>
84
+
85
+ <!-- Dark mode specific content -->
86
+ @if (theme.isDarkTheme()) {
87
+ <p>Dark mode is active</p>
88
+ } @else {
89
+ <p>Light mode is active</p>
90
+ }
91
+
92
+ <!-- Theme selector -->
93
+ <select (change)="changeTheme($event.target.value)">
94
+ @for (themeName of theme.getAvailableThemes(); track themeName) {
95
+ <option [value]="themeName">{{ themeName }}</option>
96
+ }
97
+ </select>
98
+ ```
99
+
100
+ ## Key features
101
+
102
+ - **Signal-based reactivity** - Modern Angular reactive patterns
103
+ - **IntelliSense support** - Full TypeScript autocomplete for theme codes
104
+ - **System theme detection** - Automatic light/dark mode based on OS preference
105
+ - **Flexible configuration** - Add themes, exclude unwanted ones
106
+ - **Provider pattern** - Clean Angular dependency injection setup
107
+ - **Automatic persistence** - Saves user preferences to localStorage
108
+
109
+ ## Default theme
110
+
111
+ - `sixbell_telco` - Always available unless excluded
112
+
113
+ You can add more themes using `additionalThemes` or exclude the default one using `excludeThemes`.
114
+
115
+ ## Color schemes
116
+
117
+ - `system` - Follows OS preference (default)
118
+ - `light` - Force light mode
119
+ - `dark` - Force dark mode
120
+
121
+ ## Reactive signals
122
+
123
+ The service exposes these reactive signals:
124
+
125
+ - `selectedTheme()` - Current selected theme
126
+ - `selectedScheme()` - Current selected scheme ('system' | 'light' | 'dark')
127
+ - `resolvedScheme()` - Actual resolved scheme ('light' | 'dark')
128
+ - `isDarkTheme()` - Boolean indicating if current resolved scheme is dark
129
+ - `finalTheme()` - Complete theme string (e.g., 'sixbell_telco\_\_dark')
130
+
131
+ ## Methods
132
+
133
+ - `setTheme(theme: string)` - Change current theme
134
+ - `setScheme(scheme: ThemeScheme)` - Change color scheme
135
+ - `getAvailableThemes()` - Get list of available themes
136
+ - `getAvailableSchemes()` - Get list of available schemes
137
+ - `getDefaultTheme()` - Get default theme
138
+
139
+ ## Configuration options
140
+
141
+ | Property | Type | Description |
142
+ | ------------------ | ------------------------------- | ------------------------------------------------------------- |
143
+ | `additionalThemes` | `readonly string[]` | Additional themes beyond the default `sixbell_telco` |
144
+ | `defaultTheme` | `string` | Default theme to use (with IntelliSense for available themes) |
145
+ | `excludeThemes` | `readonly string[]` | Themes to exclude from available themes |
146
+ | `defaultScheme` | `'system' \| 'light' \| 'dark'` | Default color scheme preference |
147
+
148
+ ## Advanced usage
149
+
150
+ ### System theme detection
151
+
152
+ The service automatically detects system color scheme preferences:
153
+
154
+ ```typescript
155
+ @Component({
156
+ template: `
157
+ <p>System prefers: {{ theme.resolvedScheme() }}</p>
158
+ <p>User selected: {{ theme.selectedScheme() }}</p>
159
+ `,
160
+ })
161
+ export class ThemeInfoComponent {
162
+ theme = inject(ThemeService);
163
+ }
164
+ ```
165
+
166
+ ### Reactive CSS classes
167
+
168
+ Use the `finalTheme()` signal for dynamic CSS classes:
169
+
170
+ ```typescript
171
+ @Component({
172
+ template: `
173
+ <div [class]="'app-container ' + theme.finalTheme()">
174
+ <div [class.dark-mode]="theme.isDarkTheme()">Content adapts to theme automatically</div>
175
+ </div>
176
+ `,
177
+ })
178
+ export class AppComponent {
179
+ theme = inject(ThemeService);
180
+ }
181
+ ```
182
+
183
+ ### Theme persistence
184
+
185
+ User preferences are automatically saved to localStorage and restored on app initialization. No additional setup required.
@@ -1,42 +1,134 @@
1
- import { RendererFactory2 } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Provider, RendererFactory2 } from '@angular/core';
2
+ import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
2
3
  import * as i0 from "@angular/core";
3
4
  export type ThemeScheme = 'system' | 'light' | 'dark';
5
+ export type ResolvedThemeScheme = 'light' | 'dark';
6
+ export declare const DEFAULT_BASE_THEME = "sixbell_telco";
7
+ export declare const DEFAULT_THEMES: readonly ["sixbell_telco"];
8
+ export declare const DEFAULT_THEME_CODES: readonly ["sixbell_telco"];
9
+ export type DefaultThemeCode = (typeof DEFAULT_THEME_CODES)[number];
10
+ type ExtractThemeCode<T> = T extends readonly (infer U)[] ? U : never;
11
+ /**
12
+ * Base theme configuration interface without additional themes
13
+ * Provides IntelliSense for the default base theme (sixbell_telco)
14
+ */
15
+ export interface ThemeConfigWithoutAdditionalThemes {
16
+ /**
17
+ * Default theme code (base theme: sixbell_telco)
18
+ * @example 'sixbell_telco'
19
+ */
20
+ defaultTheme?: DefaultThemeCode;
21
+ /**
22
+ * Themes to exclude from the available set (base theme: sixbell_telco)
23
+ * @example ['sixbell_telco'] to exclude the default theme
24
+ */
25
+ excludeThemes?: readonly DefaultThemeCode[];
26
+ /**
27
+ * Default color scheme preference
28
+ * @example 'system' | 'light' | 'dark'
29
+ */
30
+ defaultScheme?: ThemeScheme;
31
+ }
32
+ /**
33
+ * Theme configuration interface with additional themes providing IntelliSense
34
+ */
35
+ export interface ThemeConfigWithAdditionalThemes<T extends readonly string[]> {
36
+ /**
37
+ * Additional themes to make available beyond the default base theme (sixbell_telco)
38
+ * When you add themes here, they become available in defaultTheme and excludeThemes
39
+ * @example ['custom', 'dark_mode', 'high_contrast']
40
+ */
41
+ additionalThemes: T;
42
+ /**
43
+ * Default theme code
44
+ * IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above
45
+ * @example 'sixbell_telco'
46
+ */
47
+ defaultTheme?: DefaultThemeCode | ExtractThemeCode<T>;
48
+ /**
49
+ * Themes to exclude from the available set
50
+ * IntelliSense includes: base theme (sixbell_telco) + any additionalThemes you specified above
51
+ * @example ['sixbell_telco'] to exclude the default theme
52
+ */
53
+ excludeThemes?: readonly (DefaultThemeCode | ExtractThemeCode<T>)[];
54
+ /**
55
+ * Default color scheme preference
56
+ * @example 'system' | 'light' | 'dark'
57
+ */
58
+ defaultScheme?: ThemeScheme;
59
+ }
60
+ /**
61
+ * Main theme configuration interface (generic version)
62
+ * Always provides IntelliSense for at least the base theme (sixbell_telco)
63
+ */
4
64
  export interface ThemeConfig {
5
- availableThemes?: string[];
65
+ /**
66
+ * Additional themes to make available beyond the default base theme (sixbell_telco)
67
+ * When you add themes here, they become available in defaultTheme and excludeThemes
68
+ * @example ['custom', 'dark_mode', 'high_contrast']
69
+ */
70
+ additionalThemes?: readonly string[];
71
+ /**
72
+ * Default theme code
73
+ * Always includes base theme (sixbell_telco), plus any additionalThemes you specify
74
+ * @example 'sixbell_telco'
75
+ */
6
76
  defaultTheme?: string;
77
+ /**
78
+ * Themes to exclude from the available set
79
+ * Always includes base theme (sixbell_telco), plus any additionalThemes you specify
80
+ * @example ['sixbell_telco'] to exclude the default theme
81
+ */
82
+ excludeThemes?: readonly string[];
83
+ /**
84
+ * Default color scheme preference
85
+ * @example 'system' | 'light' | 'dark'
86
+ */
7
87
  defaultScheme?: ThemeScheme;
8
88
  }
89
+ export declare const THEME_CONFIG_TOKEN: InjectionToken<ThemeConfig>;
9
90
  export declare class ThemeService {
10
91
  private readonly rendererFactory;
11
92
  private readonly document;
93
+ private readonly themeConfig?;
94
+ readonly translationService: TranslationService;
12
95
  private readonly renderer;
13
- private readonly fixedSchemes;
96
+ private initialized;
14
97
  private config;
15
98
  selectedTheme: import("@angular/core").WritableSignal<string>;
16
99
  selectedScheme: import("@angular/core").WritableSignal<ThemeScheme>;
100
+ /**
101
+ * Get the actual resolved scheme ('light' or 'dark') regardless of user selection.
102
+ * This is useful for conditional rendering where you need to know the actual
103
+ * light/dark state, even when the user has selected 'system' preference.
104
+ */
105
+ resolvedScheme: import("@angular/core").Signal<"light" | "dark">;
106
+ /**
107
+ * Convenient computed signal that returns true when the current resolved scheme is 'dark'.
108
+ */
109
+ isDarkTheme: import("@angular/core").Signal<boolean>;
17
110
  finalTheme: import("@angular/core").Signal<string>;
18
- constructor(rendererFactory: RendererFactory2, document: Document);
111
+ constructor(rendererFactory: RendererFactory2, document: Document, themeConfig?: ThemeConfig | undefined);
19
112
  /**
20
- * Initialize the theme service with custom configuration
113
+ * Configure and initialize the theme service (used by provider)
21
114
  */
22
- configure(config: Partial<ThemeConfig>): void;
115
+ configure(config?: ThemeConfig): void;
23
116
  /**
24
117
  * Initialize theme from localStorage and apply it immediately
25
- * Call this as early as possible in your app
26
118
  */
27
- initializeTheme(): void;
119
+ private initializeFromStorage;
28
120
  /**
29
121
  * Apply the current theme to the document
30
122
  */
31
123
  private applyTheme;
32
124
  /**
33
- * Update theme and persist to localStorage
125
+ * Set the current theme
34
126
  */
35
- updateTheme(theme: string): void;
127
+ setTheme(theme: string): void;
36
128
  /**
37
- * Update scheme and persist to localStorage
129
+ * Set the current color scheme
38
130
  */
39
- updateScheme(scheme: ThemeScheme): void;
131
+ setScheme(scheme: ThemeScheme): void;
40
132
  /**
41
133
  * Get available themes
42
134
  */
@@ -44,12 +136,71 @@ export declare class ThemeService {
44
136
  /**
45
137
  * Get available schemes
46
138
  */
47
- getAvailableSchemes(): readonly ThemeScheme[];
139
+ getAvailableSchemes(): ThemeScheme[];
48
140
  /**
49
- * Initialize theme before Angular boots
50
- * This should be called in main.ts before bootstrapApplication
141
+ * Get default theme
51
142
  */
52
- static init(config?: ThemeConfig): void;
53
- static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
143
+ getDefaultTheme(): string;
144
+ /**
145
+ * Get default scheme
146
+ */
147
+ getDefaultScheme(): ThemeScheme;
148
+ /**
149
+ * Get localized scheme name by code using translations
150
+ * This automatically returns the localized name based on the current language
151
+ */
152
+ getLocalizedSchemeName(scheme: string): string;
153
+ /**
154
+ * Get localized theme name by code using translations
155
+ * This automatically returns the localized name based on the current language
156
+ */
157
+ getLocalizedThemeName(theme: string): string;
158
+ /**
159
+ * Force initialization method for MFE environments
160
+ */
161
+ init(): void;
162
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, [null, null, { optional: true; }]>;
54
163
  static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
55
164
  }
165
+ /**
166
+ * Provider function for theme configuration in Angular applications
167
+ * This provides the theme configuration through dependency injection
168
+ *
169
+ * @param config Optional theme configuration
170
+ * @returns Provider array that configures theme service
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * // app.config.ts
175
+ * import { provideTheme } from '@sixbell-telco/sdk/utils/theme';
176
+ *
177
+ * export const appConfig: ApplicationConfig = {
178
+ * providers: [
179
+ * provideRouter(routes),
180
+ *
181
+ * // Basic usage - sixbell_telco always available
182
+ * provideTheme({
183
+ * defaultScheme: 'light',
184
+ * defaultTheme: 'sixbell_telco' // IntelliSense: 'sixbell_telco'
185
+ * }),
186
+ *
187
+ * // With additional themes
188
+ * provideTheme({
189
+ * additionalThemes: ['wom', 'custom'] as const,
190
+ * defaultTheme: 'custom', // IntelliSense: 'sixbell_telco' | string
191
+ * excludeThemes: ['wom'] as const, // IntelliSense: 'sixbell_telco' | string
192
+ * defaultScheme: 'system'
193
+ * }),
194
+ *
195
+ * // ... other providers
196
+ * ],
197
+ * };
198
+ * ```
199
+ */
200
+ export declare function provideTheme<const T extends readonly string[] = []>(config?: {
201
+ additionalThemes?: T;
202
+ defaultTheme?: T extends readonly [string, ...string[]] ? DefaultThemeCode | ExtractThemeCode<T> : DefaultThemeCode;
203
+ excludeThemes?: T extends readonly [string, ...string[]] ? readonly (DefaultThemeCode | ExtractThemeCode<T>)[] : readonly DefaultThemeCode[];
204
+ defaultScheme?: ThemeScheme;
205
+ }): (Provider | EnvironmentProviders)[];
206
+ export {};
@@ -0,0 +1,274 @@
1
+ # Translation Service
2
+
3
+ A modern Angular service for internationalization using ngx-translate with TypeScript IntelliSense support.
4
+
5
+ ## What it does
6
+
7
+ The Translation Service provides:
8
+
9
+ - **Internationalization** with ngx-translate integration
10
+ - **TypeScript IntelliSense** for language codes and translation keys
11
+ - **Reactive translation** using Angular signals
12
+ - **Flexible configuration** for additional languages and exclusions
13
+ - **Provider-based setup** for Angular applications
14
+
15
+ ## How to use
16
+
17
+ ### Basic setup
18
+
19
+ ```typescript
20
+ // app.config.ts
21
+ import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
22
+
23
+ export const appConfig: ApplicationConfig = {
24
+ providers: [
25
+ provideTranslation({
26
+ defaultLang: 'es', // IntelliSense: 'en' | 'es' | 'pt'
27
+ excludeLanguages: ['pt'], // IntelliSense: 'en' | 'es' | 'pt'
28
+ }),
29
+ ],
30
+ };
31
+ ```
32
+
33
+ ### With additional languages
34
+
35
+ ```typescript
36
+ // app.config.ts
37
+ import { provideTranslation } from '@sixbell-telco/sdk/utils/translation';
38
+
39
+ export const appConfig: ApplicationConfig = {
40
+ providers: [
41
+ provideTranslation({
42
+ additionalLanguages: [
43
+ { code: 'de', name: 'Deutsch' },
44
+ { code: 'fr', name: 'Français' },
45
+ { code: 'it', name: 'Italiano' },
46
+ ],
47
+ defaultLang: 'de', // IntelliSense: 'en' | 'es' | 'pt' | 'de' | 'fr' | 'it'
48
+ excludeLanguages: ['pt', 'it'], // IntelliSense: all available languages
49
+ translationPaths: ['/assets/i18n/', '/assets/i18n/sdk/'],
50
+ }),
51
+ ],
52
+ };
53
+ ```
54
+
55
+ ### Using in components
56
+
57
+ ```typescript
58
+ // component.ts
59
+ import { TranslationService } from '@sixbell-telco/sdk/utils/translation';
60
+
61
+ @Component({
62
+ template: `
63
+ <div>
64
+ <p>{{ 'common.welcome' | translate }}</p>
65
+ <p>Current language: {{ translation.getCurrentLanguage() }}</p>
66
+
67
+ <select (change)="changeLanguage($event.target.value)">
68
+ @for (lang of translation.getAvailableLanguagesConfig(); track lang.code) {
69
+ <option [value]="lang.code">{{ lang.name }}</option>
70
+ }
71
+ </select>
72
+ </div>
73
+ `,
74
+ })
75
+ export class MyComponent {
76
+ translation = inject(TranslationService);
77
+
78
+ changeLanguage(langCode: string) {
79
+ this.translation.setLanguage(langCode);
80
+ }
81
+
82
+ translateMessage(key: string, params?: any) {
83
+ return this.translation.instant(key, params);
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### Reactive translations in templates
89
+
90
+ ```html
91
+ <!-- Direct translation with ngx-translate pipe -->
92
+ <p>{{ 'common.welcome' | translate }}</p>
93
+
94
+ <!-- Translation with parameters -->
95
+ <p>{{ 'common.greeting' | translate: { name: userName } }}</p>
96
+
97
+ <!-- Async translation -->
98
+ <p>{{ translation.get('common.message') | async }}</p>
99
+
100
+ <!-- Conditional content based on language -->
101
+ @if (translation.getCurrentLanguage() === 'es') {
102
+ <p>Contenido en español</p>
103
+ } @else {
104
+ <p>Content in other language</p>
105
+ }
106
+ ```
107
+
108
+ ## Key features
109
+
110
+ - **Signal-based reactivity** - Modern Angular reactive patterns
111
+ - **IntelliSense support** - Full TypeScript autocomplete for language codes
112
+ - **Flexible configuration** - Add languages, exclude unwanted ones
113
+ - **Provider pattern** - Clean Angular dependency injection setup
114
+ - **Automatic persistence** - Saves user preferences to localStorage
115
+ - **ngx-translate integration** - Full compatibility with existing translation workflows
116
+
117
+ ## Default languages
118
+
119
+ - `en` (English) - Always available unless excluded
120
+ - `es` (Spanish) - Always available unless excluded
121
+ - `pt` (Portuguese) - Always available unless excluded
122
+
123
+ You can add more languages using `additionalLanguages` or exclude default ones using `excludeLanguages`.
124
+
125
+ ## Translation methods
126
+
127
+ The service provides convenient methods for translations:
128
+
129
+ - `instant(key: string, params?: any)` - Get immediate translation
130
+ - `get(key: string, params?: any)` - Get translation as Observable
131
+ - `stream(key: string, params?: any)` - Get translation stream that updates on language changes
132
+ - `setLanguage(langCode: string)` - Change current language
133
+ - `getCurrentLanguage()` - Get current language code
134
+ - `getDefaultLanguage()` - Get default language code
135
+ - `getAvailableLanguagesConfig()` - Get all available language definitions
136
+ - `getAvailableLanguageCodes()` - Get array of available language codes
137
+ - `getLanguageByCode(code: string)` - Get language definition by code
138
+ - `getLanguageDisplayName(code: string)` - Get display name for language code
139
+
140
+ ## Configuration options
141
+
142
+ | Property | Type | Description |
143
+ | --------------------- | ------------------------------- | ------------------------------------------------------------------- |
144
+ | `additionalLanguages` | `readonly LanguageDefinition[]` | Additional languages beyond the defaults |
145
+ | `defaultLang` | `string` | Default language to use (with IntelliSense for available languages) |
146
+ | `excludeLanguages` | `readonly string[]` | Languages to exclude from available languages |
147
+ | `translationPaths` | `string[]` | Custom paths for translation files (default: `['/assets/i18n/']`) |
148
+
149
+ ## Language definition interface
150
+
151
+ ```typescript
152
+ interface LanguageDefinition {
153
+ code: string; // Language code (e.g., 'en', 'es', 'de')
154
+ name: string; // Display name (e.g., 'English', 'Español', 'Deutsch')
155
+ }
156
+ ```
157
+
158
+ ## Translation file structure
159
+
160
+ Place your translation files in `/assets/i18n/` with the following structure:
161
+
162
+ ```
163
+ src/
164
+ assets/
165
+ i18n/
166
+ en.json
167
+ es.json
168
+ pt.json
169
+ de.json // if using additional languages
170
+ ```
171
+
172
+ Example translation file (`en.json`):
173
+
174
+ ```json
175
+ {
176
+ "common": {
177
+ "welcome": "Welcome",
178
+ "greeting": "Hello {{name}}!",
179
+ "message": "This is a message"
180
+ },
181
+ "navigation": {
182
+ "home": "Home",
183
+ "about": "About",
184
+ "contact": "Contact"
185
+ }
186
+ }
187
+ ```
188
+
189
+ ## Advanced usage
190
+
191
+ ### Custom translation paths
192
+
193
+ ```typescript
194
+ provideTranslation({
195
+ translationPaths: [
196
+ '/assets/i18n/', // Main translations
197
+ '/assets/i18n/modules/', // Module-specific translations
198
+ '/assets/i18n/sdk/', // SDK translations
199
+ ],
200
+ });
201
+ ```
202
+
203
+ ### Programmatic language detection
204
+
205
+ ```typescript
206
+ @Component({...})
207
+ export class LanguageDetectorComponent {
208
+ translation = inject(TranslationService);
209
+
210
+ ngOnInit() {
211
+ // Detect browser language
212
+ const browserLang = navigator.language.split('-')[0];
213
+ const availableCodes = this.translation.getAvailableLanguageCodes();
214
+
215
+ if (availableCodes.includes(browserLang)) {
216
+ this.translation.setLanguage(browserLang);
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ### Reactive language switching
223
+
224
+ ```typescript
225
+ @Component({
226
+ template: `
227
+ <div class="language-switcher">
228
+ @for (lang of availableLanguages; track lang.code) {
229
+ <button [class.active]="lang.code === currentLanguage" (click)="switchLanguage(lang.code)">
230
+ {{ lang.name }}
231
+ </button>
232
+ }
233
+ </div>
234
+ `,
235
+ })
236
+ export class LanguageSwitcherComponent {
237
+ translation = inject(TranslationService);
238
+
239
+ availableLanguages = this.translation.getAvailableLanguagesConfig();
240
+ currentLanguage = this.translation.getCurrentLanguage();
241
+
242
+ switchLanguage(langCode: string) {
243
+ this.translation.setLanguage(langCode);
244
+ this.currentLanguage = this.translation.getCurrentLanguage();
245
+ }
246
+ }
247
+ ```
248
+
249
+ ## What's included automatically
250
+
251
+ The `provideTranslation()` provider automatically configures:
252
+
253
+ - ✅ `TranslateService` from `@ngx-translate/core`
254
+ - ✅ `TranslateHttpLoader` with configurable paths
255
+ - ✅ All necessary ngx-translate providers
256
+ - ✅ Automatic service initialization for MFE compatibility
257
+ - ✅ Browser environment safety checks
258
+
259
+ ## Available components
260
+
261
+ All useful ngx-translate components are automatically available for import:
262
+
263
+ ```typescript
264
+ import {
265
+ TranslatePipe,
266
+ TranslateDirective,
267
+ TranslateService,
268
+ // ... all other ngx-translate exports
269
+ } from '@sixbell-telco/sdk/utils/translation';
270
+ ```
271
+
272
+ ## Language persistence
273
+
274
+ User language preferences are automatically saved to localStorage and restored on app initialization. No additional setup required.
@@ -1 +1,4 @@
1
1
  export * from './src/translation.service';
2
+ export * from '@ngx-translate/core';
3
+ export * from '@ngx-translate/http-loader';
4
+ export * from 'ngx-translate-multi-http-loader';