mirror of https://github.com/BTCPrivate/copay.git
Multi-language support. English by default
This commit is contained in:
parent
08024c1c77
commit
302e75228d
|
@ -45,6 +45,11 @@ js/copayMain.js
|
||||||
css/copay.min.css
|
css/copay.min.css
|
||||||
css/vendors.min.css
|
css/vendors.min.css
|
||||||
|
|
||||||
|
# translation
|
||||||
|
po/*
|
||||||
|
!po/*.po
|
||||||
|
js/translations.js
|
||||||
|
|
||||||
webapp
|
webapp
|
||||||
browser-extensions/chrome/copay-chrome-extension
|
browser-extensions/chrome/copay-chrome-extension
|
||||||
browser-extensions/chrome/copay-chrome-extension.zip
|
browser-extensions/chrome/copay-chrome-extension.zip
|
||||||
|
|
27
Gruntfile.js
27
Gruntfile.js
|
@ -8,6 +8,7 @@ module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-angular-gettext');
|
||||||
|
|
||||||
// Project Configuration
|
// Project Configuration
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
|
@ -105,7 +106,8 @@ module.exports = function(grunt) {
|
||||||
'lib/angular-qrcode/qrcode.js',
|
'lib/angular-qrcode/qrcode.js',
|
||||||
'lib/ng-idle/angular-idle.min.js',
|
'lib/ng-idle/angular-idle.min.js',
|
||||||
'lib/angular-foundation/mm-foundation.min.js',
|
'lib/angular-foundation/mm-foundation.min.js',
|
||||||
'lib/angular-foundation/mm-foundation-tpls.min.js'
|
'lib/angular-foundation/mm-foundation-tpls.min.js',
|
||||||
|
'lib/angular-gettext/dist/angular-gettext.min.js'
|
||||||
],
|
],
|
||||||
dest: 'lib/angularjs-all.js'
|
dest: 'lib/angularjs-all.js'
|
||||||
},
|
},
|
||||||
|
@ -117,6 +119,7 @@ module.exports = function(grunt) {
|
||||||
'js/routes.js',
|
'js/routes.js',
|
||||||
'js/services/*.js',
|
'js/services/*.js',
|
||||||
'js/controllers/*.js',
|
'js/controllers/*.js',
|
||||||
|
'js/translations.js',
|
||||||
'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
|
'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
|
||||||
'js/init.js'
|
'js/init.js'
|
||||||
],
|
],
|
||||||
|
@ -146,10 +149,28 @@ module.exports = function(grunt) {
|
||||||
'lib/vendors.js': ['lib/vendors.js']
|
'lib/vendors.js': ['lib/vendors.js']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
nggettext_extract: {
|
||||||
|
pot: {
|
||||||
|
files: {
|
||||||
|
'po/template.pot': ['index.html', 'views/*.html', 'views/**/*.html']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nggettext_compile: {
|
||||||
|
all: {
|
||||||
|
options: {
|
||||||
|
module: 'copayApp'
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
'js/translations.js': ['po/*.po']
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask('default', ['shell:dev', 'concat', 'cssmin']);
|
grunt.registerTask('default', ['shell:dev', 'nggettext_compile', 'concat', 'cssmin']);
|
||||||
grunt.registerTask('prod', ['shell:prod', 'concat', 'cssmin', 'uglify']);
|
grunt.registerTask('prod', ['shell:prod', 'nggettext_compile', 'concat', 'cssmin', 'uglify']);
|
||||||
|
grunt.registerTask('translate', ['nggettext_extract']);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"angular-route": "~1.2.14",
|
"angular-route": "~1.2.14",
|
||||||
"angular-qrcode": "~3.1.0",
|
"angular-qrcode": "~3.1.0",
|
||||||
"angular-mocks": "~1.2.14",
|
"angular-mocks": "~1.2.14",
|
||||||
|
"angular-gettext": "~1.1.0",
|
||||||
"mocha": "~1.18.2",
|
"mocha": "~1.18.2",
|
||||||
"chai": "~1.9.1",
|
"chai": "~1.9.1",
|
||||||
"crypto-js": "http://crypto-js.googlecode.com/files/CryptoJS%20v3.1.2.zip",
|
"crypto-js": "http://crypto-js.googlecode.com/files/CryptoJS%20v3.1.2.zip",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
var defaultConfig = {
|
var defaultConfig = {
|
||||||
|
defaultLanguage: 'en',
|
||||||
// DEFAULT network (livenet or testnet)
|
// DEFAULT network (livenet or testnet)
|
||||||
networkName: 'testnet',
|
networkName: 'testnet',
|
||||||
forceNetwork: false,
|
forceNetwork: false,
|
||||||
|
|
|
@ -24,6 +24,7 @@ var copayApp = window.copayApp = angular.module('copayApp', [
|
||||||
'mm.foundation',
|
'mm.foundation',
|
||||||
'monospaced.qrcode',
|
'monospaced.qrcode',
|
||||||
'ngIdle',
|
'ngIdle',
|
||||||
|
'gettext',
|
||||||
'copayApp.filters',
|
'copayApp.filters',
|
||||||
'copayApp.services',
|
'copayApp.services',
|
||||||
'copayApp.controllers',
|
'copayApp.controllers',
|
||||||
|
|
|
@ -9,6 +9,22 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
||||||
$scope.insightPort = config.blockchain.port;
|
$scope.insightPort = config.blockchain.port;
|
||||||
$scope.insightSecure = config.blockchain.schema === 'https';
|
$scope.insightSecure = config.blockchain.schema === 'https';
|
||||||
$scope.forceNetwork = config.forceNetwork;
|
$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 = [{
|
$scope.unitOpts = [{
|
||||||
name: 'Satoshis (100,000,000 satoshis = 1BTC)',
|
name: 'Satoshis (100,000,000 satoshis = 1BTC)',
|
||||||
|
@ -90,7 +106,8 @@ angular.module('copayApp.controllers').controller('SettingsController', function
|
||||||
alternativeName: $scope.selectedAlternative.name,
|
alternativeName: $scope.selectedAlternative.name,
|
||||||
alternativeIsoCode: $scope.selectedAlternative.isoCode,
|
alternativeIsoCode: $scope.selectedAlternative.isoCode,
|
||||||
|
|
||||||
version: copay.version
|
version: copay.version,
|
||||||
|
defaultLanguage: $scope.selectedLanguage.isoCode
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Go home reloading the application
|
// Go home reloading the application
|
||||||
|
|
|
@ -79,7 +79,8 @@ angular
|
||||||
$idleProvider.warningDuration(20); // in seconds
|
$idleProvider.warningDuration(20); // in seconds
|
||||||
$keepaliveProvider.interval(2); // in seconds
|
$keepaliveProvider.interval(2); // in seconds
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $location, $idle) {
|
.run(function($rootScope, $location, $idle, gettextCatalog) {
|
||||||
|
gettextCatalog.currentLanguage = config.defaultLanguage;
|
||||||
$idle.watch();
|
$idle.watch();
|
||||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||||
if (!localStorage || localStorage.length < 1) {
|
if (!localStorage || localStorage.length < 1) {
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"bitcore": "0.1.35",
|
"bitcore": "0.1.35",
|
||||||
"grunt-mocha-test": "0.8.2",
|
"grunt-mocha-test": "0.8.2",
|
||||||
"grunt-shell": "0.6.4",
|
"grunt-shell": "0.6.4",
|
||||||
|
"grunt-angular-gettext": "^0.2.15",
|
||||||
"istanbul": "0.2.10",
|
"istanbul": "0.2.10",
|
||||||
"karma": "0.12.9",
|
"karma": "0.12.9",
|
||||||
"karma-chrome-launcher": "0.1.3",
|
"karma-chrome-launcher": "0.1.3",
|
||||||
|
|
Loading…
Reference in New Issue