|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { getLocaleDirection, LocalizationService } from '@abp/ng.core';
|
|
|
|
|
import { Injectable, Injector } from '@angular/core';
|
|
|
|
|
import { BehaviorSubject } from 'rxjs';
|
|
|
|
|
import { map, startWith } from 'rxjs/operators';
|
|
|
|
|
import { map } from 'rxjs/operators';
|
|
|
|
|
import { LocaleDirection } from '../models/common';
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
@ -14,17 +14,11 @@ export class DocumentDirHandlerService {
|
|
|
|
|
|
|
|
|
|
private listenToLanguageChanges() {
|
|
|
|
|
const l10n = this.injector.get(LocalizationService);
|
|
|
|
|
|
|
|
|
|
// will always listen, no need to unsubscribe
|
|
|
|
|
l10n.languageChange$
|
|
|
|
|
.pipe(
|
|
|
|
|
startWith(l10n.currentLang),
|
|
|
|
|
map(locale => getLocaleDirection(locale)),
|
|
|
|
|
)
|
|
|
|
|
.subscribe(dir => {
|
|
|
|
|
this.dir.next(dir);
|
|
|
|
|
this.setBodyDir(dir);
|
|
|
|
|
});
|
|
|
|
|
l10n.currentLang$.pipe(map(locale => getLocaleDirection(locale))).subscribe(dir => {
|
|
|
|
|
this.dir.next(dir);
|
|
|
|
|
this.setBodyDir(dir);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private setBodyDir(dir: LocaleDirection) {
|
|
|
|
|