feat: initialize language and date-format settings (#1214)

See: #1213
This commit is contained in:
Karan Takalkar
2020-08-16 20:08:28 +05:30
committed by GitHub
parent 1071f3828b
commit 199a8b6c9c
6 changed files with 137 additions and 14 deletions
+17 -4
View File
@@ -19,11 +19,12 @@ import { Logger } from './core/logger/logger.service';
import { I18nService } from './core/i18n/i18n.service';
import { ThemeStorageService } from './shared/theme-picker/theme-storage.service';
import { AlertService } from './core/alert/alert.service';
import { KeyboardShortcutsConfiguration } from './keyboards-shortcut-config';
/** Custom Models */
import { Alert } from './core/alert/alert.model';
import { AuthenticationService } from './core/authentication/authentication.service';
import { SettingsService } from './settings/settings.service';
/** Custom Items */
import { Alert } from './core/alert/alert.model';
import { KeyboardShortcutsConfiguration } from './keyboards-shortcut-config';
/** Initialize Logger */
const log = new Logger('MifosX');
@@ -59,6 +60,7 @@ export class WebAppComponent implements OnInit {
private themeStorageService: ThemeStorageService,
public snackBar: MatSnackBar,
private alertService: AlertService,
private settingsService: SettingsService,
private authenticationService: AuthenticationService) { }
/**
@@ -133,6 +135,17 @@ export class WebAppComponent implements OnInit {
});
});
this.buttonConfig = new KeyboardShortcutsConfiguration();
// initialize language and date format if they are null.
if (!localStorage.getItem('mifosXLanguage')) {
this.settingsService.setLanguage({
name: 'English',
code: 'en'
});
}
if (!localStorage.getItem('mifosXDateFormat')) {
this.settingsService.setDateFormat('dd MMMM yyyy');
}
}
logout() {