From 0825d3e22f69b4cafefe602df3029c1391f6bba2 Mon Sep 17 00:00:00 2001 From: Sam Lanning Date: Sat, 16 Jan 2016 12:59:01 +0000 Subject: [PATCH] Implement i18n for Install Flow Fixes #600 // FREEBIE --- _locales/en/messages.json | 50 +++++++++++++++++++++++++++++++++++++++ js/options.js | 27 +++++++++++++++++++++ js/views/install_view.js | 6 ++--- options.html | 31 ++++++++++-------------- 4 files changed, 92 insertions(+), 22 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 7108d6ef1..1dcdbbda8 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -102,5 +102,55 @@ }, "sessionEnded": { "message": "Secure session ended" + }, + "installWelcome": { + "message": "Welcome to Signal Desktop", + "description": "Welcome title on the install page" + }, + "installTagline": { + "message": "Privacy is possible. Signal makes it easy.", + "description": "Tagline displayed under installWelcome on the install page" + }, + "installGetStartedButton": { + "message": "Get started" + }, + "installSignalLink": { + "message": "First, install Signal on your Android phone.
We'll link your devices and keep your messages in sync.", + "description": "Prompt the user to install Signal on Android before pairing" + }, + "installIHaveSignalButton": { + "message": "I have Signal for Android", + "description": "Button for the user to confirm that they have Signal for Android" + }, + "installFollowUs": { + "message": "Follow us for updates about multi-device support for iOS." + }, + "installAndroidInstructions": { + "message": "Open Signal on your phone and navigate to Settings > Devices. Tap the button to add a new device, then scan the code above." + }, + "installConnecting": { + "message": "Connecting...", + "description": "Displayed when waiting for the QR Code" + }, + "installGeneratingKeys": { + "message": "Generating Keys" + }, + "installSyncingGroupsAndContacts": { + "message": "Syncing groups and contacts" + }, + "installComputerName": { + "message": "This computer's name will be", + "description": "Text displayed before the input where the user can enter the name for this device." + }, + "installLinkingWithNumber": { + "message": "Linking with", + "description": "Text displayed before the phone number that the user is in the process of linking with" + }, + "installFinalButton": { + "message": "Looking good", + "description": "The final button for the install process, after the user has entered a name for their device" + }, + "installTooManyDevices": { + "message": "Sorry, you have too many devices registered already. Try removing some." } } diff --git a/js/options.js b/js/options.js index b43401a16..6acdafba7 100644 --- a/js/options.js +++ b/js/options.js @@ -58,4 +58,31 @@ }); }); }); + + // Apply i18n + $(document).ready(function(){ + // Basic Substitution + $('[data-i18n]').each(function(){ + var $this = $(this); + $this.text(i18n($this.data('i18n'))); + }); + + // Text with link to Play Store + var $installSignalLinkContent = $('' + i18n('installSignalLink') + ''); + $installSignalLinkContent.find('a').attr({ + class: 'link', + href: 'https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms', + target: '_blank' + }); + $('#installSignalLink').append($installSignalLinkContent); + + // Text with link to Twitter + var $installFollowUsContent = $('' + i18n('installFollowUs') + ''); + $installFollowUsContent.find('a').attr({ + class: 'link', + href: 'https://twitter.com/whispersystems', + target: '_blank' + }); + $('#installFollowUs').append($installFollowUsContent); + }); })(); diff --git a/js/views/install_view.js b/js/views/install_view.js index e3d706b00..2ccba93a3 100644 --- a/js/views/install_view.js +++ b/js/views/install_view.js @@ -19,7 +19,7 @@ }; }, clearQR: function() { - this.$('#qr').text("Connecting..."); + this.$('#qr').text(i18n("installConnecting")); }, setProvisioningUrl: function(url) { this.$('#qr').html(''); @@ -47,7 +47,7 @@ this.$('#device-name').focus(); return; } - this.$('.progress-dialog .status').text('Generating Keys'); + this.$('.progress-dialog .status').text(i18n('installGeneratingKeys')); this.selectStep(5); resolve(name); }.bind(this)); @@ -61,7 +61,7 @@ this.$('#step' + step).show(); }, showSync: function() { - this.$('.progress-dialog .status').text('Syncing groups and contacts'); + this.$('.progress-dialog .status').text(i18n('installSyncingGroupsAndContacts')); this.$('.progress-dialog .bar').addClass('progress-bar-striped active'); }, showTooManyDevices: function() { diff --git a/options.html b/options.html index 4e4321e9a..f3283f5a4 100644 --- a/options.html +++ b/options.html @@ -11,9 +11,9 @@