mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
not store locale if not present in app.config.json or changed by the language picker (#4431)
This commit is contained in:
@@ -52,11 +52,19 @@ export class UserPreferencesService {
|
||||
}
|
||||
|
||||
private initUserPreferenceStatus() {
|
||||
this.set(UserPreferenceValues.Locale, (this.locale || this.getDefaultLocale()));
|
||||
this.initUserLanguage();
|
||||
this.set(UserPreferenceValues.PaginationSize, this.paginationSize);
|
||||
this.set(UserPreferenceValues.SupportedPageSizes, JSON.stringify(this.supportedPageSizes));
|
||||
}
|
||||
|
||||
private initUserLanguage() {
|
||||
if (this.locale || this.appConfig.get<string>(UserPreferenceValues.Locale)) {
|
||||
this.set(UserPreferenceValues.Locale, (this.locale || this.getDefaultLocale()));
|
||||
} else {
|
||||
this.setWithoutStore(UserPreferenceValues.Locale, (this.locale || this.getDefaultLocale()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up a callback to notify when a property has changed.
|
||||
* @param property The property to watch
|
||||
@@ -102,6 +110,19 @@ export class UserPreferencesService {
|
||||
this.onChangeSubject.next(this.userPreferenceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a preference property.
|
||||
* @param property Name of the property
|
||||
* @param value New value for the property
|
||||
*/
|
||||
setWithoutStore(property: string, value: any) {
|
||||
if (!property) {
|
||||
return;
|
||||
}
|
||||
this.userPreferenceStatus[property] = value;
|
||||
this.onChangeSubject.next(this.userPreferenceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an item is present in the storage
|
||||
* @param property Name of the property
|
||||
|
Reference in New Issue
Block a user