Autodetect device language. Removed select language from settings
This commit is contained in:
parent
e700634815
commit
e2137701f8
6 changed files with 15 additions and 29 deletions
15
js/routes.js
15
js/routes.js
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue