fix translations in error popup

This commit is contained in:
Gabriel Bazán 2016-12-16 12:06:30 -03:00
commit e2024d1df2

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services') angular.module('copayApp.services')
.factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettext, gettextCatalog, bwcError, uxLanguage, platformInfo, txFormatService, $state) { .factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettextCatalog, bwcError, uxLanguage, platformInfo, txFormatService, $state) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
@ -361,14 +361,14 @@ angular.module('copayApp.services')
} catch (ex) { } catch (ex) {
$log.info(ex); $log.info(ex);
return cb(gettext('Could not create: Invalid wallet recovery phrase')); return cb(gettextCatalog.getString('Could not create: Invalid wallet recovery phrase'));
} }
} else if (opts.extendedPrivateKey) { } else if (opts.extendedPrivateKey) {
try { try {
walletClient.seedFromExtendedPrivateKey(opts.extendedPrivateKey); walletClient.seedFromExtendedPrivateKey(opts.extendedPrivateKey);
} catch (ex) { } catch (ex) {
$log.warn(ex); $log.warn(ex);
return cb(gettext('Could not create using the specified extended private key')); return cb(gettextCatalog.getString('Could not create using the specified extended private key'));
} }
} else if (opts.extendedPublicKey) { } else if (opts.extendedPublicKey) {
try { try {
@ -378,7 +378,7 @@ angular.module('copayApp.services')
}); });
} catch (ex) { } catch (ex) {
$log.warn("Creating wallet from Extended Public Key Arg:", ex, opts); $log.warn("Creating wallet from Extended Public Key Arg:", ex, opts);
return cb(gettext('Could not create using the specified extended public key')); return cb(gettextCatalog.getString('Could not create using the specified extended public key'));
} }
} else { } else {
var lang = uxLanguage.getCurrentLanguage(); var lang = uxLanguage.getCurrentLanguage();
@ -421,7 +421,7 @@ angular.module('copayApp.services')
singleAddress: opts.singleAddress, singleAddress: opts.singleAddress,
walletPrivKey: opts.walletPrivKey, walletPrivKey: opts.walletPrivKey,
}, function(err, secret) { }, function(err, secret) {
if (err) return bwcError.cb(err, gettext('Error creating wallet'), cb); if (err) return bwcError.cb(err, gettextCatalog.getString('Error creating wallet'), cb);
return cb(null, walletClient, secret); return cb(null, walletClient, secret);
}); });
}); });
@ -451,11 +451,11 @@ angular.module('copayApp.services')
if (lodash.find(root.profile.credentials, { if (lodash.find(root.profile.credentials, {
'walletId': walletData.walletId 'walletId': walletData.walletId
})) { })) {
return cb(gettext('Cannot join the same wallet more that once')); return cb(gettextCatalog.getString('Cannot join the same wallet more that once'));
} }
} catch (ex) { } catch (ex) {
$log.debug(ex); $log.debug(ex);
return cb(gettext('Bad wallet invitation')); return cb(gettextCatalog.getString('Bad wallet invitation'));
} }
opts.networkName = walletData.network; opts.networkName = walletData.network;
$log.debug('Joining Wallet:', opts); $log.debug('Joining Wallet:', opts);
@ -464,7 +464,7 @@ angular.module('copayApp.services')
if (err) return cb(err); if (err) return cb(err);
walletClient.joinWallet(opts.secret, opts.myName || 'me', {}, function(err) { walletClient.joinWallet(opts.secret, opts.myName || 'me', {}, function(err) {
if (err) return bwcError.cb(err, gettext('Could not join wallet'), cb); if (err) return bwcError.cb(err, gettextCatalog.getString('Could not join wallet'), cb);
addAndBindWalletClient(walletClient, { addAndBindWalletClient(walletClient, {
bwsurl: opts.bwsurl bwsurl: opts.bwsurl
}, cb); }, cb);
@ -521,12 +521,12 @@ angular.module('copayApp.services')
// Adds and bind a new client to the profile // Adds and bind a new client to the profile
var addAndBindWalletClient = function(client, opts, cb) { var addAndBindWalletClient = function(client, opts, cb) {
if (!client || !client.credentials) if (!client || !client.credentials)
return cb(gettext('Could not access wallet')); return cb(gettextCatalog.getString('Could not access wallet'));
var walletId = client.credentials.walletId var walletId = client.credentials.walletId
if (!root.profile.addWallet(JSON.parse(client.export()))) if (!root.profile.addWallet(JSON.parse(client.export())))
return cb(gettext('Wallet already in Copay')); return cb(gettextCatalog.getString('Wallet already in Copay'));
var skipKeyValidation = root.profile.isChecked(platformInfo.ua, walletId); var skipKeyValidation = root.profile.isChecked(platformInfo.ua, walletId);
@ -595,7 +595,7 @@ angular.module('copayApp.services')
password: opts.password password: opts.password
}); });
} catch (err) { } catch (err) {
return cb(gettext('Could not import. Check input file and spending password')); return cb(gettextCatalog.getString('Could not import. Check input file and spending password'));
} }
str = JSON.parse(str); str = JSON.parse(str);
@ -626,7 +626,7 @@ angular.module('copayApp.services')
if (err instanceof errors.NOT_AUTHORIZED) if (err instanceof errors.NOT_AUTHORIZED)
return cb(err); return cb(err);
return bwcError.cb(err, gettext('Could not import'), cb); return bwcError.cb(err, gettextCatalog.getString('Could not import'), cb);
} }
addAndBindWalletClient(walletClient, { addAndBindWalletClient(walletClient, {
@ -657,7 +657,7 @@ angular.module('copayApp.services')
if (err instanceof errors.NOT_AUTHORIZED) if (err instanceof errors.NOT_AUTHORIZED)
return cb(err); return cb(err);
return bwcError.cb(err, gettext('Could not import'), cb); return bwcError.cb(err, gettextCatalog.getString('Could not import'), cb);
} }
addAndBindWalletClient(walletClient, { addAndBindWalletClient(walletClient, {
@ -680,7 +680,7 @@ angular.module('copayApp.services')
if (err instanceof errors.NOT_AUTHORIZED) if (err instanceof errors.NOT_AUTHORIZED)
err.name = 'WALLET_DOES_NOT_EXIST'; err.name = 'WALLET_DOES_NOT_EXIST';
return bwcError.cb(err, gettext('Could not import'), cb); return bwcError.cb(err, gettextCatalog.getString('Could not import'), cb);
} }
addAndBindWalletClient(walletClient, { addAndBindWalletClient(walletClient, {