From 5430d51b092a4a1cdf7f32233e38e5350995956c Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Wed, 25 May 2016 15:17:48 -0400 Subject: #261 - more intl Former-commit-id: 0976517fc45eff4876eba6fd945cccea15b69f42 --- www/js/DataModel.js | 4 ++-- www/js/DevOptionsCtrl.js | 6 +++--- www/js/EventCtrl.js | 2 +- www/js/LogCtrl.js | 8 ++++---- www/js/LoginCtrl.js | 2 +- www/js/TimelineCtrl.js | 4 ++++ www/js/app.js | 26 ++++++++++++++------------ 7 files changed, 29 insertions(+), 23 deletions(-) (limited to 'www/js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index b02f0bfb..be96cb5f 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -49,7 +49,7 @@ angular.module('zmApp.controllers') 'disablePush':false, // true if only websocket mode is desired 'eventServerMonitors':'', // list of monitors to notify from ES 'eventServerInterval':'', // list of intervals for all monitors - 'refreshSec':'2', // timer value for frame change in sec + 'refreshSec':'2', // timer value for frame change in sec 'enableLogs':true, 'enableDebug':false, // if enabled with log messages with "debug" 'usePin':false, @@ -733,7 +733,7 @@ angular.module('zmApp.controllers') { // recaptcha enable. zmNinja won't work zmLog ("ZM has recaptcha enabled", "error"); - displayBanner ('error', ['Recaptcha must be disabled in Zoneminder', 'zmNinja will not work with recaptcha'],"",8000); + displayBanner ('error', ['Recaptcha must be disabled in Zoneminder', $rootScope.appName+' will not work with recaptcha'],"",8000); d.resolve(true); return (d.promise); diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js index a85322cd..ecaf9b69 100644 --- a/www/js/DevOptionsCtrl.js +++ b/www/js/DevOptionsCtrl.js @@ -2,7 +2,7 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console */ -angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', '$ionicHistory','$state', 'SecuredPopups', function ($scope, $rootScope, $ionicModal, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, $ionicHistory, $state, SecuredPopups) { +angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', '$ionicHistory','$state', 'SecuredPopups', 'translate', function ($scope, $rootScope, $ionicModal, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, $ionicHistory, $state, SecuredPopups, $translate) { $scope.openMenu = function () { @@ -103,8 +103,8 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope' saveDevOptions(); // $rootScope.zmPopup.close(); $rootScope.zmPopup= SecuredPopups.show('alert',{ - title: 'Settings Saved', - template: 'Please explore the menu and enjoy zmNinja!' + title: $translate.instant('kSettingsSaved'), + template: "{{'kExploreEnjoy' | translate }} {{$root.appName}}" }).then(function (res) { $ionicSideMenuDelegate.toggleLeft(); }); diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 68e27b08..94a471ab 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -1050,7 +1050,7 @@ angular.module('zmApp.controllers') $cordovaBadge.set(0).then(function () { // You have permission, badge set. }, function (err) { - ZMDataModel.zmDebug("zmNinja does not have badge permissions. Please check your phone notification settings"); + ZMDataModel.zmDebug("app does not have badge permissions. Please check your phone notification settings"); // You do not have permission. }); diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index 2fde7129..84ab820c 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -75,7 +75,7 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo $scope.sendEmail = function (logstring) { $ionicPopup.confirm({ title: 'Sensitive Information', - template: 'zmNinja will modify the logs when creating the final output to remove sensitive data like urls and passwords. However it is eventually your responsibility to make sure there is no sensitive data in the logs. Please make sure you review and edit the logs before you send it out.' + template: $rootScope.appName+' will modify the logs when creating the final output to remove sensitive data like urls and passwords. However it is eventually your responsibility to make sure there is no sensitive data in the logs. Please make sure you review and edit the logs before you send it out.' }) .then(function (res) { if (res) sendEmailReally(logstring); @@ -124,7 +124,7 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo var email = { to: zm.authoremail, - subject: 'zmNinja Logs', + subject: $rootScope.appName + ' Logs', body: logstring, isHtml: false }; @@ -137,8 +137,8 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo }); } else { console.log("Using default email client to send data"); - //window.open('mailto:'+encodeURIComponent(zm.authoremail)+'?subject=zmNinja%20Logs&body='+encodeURIComponent(logstring)); - var fname = "zmNinja-logs-" + + + var fname = $rootScope.appName+"-logs-" + moment().format('MMM-DD-YY_HH-mm-ss') + ".txt"; var dlogstring = "version:"+$scope.zmAppVersion + "\n" + logstring; diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 72fca590..d551743e 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -659,7 +659,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $http.get(apiurl) .success(function (data) { - var loginStatus = "Please explore the menu and enjoy zmNinja!"; + var loginStatus = "Please explore the menu and enjoy "+$rootScope.appName+"!"; EventServer.refresh(); diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index c3015202..337b611b 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -289,6 +289,10 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla maxItems = ld.graphSize || maxItemsConf; ZMDataModel.zmLog("Graph items to draw is " + maxItems); $scope.maxItems = maxItems; + $scope.translationData = { + maxItemsVal: maxItems + }; + $scope.graphLoaded = false; ZMDataModel.zmDebug("TimelineCtrl/drawGraph: graphLoaded is " + $scope.graphLoaded); }); diff --git a/www/js/app.js b/www/js/app.js index 8d720505..e13bc233 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -864,7 +864,7 @@ angular.module('zmApp', [ ], "", 8000); var alertPopup = $ionicPopup.alert({ title: 'reCaptcha enabled', - template: 'Looks like you have enabled reCaptcha. It needs to be turned off for zmNinja to work' + template: 'Looks like you have enabled reCaptcha. It needs to be turned off for '+$rootScope.appName+' to work' }); @@ -1028,6 +1028,7 @@ angular.module('zmApp', [ + $rootScope.appName = "zmNinja"; $rootScope.zmGlobalCookie = ""; $rootScope.isEventFilterOn = false; $rootScope.fromDate = ""; @@ -1055,6 +1056,7 @@ angular.module('zmApp', [ // only for android $rootScope.exitApp = function () { + ZMDataModel.zmLog("user exited app"); ZMDataModel.zmLog("user exited app"); ionic.Platform.exitApp(); }; @@ -1183,9 +1185,9 @@ angular.module('zmApp', [ $ionicNativeTransitions.enable(true, false); + - - + if(typeof navigator.globalization !== "undefined") { navigator.globalization.getPreferredLanguage(function(language) { $translate.use((language.value).split("-")[0]).then(function(data) { @@ -1271,7 +1273,7 @@ angular.module('zmApp', [ cordova.getAppVersion(function (version) { appVersion = version; - ZMDataModel.zmLog("zmNinja Version: " + appVersion); + ZMDataModel.zmLog("App Version: " + appVersion); ZMDataModel.setAppVersion(appVersion); }); @@ -1458,20 +1460,20 @@ angular.module('zmApp', [ $translateProvider.registerAvailableLanguageKeys(['en', 'de','es', 'fr', 'it', 'ja', 'ko', 'zh', 'zh_CN', 'zh_TW'], { - 'en*': 'en', - 'de*': 'de', - 'es*': 'es', - 'fr*': 'fr', - 'it*': 'it', - 'ja*': 'ja', - 'ko*': 'ko', + 'en_*': 'en', + 'de_*': 'de', + 'es_*': 'es', + 'fr_*': 'fr', + 'it_*': 'it', + 'ja_*': 'ja', + 'ko_*': 'ko', '*': 'en' // must be last }); $translateProvider.determinePreferredLanguage(); - $translateProvider.preferredLanguage("en"); + //$translateProvider.preferredLanguage("en"); $translateProvider.fallbackLanguage("en"); $translateProvider.useSanitizeValueStrategy('sanitize'); -- cgit v1.2.3