Merge pull request #1300 from cmgustavo/feature/multilanguage-support

Feature/multilanguage support
This commit is contained in:
Matias Alejo Garcia 2014-09-08 15:48:34 -03:00
commit a0eded69af
36 changed files with 1011 additions and 222 deletions

View file

@ -24,6 +24,7 @@ var copayApp = window.copayApp = angular.module('copayApp', [
'mm.foundation',
'monospaced.qrcode',
'ngIdle',
'gettext',
'copayApp.filters',
'copayApp.services',
'copayApp.controllers',

View file

@ -9,6 +9,22 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.insightPort = config.blockchain.port;
$scope.insightSecure = config.blockchain.schema === 'https';
$scope.forceNetwork = config.forceNetwork;
$scope.defaultLanguage = config.defaultLanguage || 'en';
$scope.availableLanguages = [{
name: 'English',
isoCode: 'en',
}, {
name: 'Spanish',
isoCode: 'es',
}];
for (var ii in $scope.availableLanguages) {
if ($scope.defaultLanguage === $scope.availableLanguages[ii].isoCode) {
$scope.selectedLanguage = $scope.availableLanguages[ii];
break;
}
}
$scope.unitOpts = [{
name: 'Satoshis (100,000,000 satoshis = 1BTC)',
@ -90,7 +106,8 @@ angular.module('copayApp.controllers').controller('SettingsController', function
alternativeName: $scope.selectedAlternative.name,
alternativeIsoCode: $scope.selectedAlternative.isoCode,
version: copay.version
version: copay.version,
defaultLanguage: $scope.selectedLanguage.isoCode
}));
// Go home reloading the application

View file

@ -6,6 +6,7 @@ angular.module('copayApp.controllers').controller('VersionController',
$scope.version = copay.version;
$scope.commitHash = copay.commitHash;
$scope.networkName = config.networkName;
$scope.defaultLanguage = config.defaultLanguage;
$http.get('https://api.github.com/repos/bitpay/copay/tags').success(function(data) {
var toInt = function(s) {

View file

@ -79,7 +79,8 @@ angular
$idleProvider.warningDuration(20); // in seconds
$keepaliveProvider.interval(2); // in seconds
})
.run(function($rootScope, $location, $idle) {
.run(function($rootScope, $location, $idle, gettextCatalog) {
gettextCatalog.currentLanguage = config.defaultLanguage;
$idle.watch();
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!localStorage || localStorage.length < 1) {