diff --git a/docs/docs/unit-testing.mdx b/docs/docs/unit-testing.mdx index 3b16b1335..25f2fc3f0 100644 --- a/docs/docs/unit-testing.mdx +++ b/docs/docs/unit-testing.mdx @@ -45,18 +45,16 @@ describe('AppComponent', () => { }); ``` -You can find an example [here](https://github.com/ngneat/transloco/blob/master/apps/transloco-playground/src/app/on-push/on-push.component.spec.ts). - If you need to test `scopes`, you should add them as `languages`, for example: ```ts {6,7} title="transloco-testing.module.ts" export function getTranslocoModule(options: TranslocoTestingOptions = {}) { return TranslocoTestingModule.forRoot({ - langs: { - en, + langs: { + en, es, 'admin-page/en': admin, - 'admin-page/es': adminSpanish, + 'admin-page/es': adminSpanish, }, translocoConfig: { availableLangs: ['en', 'es'], @@ -68,8 +66,6 @@ export function getTranslocoModule(options: TranslocoTestingOptions = {}) { } ``` -You can find an example [here](https://github.com/ngneat/transloco/blob/master/apps/transloco-playground/src/app/lazy/lazy.component.spec.ts). - Note that in order to import JSON files, you need to configure the TypeScript compiler by adding the following properties in `tsconfig.json`: ```json diff --git a/libs/transloco-locale/src/lib/transloco-locale.service.ts b/libs/transloco-locale/src/lib/transloco-locale.service.ts index c934d2238..5ba288cca 100644 --- a/libs/transloco-locale/src/lib/transloco-locale.service.ts +++ b/libs/transloco-locale/src/lib/transloco-locale.service.ts @@ -1,33 +1,27 @@ -import { Injectable, Inject, OnDestroy, inject } from '@angular/core'; +import { inject, Injectable, OnDestroy } from '@angular/core'; import { TranslocoService } from '@ngneat/transloco'; -import { Observable, BehaviorSubject, Subscription } from 'rxjs'; -import { map, distinctUntilChanged, filter } from 'rxjs/operators'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { distinctUntilChanged, filter, map } from 'rxjs/operators'; import { isLocaleFormat, toDate } from './helpers'; import { getDefaultOptions } from './shared'; import { - TRANSLOCO_LOCALE_LANG_MAPPING, - TRANSLOCO_LOCALE_DEFAULT_LOCALE, TRANSLOCO_LOCALE_CONFIG, TRANSLOCO_LOCALE_CURRENCY_MAPPING, TRANSLOCO_LOCALE_DEFAULT_CURRENCY, + TRANSLOCO_LOCALE_DEFAULT_LOCALE, + TRANSLOCO_LOCALE_LANG_MAPPING, } from './transloco-locale.config'; import { TRANSLOCO_DATE_TRANSFORMER, TRANSLOCO_NUMBER_TRANSFORMER, - TranslocoDateTransformer, - TranslocoNumberTransformer, } from './transloco-locale.transformers'; import { - Locale, DateFormatOptions, + Locale, + LocaleConfig, NumberStyles, - Currency, ValidDate, - LocaleConfig, - LocaleToCurrencyMapping, - LangToLocaleMapping, - NumberFormatOptions, } from './transloco-locale.types'; @Injectable({