Wallet/src/js/controllers/preferencesLanguage.js

43 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, $ionicHistory, configService, profileService, uxLanguage, walletService, externalLinkService, gettextCatalog, $ionicNavBarDelegate) {
$scope.availableLanguages = uxLanguage.getLanguages();
$scope.openExternalLink = function() {
var url = 'https://crowdin.com/project/bitcoincom-wallet';
var optIn = true;
var title = gettextCatalog.getString('Open Translation Community');
var message = gettextCatalog.getString('You can make contributions by signing up on our Crowdin community translation website. Were looking forward to hearing from you!');
var okText = gettextCatalog.getString('Open Crowdin');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText);
};
$scope.save = function(newLang) {
var opts = {
wallet: {
settings: {
defaultLanguage: newLang
}
}
};
uxLanguage._set(newLang);
configService.set(opts, function(err) {
if (err) $log.warn(err);
walletService.updateRemotePreferences(profileService.getWallets());
});
$ionicHistory.goBack();
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
});
$scope.$on("$ionicView.enter", function(event, data) {
$ionicNavBarDelegate.showBar(true);
});
});