From 211b380cfa474ace7ad01dbff5b6e2f64254750c Mon Sep 17 00:00:00 2001 From: dabura667 Date: Wed, 22 Jul 2015 01:07:24 +0900 Subject: [PATCH] Separate download and clean up script --- i18n/crowdin_download.js | 79 +++++++++++++++++++++++++++++++++++++ i18n/crowdin_update.js | 25 +----------- i18n/docs/appstore_it.txt | 23 ----------- i18n/docs/updateinfo_de.txt | 7 ---- i18n/docs/updateinfo_it.txt | 7 ---- i18n/docs/updateinfo_pt.txt | 7 ---- i18n/po/de.po | 34 ++++++++-------- i18n/po/el.po | 2 +- i18n/po/es.po | 2 +- i18n/po/fr.po | 2 +- i18n/po/it.po | 2 +- i18n/po/ja.po | 2 +- i18n/po/pt.po | 2 +- 13 files changed, 103 insertions(+), 91 deletions(-) create mode 100644 i18n/crowdin_download.js delete mode 100644 i18n/docs/appstore_it.txt delete mode 100644 i18n/docs/updateinfo_de.txt delete mode 100644 i18n/docs/updateinfo_it.txt delete mode 100644 i18n/docs/updateinfo_pt.txt diff --git a/i18n/crowdin_download.js b/i18n/crowdin_download.js new file mode 100644 index 000000000..baae694ff --- /dev/null +++ b/i18n/crowdin_download.js @@ -0,0 +1,79 @@ +#!/usr/bin/env node + +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var https = require('https'); +var AdmZip = require('adm-zip'); + +var crowdin_identifier = 'copay' + +var local_file_name2 = path.join(__dirname, 'docs/appstore_en.txt') +var local_file_name3 = path.join(__dirname, 'docs/updateinfo_en.txt') + +// Download most recent translations for all languages. +https.get('https://crowdin.com/download/project/' + crowdin_identifier + '.zip', function(res) { + var data = [], dataLen = 0; + + res.on('data', function(chunk) { + data.push(chunk); + dataLen += chunk.length; + }).on('end', function() { + var buf = new Buffer(dataLen); + for (var i=0, len = data.length, pos = 0; i < len; i++) { + data[i].copy(buf, pos); + pos += data[i].length; + }; + var zip = new AdmZip(buf); + zip.extractAllTo('./', true); + console.log('Done extracting ZIP file.'); + + var files = fs.readdirSync('./docs'); + + for (var i in files) { + if (files[i].slice(0,9) == 'appstore_' && files[i].slice(-4) == '.txt' && files[i] != 'appstore_en.txt') { + var english_file = fs.readFileSync(local_file_name2, 'utf8'); + var compare_file = fs.readFileSync(path.join(__dirname, 'docs/' + files[i]), 'utf8') + if (compare_file == english_file) { + fs.unlinkSync(path.join(__dirname, 'docs/' + files[i])); + }; + }; + if (files[i].slice(0,11) == 'updateinfo_' && files[i].slice(-4) == '.txt' && files[i] != 'updateinfo_en.txt') { + var english_file = fs.readFileSync(local_file_name3, 'utf8'); + var compare_file = fs.readFileSync(path.join(__dirname, 'docs/' + files[i]), 'utf8') + if (compare_file == english_file) { + fs.unlinkSync(path.join(__dirname, 'docs/' + files[i])); + }; + }; + }; + + console.log('Cleaned out completely untranslated appstore docs.'); + + var files = fs.readdirSync('./po'); + + for (var i in files) { + if (files[i] != 'template.pot') { + var po_file = fs.readFileSync(path.join(__dirname, 'po/' + files[i]), 'utf8'); + var po_array = po_file.split('\n'); + for (var j in po_array) { + if (po_array[j].slice(0,5) == 'msgid') { + var source_text = po_array[j].slice(5); + } else if (po_array[j].slice(0,6) == 'msgstr') { + var translate_text = po_array[j].slice(6); + if (source_text != translate_text) { + break; + }; + }; + if (j == po_array.length - 1) { // All strings are exactly identical to English. Delete po file. + fs.unlinkSync(path.join(__dirname, 'po/' + files[i])); + }; + }; + }; + }; + + console.log('Cleaned out completely untranslated po files.'); + + }); +}); + diff --git a/i18n/crowdin_update.js b/i18n/crowdin_update.js index 5251d3e4d..a83269da2 100644 --- a/i18n/crowdin_update.js +++ b/i18n/crowdin_update.js @@ -5,7 +5,6 @@ var fs = require('fs'); var path = require('path'); var https = require('https'); -var AdmZip = require('adm-zip'); var bhttp = require('bhttp'); var crowdin_identifier = 'copay' @@ -20,7 +19,7 @@ var local_file_name3 = path.join(__dirname, 'docs/updateinfo_en.txt') var local_file3 = fs.createReadStream(local_file_name3) // obtain the crowdin api key -var crowdin_api_key = fs.readFileSync(path.join(__dirname, 'crowdin_api_key.txt')).slice(3) //slicing utf-8 BOM +var crowdin_api_key = fs.readFileSync(path.join(__dirname, 'crowdin_api_key.txt')) //console.log('api key: ' + crowdin_api_key); if (crowdin_api_key != '') { @@ -41,27 +40,5 @@ if (crowdin_api_key != '') { console.log('Export Got error: ' + e.message); }); }) - }; - -// Download most recent translations for all languages. -https.get('https://crowdin.com/download/project/' + crowdin_identifier + '.zip', function(res) { - var data = [], dataLen = 0; - - res.on('data', function(chunk) { - data.push(chunk); - dataLen += chunk.length; - }).on('end', function() { - var buf = new Buffer(dataLen); - for (var i=0, len = data.length, pos = 0; i < len; i++) { - data[i].copy(buf, pos); - pos += data[i].length; - }; - var zip = new AdmZip(buf); - zip.extractAllTo('./', true); - console.log('Done extracting ZIP file.'); - - }); -}); - diff --git a/i18n/docs/appstore_it.txt b/i18n/docs/appstore_it.txt deleted file mode 100644 index 0a6e38fc8..000000000 --- a/i18n/docs/appstore_it.txt +++ /dev/null @@ -1,23 +0,0 @@ -Secure bitcoin on your own terms with an open source, multisignature wallet from BitPay. -Copay users can hold funds individually or share finances securely with other users with multisignature wallets, which prevent unauthorized payments by requiring multiple approvals. Here are some ways Copay can be used with others: - -To save for vacations or joint purchases with friends -To track family spending and allowances -To manage business, club, or organization funds and expenses - -We built the following features into this version of Copay for a bitcoin wallet that doesn't compromise on security or accessibility: - -Multiple wallet creation and management in-app -Intuitive multisignature security for personal or shared wallets -Easy spending proposal flow for shared wallets and group payments -Hierarchical deterministic (HD) address generation and wallet backups -Device-based security: all private keys are stored locally, not in the cloud -Support for Bitcoin testnet wallets -Synchronous access across all major mobile and desktop platforms -Payment protocol (BIP70-BIP73) support: easily-identifiable payment requests and verifiably secure bitcoin payments -Support for 150+ currency pricing options and unit denomination in BTC or bits -Email notifications for payments and transfers -Customizable wallet naming and background colors -4 supported languages (EN, JP, FR, ES) - -Copay is free and open source software run on non-proprietary servers, so there's no need to rely on any company for continuous support. Anyone can review or contribute to Copay's source code on GitHub (https://github.com/bitpay/copay). diff --git a/i18n/docs/updateinfo_de.txt b/i18n/docs/updateinfo_de.txt deleted file mode 100644 index 6cc35687a..000000000 --- a/i18n/docs/updateinfo_de.txt +++ /dev/null @@ -1,7 +0,0 @@ -* Now is possible to make backups without signing capabilities (more info https://github.com/bitpay/copay/pull/2998) -* Better refresh and sorting rules in transaction history -* Better handling of `invalid` transactions in history -* Better handling of wallets with 1K+ transactions in history -* Exports .csv files with transaction ID -* Better UTXOs selection polices -* Minor bug fixes diff --git a/i18n/docs/updateinfo_it.txt b/i18n/docs/updateinfo_it.txt deleted file mode 100644 index 6cc35687a..000000000 --- a/i18n/docs/updateinfo_it.txt +++ /dev/null @@ -1,7 +0,0 @@ -* Now is possible to make backups without signing capabilities (more info https://github.com/bitpay/copay/pull/2998) -* Better refresh and sorting rules in transaction history -* Better handling of `invalid` transactions in history -* Better handling of wallets with 1K+ transactions in history -* Exports .csv files with transaction ID -* Better UTXOs selection polices -* Minor bug fixes diff --git a/i18n/docs/updateinfo_pt.txt b/i18n/docs/updateinfo_pt.txt deleted file mode 100644 index 6cc35687a..000000000 --- a/i18n/docs/updateinfo_pt.txt +++ /dev/null @@ -1,7 +0,0 @@ -* Now is possible to make backups without signing capabilities (more info https://github.com/bitpay/copay/pull/2998) -* Better refresh and sorting rules in transaction history -* Better handling of `invalid` transactions in history -* Better handling of wallets with 1K+ transactions in history -* Exports .csv files with transaction ID -* Better UTXOs selection polices -* Minor bug fixes diff --git a/i18n/po/de.po b/i18n/po/de.po index e6c705eb8..0c373a3fb 100644 --- a/i18n/po/de.po +++ b/i18n/po/de.po @@ -12,11 +12,11 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: German\n" "Language: de_DE\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" -msgstr "(possible double spend)" +msgstr "(mögliche Doppelausgabe)" #: public/views/modals/txp-details.html msgid "* A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created." @@ -58,7 +58,7 @@ msgstr "Erweitert" #: public/views/disclaimer.html msgid "Agree" -msgstr "Agree" +msgstr "Zustimmen" #: public/views/preferencesAlias.html msgid "Alias for {{index.walletName}}" @@ -284,7 +284,7 @@ msgstr "Beteiligung am Wallet nicht möglich" #: src/js/controllers/walletHome.js msgid "Could not recognize a valid Bitcoin QR Code" -msgstr "Could not recognize a valid Bitcoin QR Code" +msgstr "Es konnte kein gültiger Bitcoin-QR-Code erkannt werden," #: src/js/controllers/walletHome.js msgid "Could not reject payment. Check you connection and try again" @@ -372,11 +372,11 @@ msgstr "Deaktiviert" #: public/views/backup.html msgid "Do not include private key in backup" -msgstr "Do not include private key in backup" +msgstr "Keine privaten Schlüssel zur Sicherung hinzufügen" #: public/views/walletHome.html msgid "Download CSV file" -msgstr "Download CSV file" +msgstr "CSV-Datei herunterladen" #: public/views/backup.html msgid "Download backup" @@ -408,7 +408,7 @@ msgstr "Verschlüsselte Sicherungsdatei wurde gespeichert" #: src/js/controllers/index.js msgid "English" -msgstr "English" +msgstr "Englisch" #: public/views/includes/password.html msgid "Enter your password" @@ -446,7 +446,7 @@ msgstr "Familienurlaub" #: public/views/modals/tx-details.html #: public/views/modals/txp-details.html msgid "Fee" -msgstr "Fee" +msgstr "Gebühr" #. Get information of payment if using Payment Protocol #: src/js/controllers/walletHome.js @@ -475,7 +475,7 @@ msgstr "Neue Adresse erzeugen" #: public/views/walletHome.html msgid "Generating .csv file..." -msgstr "Generating .csv file..." +msgstr "CSV-Datei erzeugen..." #: public/views/modals/wallets.html msgid "Getting address for wallet {{selectedWalletName}} ..." @@ -487,7 +487,7 @@ msgstr "Globale Einstellungen" #: public/views/disclaimer.html msgid "Go back" -msgstr "Go back" +msgstr "Zurück" #: public/views/import.html msgid "Have a Backup from Copay v0.9?" @@ -636,7 +636,7 @@ msgstr "Nein" #: public/views/walletHome.html msgid "No Private key" -msgstr "No Private key" +msgstr "Kein privater Schlüssel" #: public/views/walletHome.html msgid "No transactions yet" @@ -659,7 +659,7 @@ msgstr "Notiz" #: public/views/modals/tx-status.html msgid "OKAY" -msgstr "OKAY" +msgstr "Okay" #: public/views/modals/tx-details.html #: public/views/modals/txp-details.html @@ -791,7 +791,7 @@ msgstr "Priority" #: public/views/modals/customized-amount.html msgid "QR Code" -msgstr "QR Code" +msgstr "QR-Code" #: public/views/modals/scanner.html msgid "QR-Scanner" @@ -837,7 +837,7 @@ msgstr "Passwort wiederholen" #: public/views/walletHome.html #: public/views/modals/customized-amount.html msgid "Request a specific amount" -msgstr "Request a specific amount" +msgstr "Einen bestimmten Betrag anfordern" #: public/views/import.html #: public/views/join.html @@ -910,7 +910,7 @@ msgstr "Senden" #: public/views/walletHome.html msgid "Send All" -msgstr "Send All" +msgstr "Alle senden" #: public/views/backup.html #: public/views/preferencesLogs.html @@ -992,7 +992,7 @@ msgstr "Zum Wiederholen antippen" #: public/views/disclaimer.html #: public/views/preferencesAbout.html msgid "Terms of Use" -msgstr "Terms of Use" +msgstr "Nutzungsbedingungen" #: public/views/create.html msgid "Testnet" @@ -1213,7 +1213,7 @@ msgstr "zu lang!" #: public/views/preferencesFee.html msgid "{{fee.value}} bits per kB" -msgstr "{{fee.value}} bits per kB" +msgstr "{{fee.value}} Bits pro kB" #: src/js/controllers/walletHome.js msgid "{{fee}} will be discounted for bitcoin networking fees" diff --git a/i18n/po/el.po b/i18n/po/el.po index fd8dcd1ad..582301b26 100644 --- a/i18n/po/el.po +++ b/i18n/po/el.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: Greek\n" "Language: el_GR\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" diff --git a/i18n/po/es.po b/i18n/po/es.po index ecc400bf4..1f5cae689 100644 --- a/i18n/po/es.po +++ b/i18n/po/es.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: Spanish\n" "Language: es_ES\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" diff --git a/i18n/po/fr.po b/i18n/po/fr.po index 09911f31b..22ae41e04 100644 --- a/i18n/po/fr.po +++ b/i18n/po/fr.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: French\n" "Language: fr_FR\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" diff --git a/i18n/po/it.po b/i18n/po/it.po index bf5c8d97a..4641a20a5 100644 --- a/i18n/po/it.po +++ b/i18n/po/it.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: Italian\n" "Language: it_IT\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" diff --git a/i18n/po/ja.po b/i18n/po/ja.po index ca6c899e0..0e4384d90 100644 --- a/i18n/po/ja.po +++ b/i18n/po/ja.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: Japanese\n" "Language: ja_JP\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)" diff --git a/i18n/po/pt.po b/i18n/po/pt.po index 8e43cb8af..9f4962479 100644 --- a/i18n/po/pt.po +++ b/i18n/po/pt.po @@ -12,7 +12,7 @@ msgstr "" "Last-Translator: cmgustavo83 \n" "Language-Team: Portuguese\n" "Language: pt_PT\n" -"PO-Revision-Date: 2015-07-20 12:17-0400\n" +"PO-Revision-Date: 2015-07-21 11:53-0400\n" #: public/views/walletHome.html msgid "(possible double spend)"