TranslationService
Defined in: src/services/translation.service.ts:25
Core service for translation handling
Since
1.0.0
Author
Simon Kovtyk
Constructors
Constructor
new TranslationService(): TranslationService;Returns
TranslationService
Methods
_preloadWithRef$()
_preloadWithRef$(
httpClient,
translationStoreService,
translationHttpService,
_locale,
scopeName,
httpOptions?): Observable<void>;Defined in: src/services/translation.service.ts:66
Preload multiple translations with references
Parameters
| Parameter | Type | Description |
|---|---|---|
httpClient | Readonly<HttpClient> | The HttpClient, that'll be used |
translationStoreService | Readonly<TranslationStoreService> | The TranslationStoreService, that'll be used |
translationHttpService | Readonly<TranslationHttpService> | The TranslationHttpService, that'll be used |
_locale | LocaleConfig | The LocaleConfig, that should be preloaded |
scopeName | string | readonly (string | null)[] | null | The scope name for the lookup of the translation |
httpOptions? | HttpOptions<never, HttpHeadersOption, never> | Additional HTTP Options for the request |
Returns
Observable<void>
An Observable to handle the status
Since
1.0.0
Author
Simon Kovtyk
isHttpLoading$()
isHttpLoading$(): Observable<HttpRequestStatus | null>;Defined in: src/services/translation.service.ts:45
An Observable, that will emit only when a HTTP-Request is made
Returns
Observable<HttpRequestStatus | null>
An Observable with the HttpRequestStatus if HTTP is currently under use. Otherwise an Observable with null inside.
Since
1.0.0
Author
Simon Kovtyk
preloadByCurrentLocale()
preloadByCurrentLocale(
httpClient,
translationStoreService,
translationHttpService,
scopeName,
httpOptions?): Observable<void>;Defined in: src/services/translation.service.ts:246
Preload translations by locale
Parameters
| Parameter | Type | Description |
|---|---|---|
httpClient | Readonly<HttpClient> | The HttpClient, that'll be used |
translationStoreService | Readonly<TranslationStoreService> | The TranslationStoreService, that'll be used |
translationHttpService | Readonly<TranslationHttpService> | The TranslationHttpService, that'll be used |
scopeName | string | readonly (string | null)[] | null | The scope name for the lookup of the translation |
httpOptions? | HttpOptions<never, HttpHeadersOption, never> | Additional HTTP Options for the request |
Returns
Observable<void>
An Observable to handle the status
Remarks
If the LocaleConfig changes, no new preloading will be made.
Since
1.0.0
Author
Simon Kovtyk
preloadByLocale()
preloadByLocale(
httpClient,
translationStoreService,
translationHttpService,
scopeName,
httpOptions?): Observable<void>;Defined in: src/services/translation.service.ts:213
Preload translations by locale
Parameters
| Parameter | Type | Description |
|---|---|---|
httpClient | Readonly<HttpClient> | The HttpClient, that'll be used |
translationStoreService | Readonly<TranslationStoreService> | The TranslationStoreService, that'll be used |
translationHttpService | Readonly<TranslationHttpService> | The TranslationHttpService, that'll be used |
scopeName | string | readonly (string | null)[] | null | The scope name for the lookup of the translation |
httpOptions? | HttpOptions<never, HttpHeadersOption, never> | Additional HTTP Options for the request |
Returns
Observable<void>
An Observable to handle the status
Remarks
If the LocaleConfig changes, the scope will be preloaded again.
Since
1.0.0
Author
Simon Kovtyk
translateTokenByCurrentLocale$()
translateTokenByCurrentLocale$(
token,
value,
scopeName?,
httpOptions?): Observable<string>;Defined in: src/services/translation.service.ts:177
Translates a token by the current locale
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | The token to resolve the translation |
value | string | The default value of the translation |
scopeName? | string | readonly (string | null)[] | null | A scope name to resolve the lookup |
httpOptions? | HttpOptions<never, HttpHeadersOption, never> | Additional HTTP Options for the request |
Returns
Observable<string>
An Observable with the current translation as string
Remarks
If the LocaleConfig, no new translation will be emitted.
Since
1.0.0
Author
Simon Kovtyk
translateTokenByLocale$()
translateTokenByLocale$(
token,
value,
scopeName?,
httpOptions?): Observable<string>;Defined in: src/services/translation.service.ts:145
Translates a token by the locale reactive
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | The token to resolve the translation |
value | string | The default value of the translation |
scopeName? | string | readonly (string | null)[] | null | A scope name to resolve the lookup |
httpOptions? | HttpOptions<never, HttpHeadersOption, never> | Additional HTTP Options for the request |
Returns
Observable<string>
An Observable with the current translation as string
Remarks
If the LocaleConfig, a new translation based on the new locale will be emitted.
Since
1.0.0
Author
Simon Kovtyk