From efdd5d57f54d6bcc349577d4e9c7ac97c8b35416 Mon Sep 17 00:00:00 2001 From: Giulio Bernardi Date: Sun, 11 Dec 2016 22:52:52 +0100 Subject: [PATCH] Support language-specific plural forms of coins With this patch, each language can specify the correct plural form of each coin (that is, the plural of "bitcoin" is not "bitcoins" in all possible languages). --- app/locales/en/messages.properties | 6 ++++++ app/src/bitcoin/networks.coffee | 16 ++++++++-------- ...ashboard_compatibility_view_controller.coffee | 2 +- app/src/routes.coffee | 8 ++++---- app/views/onboarding/management/done.eco | 2 +- .../onboarding/management/recoverydevice.eco | 4 ++-- app/views/onboarding/management/seed.eco | 2 +- app/views/onboarding/management/summary.eco | 2 +- app/views/onboarding/management/welcome.eco | 2 +- app/views/update/done.eco | 2 +- app/views/update/erasing.eco | 2 +- app/views/update/index.eco | 2 +- app/views/wallet/receive/index.eco | 4 ++-- app/views/wallet/send/card.eco | 2 +- app/views/wallet/send/index.eco | 2 +- app/views/wallet/send/method.eco | 2 +- app/views/wallet/send/mobile.eco | 2 +- app/views/wallet/send/preparing.eco | 2 +- app/views/wallet/send/processing.eco | 2 +- app/views/wallet/send/sign.eco | 2 +- app/views/wallet/send/validating.eco | 2 +- 21 files changed, 38 insertions(+), 32 deletions(-) diff --git a/app/locales/en/messages.properties b/app/locales/en/messages.properties index b2f1a0fb..96709c0f 100644 --- a/app/locales/en/messages.properties +++ b/app/locales/en/messages.properties @@ -13,6 +13,12 @@ application.commands.export_logs = Export the global logs application.singleton.alert_message = The {APPLICATION_NAME} application is already running. Please close it first and try again. # Common +common.bitcoin_plural = bitcoins +common.litecoin_plural = litecoins +common.dogecoin_plural = dogecoins +common.dash_plural = dash +common.zcash_plural = zcash +common.clubcoin_plural = clubcoins common.default_account_name = My account common.default_recovered_account_name = Recovered account %d common.date_time_format = L [at] LT diff --git a/app/src/bitcoin/networks.coffee b/app/src/bitcoin/networks.coffee index 9c0f9fdc..a44c9247 100644 --- a/app/src/bitcoin/networks.coffee +++ b/app/src/bitcoin/networks.coffee @@ -28,7 +28,7 @@ ledger.bitcoin.Networks = bitcoin: name: 'bitcoin' bolosAppName: 'Bitcoin' - plural: 'bitcoins' + plural: -> t('common.bitcoin_plural') ticker: 'btc' scheme: 'bitcoin:' tickerKey: @@ -46,7 +46,7 @@ ledger.bitcoin.Networks = testnet: name: 'testnet' - plural: 'bitcoins' + plural: -> t('common.bitcoin_plural') ticker: 'btctest' scheme: 'bitcoin:' bip44_coin_type: '1' @@ -60,7 +60,7 @@ ledger.bitcoin.Networks = segnet: name: 'segnet' - plural: 'bitcoins' + plural: -> t('common.bitcoin_plural') ticker: 'segtest' scheme: 'bitcoin:' bip44_coin_type: '1' @@ -83,7 +83,7 @@ ledger.bitcoin.Networks = litecoin: name: 'litecoin' - plural: 'litecoins' + plural: -> t('common.litecoin_plural') scheme: 'litecoin:' bolosAppName: 'Litecoin' ticker: 'ltc' @@ -101,7 +101,7 @@ ledger.bitcoin.Networks = dogecoin: name: 'dogecoin' - plural: 'dogecoins' + plural: -> t('common.dogecoin_plural') scheme: 'dogecoin:' bolosAppName: 'Dogecoin' ticker: 'doge' @@ -119,7 +119,7 @@ ledger.bitcoin.Networks = dash: name: 'dash' - plural: 'dash' + plural: -> t('common.dash_plural') scheme: 'dash:' bolosAppName: 'Dash' ticker: 'dash' @@ -137,7 +137,7 @@ ledger.bitcoin.Networks = zcash: name: 'zcash' - plural: 'zcash' + plural: -> t('common.zcash_plural') scheme: 'zcash:' bolosAppName: 'Zcash' ticker: 'zec' @@ -155,7 +155,7 @@ ledger.bitcoin.Networks = clubcoin: name: 'clubcoin' - plural: 'clubcoins' + plural: -> t('common.clubcoin_plural') scheme: 'clubcoin:' bolosAppName: 'ClubCoin' ticker: 'club' diff --git a/app/src/controllers/apps/coinkite/dashboard/apps_coinkite_dashboard_compatibility_view_controller.coffee b/app/src/controllers/apps/coinkite/dashboard/apps_coinkite_dashboard_compatibility_view_controller.coffee index 13247a9f..3e7cf2fb 100644 --- a/app/src/controllers/apps/coinkite/dashboard/apps_coinkite_dashboard_compatibility_view_controller.coffee +++ b/app/src/controllers/apps/coinkite/dashboard/apps_coinkite_dashboard_compatibility_view_controller.coffee @@ -14,5 +14,5 @@ class @AppsCoinkiteDashboardCompatibilityDialogViewController extends ledger.com dialog.show() else @dismiss => - dialog = new CommonDialogsMessageDialogViewController(kind: "error", title: t("apps.coinkite.dashboard.compatibility.fail"), subtitle: _.str.sprintf(t("apps.coinkite.dashboard.compatibility.fail_text"), ledger.config.network.plural)) + dialog = new CommonDialogsMessageDialogViewController(kind: "error", title: t("apps.coinkite.dashboard.compatibility.fail"), subtitle: _.str.sprintf(t("apps.coinkite.dashboard.compatibility.fail_text"), ledger.config.network.plural())) dialog.show() diff --git a/app/src/routes.coffee b/app/src/routes.coffee index 0dce9b2f..489489be 100755 --- a/app/src/routes.coffee +++ b/app/src/routes.coffee @@ -49,17 +49,17 @@ ledger.router.pluggedWalletRoutesExceptions = [ route '/onboarding/device/wrongpin', (params) -> app.router.go '/onboarding/device/error', message: _.str.sprintf t('onboarding.device.errors.wrongpin.tries_left'), params['?params'].tries_left - indication: _.str.sprintf(t('onboarding.device.errors.wrongpin.unplug_plug'), ledger.config.network.plural) + indication: _.str.sprintf(t('onboarding.device.errors.wrongpin.unplug_plug'), ledger.config.network.plural()) route '/onboarding/device/frozen', (params) -> app.router.go '/onboarding/device/error', serious: yes - message: _.str.sprintf(t('onboarding.device.errors.frozen.blank_next_time'), ledger.config.network.plural) - indication: _.str.sprintf(t('onboarding.device.errors.frozen.unplug_plug'), ledger.config.network.plural) + message: _.str.sprintf(t('onboarding.device.errors.frozen.blank_next_time'), ledger.config.network.plural()) + indication: _.str.sprintf(t('onboarding.device.errors.frozen.unplug_plug'), ledger.config.network.plural()) route '/onboarding/device/forged', (params) -> app.router.go '/onboarding/device/error', - message: _.str.sprintf(t('onboarding.device.errors.forged.forbidden_access'), ledger.config.network.plural) + message: _.str.sprintf(t('onboarding.device.errors.forged.forbidden_access'), ledger.config.network.plural()) indication: t 'onboarding.device.errors.forged.get_help' route '/onboarding/device/swapped_bip39_provisioning', (params) -> diff --git a/app/views/onboarding/management/done.eco b/app/views/onboarding/management/done.eco index e566ed1f..c0fa9e23 100644 --- a/app/views/onboarding/management/done.eco +++ b/app/views/onboarding/management/done.eco @@ -6,7 +6,7 @@
<%= if @params.error? then t 'onboarding.management.done.configuration_failed_' + @params.wallet_mode else t 'onboarding.management.done.configuration_is_complete_' + @params.wallet_mode %>
<% if not @params.error?: %> -
<%= _.str.sprintf(t('onboarding.management.done.unplug_plug'), ledger.config.network.plural) %>
+
<%= _.str.sprintf(t('onboarding.management.done.unplug_plug'), ledger.config.network.plural()) %>
<% else: %> <%= t 'onboarding.management.done.contact_support' %> <% end %> diff --git a/app/views/onboarding/management/recoverydevice.eco b/app/views/onboarding/management/recoverydevice.eco index 1643767c..00bb7f89 100644 --- a/app/views/onboarding/management/recoverydevice.eco +++ b/app/views/onboarding/management/recoverydevice.eco @@ -3,7 +3,7 @@
<%= t 'onboarding.management.recover_my_wallet' %>
<%= t 'application.name' %>
-
<%= _.str.sprintf(t('onboarding.management.recoverydevice.recovering_on_new_wallet'), ledger.config.network.plural) %>
+
<%= _.str.sprintf(t('onboarding.management.recoverydevice.recovering_on_new_wallet'), ledger.config.network.plural()) %>
<%= t 'onboarding.management.recoverydevice.may_need_to_convert' %>
@@ -11,7 +11,7 @@
<%= t 'onboarding.management.recoverydevice.no_its_the_same' %>
-
<%= _.str.sprintf(t('onboarding.management.recoverydevice.i_froze_my_device'), ledger.config.network.plural) %>
+
<%= _.str.sprintf(t('onboarding.management.recoverydevice.i_froze_my_device'), ledger.config.network.plural()) %>
diff --git a/app/views/onboarding/management/seed.eco b/app/views/onboarding/management/seed.eco index bfb9ea5b..9d0f1844 100644 --- a/app/views/onboarding/management/seed.eco +++ b/app/views/onboarding/management/seed.eco @@ -22,7 +22,7 @@
<%= t 'onboarding.management.seed.invalid_recovery_phrase' %>
-
<%= t 'onboarding.management.seed.it_wont_be_displayed_again' %> <%= _.str.sprintf(t('onboarding.management.seed.without_it'), ledger.config.network.plural) %>
+
<%= t 'onboarding.management.seed.it_wont_be_displayed_again' %> <%= _.str.sprintf(t('onboarding.management.seed.without_it'), ledger.config.network.plural()) %>
diff --git a/app/views/onboarding/management/welcome.eco b/app/views/onboarding/management/welcome.eco index b585c56f..32990f4c 100644 --- a/app/views/onboarding/management/welcome.eco +++ b/app/views/onboarding/management/welcome.eco @@ -19,7 +19,7 @@
<%= t 'onboarding.management.welcome.recover_wallet' %>
-
<%= _.str.sprintf(t('onboarding.management.welcome.if_you_lost_your_wallet'), ledger.config.network.plural) %>
+
<%= _.str.sprintf(t('onboarding.management.welcome.if_you_lost_your_wallet'), ledger.config.network.plural()) %>
diff --git a/app/views/update/done.eco b/app/views/update/done.eco index 490787f8..11ff4189 100644 --- a/app/views/update/done.eco +++ b/app/views/update/done.eco @@ -1,5 +1,5 @@
<%- t 'update.done.successfully_updated' %>
-
<%- _.str.sprintf(t(if @params.provisioned then 'update.done.enjoy' else 'update.done.use_24_words'), ledger.config.network.plural)%>
+
<%- _.str.sprintf(t(if @params.provisioned then 'update.done.enjoy' else 'update.done.use_24_words'), ledger.config.network.plural())%>
\ No newline at end of file diff --git a/app/views/update/erasing.eco b/app/views/update/erasing.eco index f444ba02..4e5ab11d 100644 --- a/app/views/update/erasing.eco +++ b/app/views/update/erasing.eco @@ -1,6 +1,6 @@
<%- t 'update.erasing.ready_to_start_process' %>
-
<%- _.str.sprintf(t('update.erasing.clicking_continue'), ledger.config.network.plural) %>
+
<%- _.str.sprintf(t('update.erasing.clicking_continue'), ledger.config.network.plural()) %>
<%= t 'update.erasing.please_note' %>
\ No newline at end of file diff --git a/app/views/update/index.eco b/app/views/update/index.eco index 7b7903ed..15a140bb 100644 --- a/app/views/update/index.eco +++ b/app/views/update/index.eco @@ -1,5 +1,5 @@
-
<%- _.str.sprintf(t('update.index.update_process'), ledger.config.network.plural) %>
+
<%- _.str.sprintf(t('update.index.update_process'), ledger.config.network.plural()) %>
<%- t 'update.index.clicking_continue' %>
<%= t 'update.index.please_note' %>
\ No newline at end of file diff --git a/app/views/wallet/receive/index.eco b/app/views/wallet/receive/index.eco index 5b14b40a..6b83111c 100644 --- a/app/views/wallet/receive/index.eco +++ b/app/views/wallet/receive/index.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.receive.index.title'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.receive.index.title'), ledger.config.network.plural()) %>

@@ -33,7 +33,7 @@
-

<%- _.str.sprintf(t('wallet.receive.index.qr_code_explanation'), ledger.config.network.plural) %>

+

<%- _.str.sprintf(t('wallet.receive.index.qr_code_explanation'), ledger.config.network.plural()) %>

diff --git a/app/views/wallet/send/card.eco b/app/views/wallet/send/card.eco index 4d39d975..d8891f64 100644 --- a/app/views/wallet/send/card.eco +++ b/app/views/wallet/send/card.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%- t 'wallet.send.card.grab_your_card' %>
diff --git a/app/views/wallet/send/index.eco b/app/views/wallet/send/index.eco index 4918b79a..8959a298 100644 --- a/app/views/wallet/send/index.eco +++ b/app/views/wallet/send/index.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

diff --git a/app/views/wallet/send/method.eco b/app/views/wallet/send/method.eco index 57c72eea..a0d6eccf 100644 --- a/app/views/wallet/send/method.eco +++ b/app/views/wallet/send/method.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%- t 'wallet.send.method.select_method' %>
diff --git a/app/views/wallet/send/mobile.eco b/app/views/wallet/send/mobile.eco index c00a39dc..429fdd8c 100644 --- a/app/views/wallet/send/mobile.eco +++ b/app/views/wallet/send/mobile.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

diff --git a/app/views/wallet/send/preparing.eco b/app/views/wallet/send/preparing.eco index a91d1eac..89055a5b 100644 --- a/app/views/wallet/send/preparing.eco +++ b/app/views/wallet/send/preparing.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%= t 'wallet.send.preparing.preparing_transaction' %>
diff --git a/app/views/wallet/send/processing.eco b/app/views/wallet/send/processing.eco index e915e05a..e4a9bff3 100644 --- a/app/views/wallet/send/processing.eco +++ b/app/views/wallet/send/processing.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%= t 'wallet.send.processing.finalizing_transaction' %>
diff --git a/app/views/wallet/send/sign.eco b/app/views/wallet/send/sign.eco index 54e6b2a8..4b029dd7 100644 --- a/app/views/wallet/send/sign.eco +++ b/app/views/wallet/send/sign.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%= t 'wallet.send.validating.validating_transaction' %>
diff --git a/app/views/wallet/send/validating.eco b/app/views/wallet/send/validating.eco index dd9c4573..49040af7 100644 --- a/app/views/wallet/send/validating.eco +++ b/app/views/wallet/send/validating.eco @@ -1,6 +1,6 @@
-

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural) %>

+

<%= _.str.sprintf(t('wallet.send.common.send_bitcoins'), ledger.config.network.plural()) %>

<%= t 'wallet.send.validating.validating_transaction' %>