Autodetect device language. Removed select language from settings

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-23 15:40:14 -03:00
commit e2137701f8
6 changed files with 15 additions and 29 deletions

View file

@ -139,9 +139,20 @@ angular
$idleProvider.warningDuration(40); // in seconds
$keepaliveProvider.interval(30); // in seconds
})
.run(function($rootScope, $location, $idle, gettextCatalog, uriHandler, isCordova) {
.run(function($rootScope, $location, $idle, gettextCatalog, uriHandler, isCordova, amMoment) {
gettextCatalog.currentLanguage = config.defaultLanguage;
var userLang, androidLang;
if (navigator && navigator.userAgent && (androidLang = navigator.userAgent.match(/android.*\W(\w\w)-(\w\w)\W/i))) {
userLang = androidLang[1];
} else {
// works for iOS and Android 4.x
userLang = navigator.userLanguage || navigator.language;
}
userLang = userLang.split('-', 1)[0];
gettextCatalog.setCurrentLanguage(userLang);
amMoment.changeLanguage(userLang);
// Register URI handler, not for mobileApp
if (!isCordova) {