translation system implemented

This commit is contained in:
idoctnef
2016-09-25 14:48:10 +02:00
parent fb545e0c67
commit e9f1ff6e39
68 changed files with 49488 additions and 120 deletions

View File

@@ -4,7 +4,9 @@
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers'])
angular.module('starter', ['ionic',
'starter.controllers',
'pascalprecht.translate'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
@@ -36,7 +38,8 @@ angular.module('starter', ['ionic', 'starter.controllers'])
url: '/settings',
views: {
'menuContent': {
templateUrl: 'templates/settings.html'
templateUrl: 'templates/settings.html',
controller: 'SettingsCtrl'
}
}
})
@@ -80,4 +83,24 @@ angular.module('starter', ['ionic', 'starter.controllers'])
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/travels');
});
})
/* translator */
.config(['$translateProvider',function($translateProvider) {
/* get lang from the file translations.js */
for(lang in translations){
$translateProvider.translations(lang, translations[lang]);
}
if(window.localStorage.getItem('lang')) {
$translateProvider.preferredLanguage(window.localStorage.getItem('lang'));
}else{
$translateProvider.preferredLanguage('english');
};
$translateProvider.useSanitizeValueStrategy('escape');
}]);