add locale service to GUI. minor cleanup of controller.

This commit is contained in:
Dennis Wilson
2014-11-28 19:39:33 +01:00
parent 1219423091
commit ee9c109f07
5 changed files with 166 additions and 78 deletions

View File

@@ -25,7 +25,7 @@ var syncthing = angular.module('syncthing', [
var urlbase = 'rest';
var guiVersion = null;
syncthing.config(function ($httpProvider, $translateProvider) {
syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvider) {
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token';
$httpProvider.interceptors.push(function () {
@@ -42,11 +42,16 @@ syncthing.config(function ($httpProvider, $translateProvider) {
};
});
// language and localisation
$translateProvider.useStaticFilesLoader({
prefix: 'assets/lang/lang-',
suffix: '.json'
});
LocaleServiceProvider.setAvailableLocales(validLangs);
LocaleServiceProvider.setDefaultLocale('en');
});
// @TODO: extract global level functions into seperate service(s)