Skip to content

Commit

Permalink
Feat: add support to preloading (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Jan 7, 2022
1 parent 544faf4 commit 792eba2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions projects/angular-l10n/src/lib/models/l10n-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { L10nTranslationHandler } from '../services/l10n-translation-handler';
import { L10nMissingTranslationHandler } from '../services/l10n-missing-translation-handler';
import { L10nValidation } from '../services/l10n-validation';
import { L10nLocation } from '../services/l10n-location';
import { L10nLoader } from '../services/l10n-loader';

export interface L10nConfig {
/**
Expand Down Expand Up @@ -84,6 +85,10 @@ export interface L10nTranslationToken {
* Defines the missing translation handler to be used.
*/
missingTranslationHandler?: Type<L10nMissingTranslationHandler>;
/**
* Defines the loader to be used.
*/
loader?: Type<L10nLoader>;
}

export interface L10nValidationToken {
Expand All @@ -98,4 +103,8 @@ export interface L10nRoutingToken {
* Defines the location service to be used.
*/
location?: Type<L10nLocation>;
/**
* Defines the loader to be used.
*/
loader?: Type<L10nLoader>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class L10nRoutingModule {
providers: [
L10nRoutingService,
{ provide: L10nLocation, useClass: token.location || L10nDefaultLocation },
{ provide: L10nLoader, useClass: L10nRoutingLoader }
{ provide: L10nLoader, useClass: token.loader || L10nRoutingLoader },
]
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class L10nTranslationModule {
provide: L10nMissingTranslationHandler,
useClass: token.missingTranslationHandler || L10nDefaultMissingTranslationHandler
},
{ provide: L10nLoader, useClass: L10nDefaultLoader },
{ provide: L10nLoader, useClass: token.loader || L10nDefaultLoader },
{
provide: APP_INITIALIZER,
useFactory: initL10n,
Expand Down

0 comments on commit 792eba2

Please sign in to comment.