Fixed angular translations

This commit is contained in:
dabura667 2015-07-29 20:12:37 +09:00
commit 4ec25a1afe
2 changed files with 26 additions and 17 deletions

View file

@ -4,6 +4,10 @@ angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, isCordova, gettext, gettextCatalog) { function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, isCordova, gettext, gettextCatalog) {
var self = this; var self = this;
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
var ok_msg = gettextCatalog.getString('OK');
var cancel_msg = gettextCatalog.getString('Cancel');
var confirm_msg = gettextCatalog.getString('Confirm');
self.init = function() { self.init = function() {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
@ -18,16 +22,16 @@ angular.module('copayApp.controllers').controller('copayersController',
var _modalDeleteWallet = function() { var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) { var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = gettext('Are you sure you want to delete this wallet?'); $scope.title = delete_msg;
$scope.loading = false; $scope.loading = false;
$scope.ok = function() { $scope.ok = function() {
$scope.loading = true; $scope.loading = true;
$modalInstance.close('ok'); $modalInstance.close(ok_msg);
}; };
$scope.cancel = function() { $scope.cancel = function() {
$modalInstance.dismiss('cancel'); $modalInstance.dismiss(cancel_msg);
}; };
}; };
@ -59,7 +63,7 @@ angular.module('copayApp.controllers').controller('copayersController',
} else { } else {
go.walletHome(); go.walletHome();
$timeout(function() { $timeout(function() {
notification.success(gettext('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName})); notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName}));
}); });
} }
}); });
@ -70,13 +74,13 @@ angular.module('copayApp.controllers').controller('copayersController',
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
if (isCordova) { if (isCordova) {
navigator.notification.confirm( navigator.notification.confirm(
'Are you sure you want to delete this wallet?', delete_msg,
function(buttonIndex) { function(buttonIndex) {
if (buttonIndex == 2) { if (buttonIndex == 2) {
_deleteWallet(); _deleteWallet();
} }
}, },
'Confirm', ['Cancel', 'OK'] confirm_msg, [cancel_msg, ok_msg]
); );
} else { } else {
_modalDeleteWallet(); _modalDeleteWallet();
@ -86,7 +90,7 @@ angular.module('copayApp.controllers').controller('copayersController',
self.copySecret = function(secret) { self.copySecret = function(secret) {
if (isCordova) { if (isCordova) {
window.cordova.plugins.clipboard.copy(secret); window.cordova.plugins.clipboard.copy(secret);
window.plugins.toast.showShortCenter('Copied to clipboard'); window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
} }
}; };
@ -95,9 +99,9 @@ angular.module('copayApp.controllers').controller('copayersController',
if (isMobile.Android() || isMobile.Windows()) { if (isMobile.Android() || isMobile.Windows()) {
window.ignoreMobilePause = true; window.ignoreMobilePause = true;
} }
var message = 'Join my Copay wallet. Here is the invitation code: ' + secret + ' You can download Copay for your phone or desktop at https://copay.io'; var message = gettextCatalog.getString('Join my Copay wallet. Here is the invitation code: {{secret}} You can download Copay for your phone or desktop at https://copay.io', {secret: secret});
window.plugins.socialsharing.share(message, 'Invitation to share a Copay Wallet', null, null); window.plugins.socialsharing.share(message, gettextCatalog.getString('Invitation to share a Copay Wallet'), null, null);
} }
}; };
}); });

View file

@ -5,18 +5,23 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
this.isCordova = isCordova; this.isCordova = isCordova;
this.error = null; this.error = null;
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
var ok_msg = gettextCatalog.getString('OK');
var cancel_msg = gettextCatalog.getString('Cancel');
var confirm_msg = gettextCatalog.getString('Confirm');
var _modalDeleteWallet = function() { var _modalDeleteWallet = function() {
var ModalInstanceCtrl = function($scope, $modalInstance, gettext) { var ModalInstanceCtrl = function($scope, $modalInstance, gettext) {
$scope.title = gettext('Are you sure you want to delete this wallet?'); $scope.title = delete_msg;
$scope.loading = false; $scope.loading = false;
$scope.ok = function() { $scope.ok = function() {
$scope.loading = true; $scope.loading = true;
$modalInstance.close('ok'); $modalInstance.close(ok_msg);
}; };
$scope.cancel = function() { $scope.cancel = function() {
$modalInstance.dismiss('cancel'); $modalInstance.dismiss(cancel_msg);
}; };
}; };
@ -42,7 +47,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
if (err) { if (err) {
self.error = err.message || err; self.error = err.message || err;
} else { } else {
notification.success(gettext('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName})); notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName}));
} }
}); });
}; };
@ -50,16 +55,16 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
this.deleteWallet = function() { this.deleteWallet = function() {
if (isCordova) { if (isCordova) {
navigator.notification.confirm( navigator.notification.confirm(
'Are you sure you want to delete this wallet?', delete_msg,
function(buttonIndex) { function(buttonIndex) {
if (buttonIndex == 2) { if (buttonIndex == 2) {
_deleteWallet(); _deleteWallet();
} }
}, },
'Confirm', ['Cancel', 'OK'] confirm_msg, [cancel_msg, ok_msg]
); );
} else { } else {
_modalDeleteWallet(); _modalDeleteWallet();
} }
}; };
}); });