### File

`packages/core/src/lib/services/i18n/i18n.service.ts`

### Extends

`EuiLazyService`

### Index

###### Methods

- Public addResources
- getSignal
- getState
- getState
- getState
- getState
- init
- Public lazyLoad
- lazyLoadInit
- onReady
- updateState
- updateState
- updateState

### Constructor

`constructor(baseGlobalConfig: GlobalConfig, translateService: TranslateService, logService: LogService, store: StoreService<T>, document: Document)`

Parameters :

Name | Type | Optional
baseGlobalConfig | `GlobalConfig` | No
translateService | `TranslateService` | No
logService | `LogService` | No
store | `StoreService<T>` | No
document | `Document` | No

### Methods

Public addResources
`addResources(config: I18nLoaderConfig, moduleName?: string)`

Add resources based of a config loader

Parameters :

Name | Type | Optional | Description
config | `I18nLoaderConfig` | No | I18nLoaderConfig
moduleName | `string` | Yes |

Returns : `Observable<EuiServiceStatus>`

Promise<EuiServiceStatus> an EuiServiceStatus when translation has fully loaded

getSignal
`getSignal()`
This method is used to get the state as readonly signal. Returns : `Signal<T>`

getState
`getState()`
Returns : `Observable<T>`

getState
this will be removed in a future version
`getState(mapFn?: (state?: T) => void)`

Type parameters :

- K

Parameters :

Name | Type | Optional
mapFn | `function` | Yes

Returns : `Observable<K>`

getState
`getState(key?: a)`

Type parameters :

- a

Parameters :

Name | Type | Optional
key | `a` | Yes

Returns : `Observable<DeepPartial<a>>`

getState
`getState(keyOrMapFn?: | string)`

Type parameters :

- K

Parameters :

Name | Type | Optional
keyOrMapFn | `| string` | Yes

Returns : `Observable<DeepPartial<K>>`

init
`init(langState?: T)`

Parameters :

Name | Type | Optional
langState | `T` | Yes

Returns : `Observable<EuiServiceStatus>`

Public lazyLoad
`lazyLoad(config: I18nLoaderConfig)`

Parameters :

Name | Type | Optional
config | `I18nLoaderConfig` | No

Returns : `Observable<EuiServiceStatus>`

lazyLoadInit
`lazyLoadInit(moduleConfig: ModuleConfig, moduleName?: string)`

Parameters :

Name | Type | Optional
moduleConfig | `ModuleConfig` | No
moduleName | `string` | Yes

Returns : `Observable<EuiServiceStatus>`

onReady
`onReady(moduleName?: string)`

A pipe function that could serve as a wrapper of another observable e.g. ngx-translate i18n.onReady('my_module').pipe(switchMap(()=>translate.get('eui.KEY'))); WARNING: onReady will emit only once for a loaded Module, going to another and then going back will not result into another emission.

fetch module name from the state.

Parameters :

Name | Type | Optional | Description
moduleName | `string` | Yes | the name of the module that has been given through the eUI globalConfig. In case non provided fetch module name from the state.

Returns : `Observable<ModuleLoadEvent>`

updateState
`updateState(state: DeepPartial<T>)`

Parameters :

Name | Type | Optional
state | `DeepPartial<T>` | No

Returns : `void`

updateState
it will be removed in next version. Use updateState(partialState: DeepPartial<T>) instead
`updateState(slice: DeepPartial<T>, reducer: (state: T,action: DeepPartial<T>) => void)`

Parameters :

Name | Type | Optional
slice | `DeepPartial<T>` | No
reducer | `function` | No

Returns : `void`

updateState
`updateState(state: DeepPartial<K>, reducer?: (state?: T,action?: DeepPartial<K>) => void)`

Type parameters :

- K

Parameters :

Name | Type | Optional
state | `DeepPartial<K>` | No
reducer | `function` | Yes

Returns : `void`

# results matching ""

# No results matching ""