3.3.0 alpha update (#1118)

* alpha

* locale
This commit is contained in:
Cilibiu Bogdan
2019-05-31 13:30:11 +03:00
committed by Suzana Dirla
parent 14adbad1a9
commit 9fef05b69f
6 changed files with 25 additions and 105 deletions

View File

@@ -7,7 +7,6 @@
[hideSidenav]="hideSidenav"
[expandedSidenav]="expandedSidenav"
(expanded)="onExpanded($event)"
[direction]="direction"
>
<adf-sidenav-layout-header>
<ng-template>

View File

@@ -195,43 +195,4 @@ describe('AppLayoutComponent', () => {
expect(component.layout.container.toggleMenu).toHaveBeenCalled();
});
it('should set direction `ltr` if no direction declared', () => {
appConfig.config.languages = [
{
key: 'en'
}
];
spyOn(userPreference, 'get').and.callFake(key => {
if (key === 'locale') {
return 'en';
}
});
const spy = spyOn(userPreference, 'set');
fixture.detectChanges();
expect(spy.calls.mostRecent().args).toEqual(['textOrientation', 'ltr']);
});
it('should set direction `rtl` based on locale language direction', () => {
appConfig.config.languages = [
{
key: 'en',
direction: 'rtl'
}
];
spyOn(userPreference, 'get').and.callFake(key => {
if (key === 'locale') {
return 'en';
}
});
const spy = spyOn(userPreference, 'set');
fixture.detectChanges();
expect(spy.calls.mostRecent().args).toEqual(['textOrientation', 'rtl']);
});
});

View File

@@ -26,9 +26,7 @@
import {
AppConfigService,
SidenavLayoutComponent,
UserPreferencesService,
LanguageItem,
AppConfigValues
UserPreferencesService
} from '@alfresco/adf-core';
import {
Component,
@@ -151,18 +149,6 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
takeUntil(this.onDestroy$)
)
.subscribe(() => this.store.dispatch(new SetSelectedNodesAction([])));
this.userPreferenceService
.select('textOrientation')
.subscribe((textOrientation: Directionality) => {
this.direction = textOrientation;
});
this.userPreferenceService.set(
'textOrientation',
this.getCurrentLanguage(this.userPreferenceService.get('locale'))
.direction || 'ltr'
);
}
ngOnDestroy() {
@@ -221,12 +207,4 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
return expand;
}
private getCurrentLanguage(key: string): LanguageItem {
return (
this.appConfigService
.get<Array<LanguageItem>>(AppConfigValues.APP_CONFIG_LANGUAGES_KEY)
.find(language => language.key === key) || <LanguageItem>{}
);
}
}