UNPKG

@o3r/localization

Version:

This module provides a runtime dynamic language/translation support and debug tools.

58 lines (52 loc) 2.99 kB
import * as i0 from '@angular/core'; import { inject, Injectable, NgModule } from '@angular/core'; import { Store } from '@ngrx/store'; import { setLocalizationOverride, LocalizationOverrideStoreModule } from '@o3r/localization'; /** ActionUpdateLocalisationBlock */ const RULES_ENGINE_LOCALISATION_UPDATE_ACTION_TYPE = 'UPDATE_LOCALISATION'; /** * Service to handle async Localization actions */ class LocalizationRulesEngineActionHandler { constructor() { this.store = inject(Store); /** @inheritdoc */ this.supportingActions = [RULES_ENGINE_LOCALISATION_UPDATE_ACTION_TYPE]; } /** @inheritdoc */ executeActions(actions) { const localizationOverrides = actions.reduce((acc, { key, value }) => { acc[key] = value; return acc; }, {}); this.store.dispatch(setLocalizationOverride({ state: { localizationOverrides } })); } /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionHandler }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionHandler, decorators: [{ type: Injectable }] }); class LocalizationRulesEngineActionModule { /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionModule, imports: [LocalizationOverrideStoreModule] }); } /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionModule, providers: [ LocalizationRulesEngineActionHandler ], imports: [LocalizationOverrideStoreModule] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: LocalizationRulesEngineActionModule, decorators: [{ type: NgModule, args: [{ imports: [ LocalizationOverrideStoreModule ], providers: [ LocalizationRulesEngineActionHandler ] }] }] }); /** * Generated bundle index. Do not edit. */ export { LocalizationRulesEngineActionHandler, LocalizationRulesEngineActionModule, RULES_ENGINE_LOCALISATION_UPDATE_ACTION_TYPE }; //# sourceMappingURL=o3r-localization-rules-engine.mjs.map