diff --git a/Duplicati/Server/webroot/ngax/index.html b/Duplicati/Server/webroot/ngax/index.html index be20527f0..d72da4b03 100755 --- a/Duplicati/Server/webroot/ngax/index.html +++ b/Duplicati/Server/webroot/ngax/index.html @@ -89,7 +89,6 @@ - diff --git a/Duplicati/Server/webroot/ngax/scripts/filters/args.js b/Duplicati/Server/webroot/ngax/scripts/filters/args.js index a8eef40e1..a3380076b 100644 --- a/Duplicati/Server/webroot/ngax/scripts/filters/args.js +++ b/Duplicati/Server/webroot/ngax/scripts/filters/args.js @@ -1,34 +1,5 @@ -backupApp.filter('args', function() { +backupApp.filter('args', function(Localization) { return function() { - this.preg_quote = function preg_quote (str, delimiter) { - // discuss at: http://locutus.io/php/preg_quote/ - // original by: booeyOH - // improved by: Ates Goral (http://magnetiq.com) - // improved by: Kevin van Zonneveld (http://kvz.io) - // improved by: Brett Zamir (http://brett-zamir.me) - // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) - // example 1: preg_quote("$40") - // returns 1: '\\$40' - // example 2: preg_quote("*RRRING* Hello?") - // returns 2: '\\*RRRING\\* Hello\\?' - // example 3: preg_quote("\\.+*?[^]$(){}=!<>|:") - // returns 3: '\\\\\\.\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:' - - return (str + '') - .replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&') - } - - if (arguments == null || arguments.length < 1) - return null; - - if (arguments.length == 1) - return arguments[0]; - - var msg = arguments[0]; - - for (var i = 1; i < arguments.length; i++) - msg = msg.replace(new RegExp( "(" + this.preg_quote('{' + (i-1) + '}') + ")" , 'g' ), arguments[i]); - - return msg; + return Localization.format.apply(Localization, arguments); } }); diff --git a/Duplicati/Server/webroot/ngax/scripts/filters/localize.js b/Duplicati/Server/webroot/ngax/scripts/filters/localize.js deleted file mode 100644 index aabd3dc68..000000000 --- a/Duplicati/Server/webroot/ngax/scripts/filters/localize.js +++ /dev/null @@ -1,5 +0,0 @@ -backupApp.filter('localize', function(Localization) { - return function() { - return Localization.localize.apply(Localization, arguments); - } -}); diff --git a/Duplicati/Server/webroot/ngax/scripts/services/Localization.js b/Duplicati/Server/webroot/ngax/scripts/services/Localization.js index ae1bf7e8a..6195f0e1b 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/Localization.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/Localization.js @@ -3,21 +3,22 @@ backupApp.service('Localization', function($rootScope, $timeout, AppService) { var self = this; - this.preg_quote = function( str ) { - // http://kevin.vanzonneveld.net - // + original by: booeyOH - // + improved by: Ates Goral (http://magnetiq.com) - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + bugfixed by: Onno Marsman - // * example 1: preg_quote("$40"); - // * returns 1: '\$40' - // * example 2: preg_quote("*RRRING* Hello?"); - // * returns 2: '\*RRRING\* Hello\?' - // * example 3: preg_quote("\\.+*?[^]$(){}=!<>|:"); - // * returns 3: '\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:' + this.preg_quote = function preg_quote (str, delimiter) { + // discuss at: http://locutus.io/php/preg_quote/ + // original by: booeyOH + // improved by: Ates Goral (http://magnetiq.com) + // improved by: Kevin van Zonneveld (http://kvz.io) + // improved by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman) + // example 1: preg_quote("$40") + // returns 1: '\\$40' + // example 2: preg_quote("*RRRING* Hello?") + // returns 2: '\\*RRRING\\* Hello\\?' + // example 3: preg_quote("\\.+*?[^]$(){}=!<>|:") + // returns 3: '\\\\\\.\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:' - return (str+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1"); - } + return (str + '').replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&') + }; this.format = function() { if (arguments == null || arguments.length < 1) @@ -34,16 +35,6 @@ backupApp.service('Localization', function($rootScope, $timeout, AppService) { return msg; }; - this.localize = function() { - if (arguments == null || arguments.length < 1) - return ''; - - if (this.strings[arguments[0]] != null) - arguments[0] = this.strings[arguments[0]]; - - return this.format.apply(this, arguments); - }; - this.watch = function(scope, m) { scope.$on('localizationchanged', function() { if (m) m(); diff --git a/Duplicati/Server/webroot/ngax/templates/settings.html b/Duplicati/Server/webroot/ngax/templates/settings.html index ca7d3c3ff..89a672f86 100644 --- a/Duplicati/Server/webroot/ngax/templates/settings.html +++ b/Duplicati/Server/webroot/ngax/templates/settings.html @@ -68,7 +68,7 @@