From fc91c19f280dff0cc35cb474f7ec1c0c76a25e5b Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Sat, 21 Jul 2012 19:02:40 -0600
Subject: [PATCH] improve i18n of main site - strings for translators should
 not include site implementation details (links, ids, etc) - this prevents
 accidental breakage and allows us to change our ids and links without
 requiring retranslation.  closes #2093

---
 resources/views/about.ejs              | 8 +++++++-
 resources/views/forgot.ejs             | 2 +-
 resources/views/index.ejs              | 4 ++--
 resources/views/signin.ejs             | 6 ++++--
 resources/views/signup.ejs             | 7 ++++---
 resources/views/unsupported_dialog.ejs | 4 ++--
 6 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/resources/views/about.ejs b/resources/views/about.ejs
index 7db844f68..ce1ee940a 100644
--- a/resources/views/about.ejs
+++ b/resources/views/about.ejs
@@ -9,7 +9,13 @@
             <article class="blurb">
                 <div class="info first">
                     <h1><%- gettext('Persona replaces multiple passwords') %></h1>
-                    <p><%- gettext('Sites such as <a href="http://crossword.thetimes.co.uk/" target="_blank">The Times Crossword</a>, <a href="http://current.openphoto.me/" target="_blank">OpenPhoto</a> and <a href="https://www.voo.st/" target="_blank">Voost</a> use Persona instead of usernames to sign you in.') %></p><p><%- gettext('This means you only need one password to sign in to many sites.') %></p>
+                    <p><%- format(gettext('Sites such as <a %(timesLink)>The Times Crossword</a>, <a %(openphotoLink)>OpenPhoto</a> and <a %(voostLink)>Voost</a> use Persona instead of usernames to sign you in.'),
+                                  {
+                                    timesLink: 'href="http://crossword.thetimes.co.uk/" target="_blank"',
+                                    openphotoLink: 'href="http://current.openphoto.me/" target="_blank"',
+                                    voostLink: 'href="https://www.voo.st/" target="_blank"'
+                                  })
+                           %></p><p><%- gettext('This means you only need one password to sign in to many sites.') %></p>
                 </div>
 
                 <div class="graphic">
diff --git a/resources/views/forgot.ejs b/resources/views/forgot.ejs
index 59a0c5d59..726a316b1 100644
--- a/resources/views/forgot.ejs
+++ b/resources/views/forgot.ejs
@@ -12,7 +12,7 @@
                   <h2><%- gettext('Confirm your email address') %></h2>
 
                   <p>
-                    <%- gettext('Check your email at <strong id="sentToEmail"></strong>.') %>
+                    <%- format(gettext('Check your email at <strong %(checkId)></strong>.'), { checkId: 'id="sentToEmail"' }) %>
                   </p>
 
                   <p>
diff --git a/resources/views/index.ejs b/resources/views/index.ejs
index 98c47d935..c1dcdf8c9 100644
--- a/resources/views/index.ejs
+++ b/resources/views/index.ejs
@@ -29,7 +29,7 @@
   <script type="text/html" id="templateManage">
     <div id="content">
         <div class="newsbanner" id="newuser">
-          <%- gettext('New to Mozilla Persona? <a href="/about">Learn more</a>') %>
+          <%- format(gettext('New to Mozilla Persona? <a %(learnMoreLink)>Learn more</a>'), { learnMoreLink: 'href="/about"' }) %>
         </div>
 
         <div id="manage">
@@ -74,7 +74,7 @@
             </section>
 
 
-            <p id="disclaimer"><%- gettext('You may, at any time, <a href="#" id="cancelAccount" class="action">cancel your account</a>') %></p>
+            <p id="disclaimer"><%- format(gettext('You may, at any time, <a %(cancelLink)>cancel your account</a>'), { cancelLink: 'href="#" id="cancelAccount" class="action"' }) %></p>
         </div>
     </div>
 
diff --git a/resources/views/signin.ejs b/resources/views/signin.ejs
index 683af56d6..7717ff027 100644
--- a/resources/views/signin.ejs
+++ b/resources/views/signin.ejs
@@ -10,7 +10,8 @@
 
             <ul class="notifications">
                 <li class="notification" id="unknown_secondary">
-                  <%- gettext('<strong id="unknown_email">Email</strong> is not registered. Would you like to <a class="action" href="/signup">sign up</a> instead?') %>
+                  <%- format(gettext('<strong %(emailId)>Email</strong> is not registered. Would you like to <a %(signUpLink)>sign up</a> instead?'),
+                             { emailId: 'id="unknown_email"', signUpLink: 'class="action" href="/signup"' }) %>
                 </li>
 
             </ul>
@@ -57,7 +58,8 @@
             <ul class="notifications">
                 <li class="notification" id="verify_primary">
                   <p>
-                    <%- gettext('To verify that you own <strong id="primary_email">address</strong>, you must sign in with your provider.  A new window will be opened.') %>
+                    <%- format(gettext('To verify that you own <strong %(primaryId)>address</strong>, you must sign in with your provider.  A new window will be opened.'),
+                               { primaryId: 'id="primary_email"' }) %>
                   </p>
 
                   <p>
diff --git a/resources/views/signup.ejs b/resources/views/signup.ejs
index 14e823d4f..364e1ad40 100644
--- a/resources/views/signup.ejs
+++ b/resources/views/signup.ejs
@@ -10,14 +10,15 @@
 
             <ul class="notifications">
                 <li class="notification alreadyRegistered">
-                  <%- gettext('<strong id="registeredEmail"></strong> is already registered. Would you like to <a class="action" href="/signin">sign in</a> instead?') %>
+                  <%- format(gettext('<strong %(emailId)></strong> is already registered. Would you like to <a %(signInLink)>sign in</a> instead?'),
+                             { emailId: 'id="registeredEmail"', signInLink: 'class="action" href="/signin"' }) %>
                 </li>
 
                 <li class="notification emailsent">
                   <h2><%- gettext('Confirm your email address') %></h2>
 
                   <p>
-                    <%- gettext('Check your email at <strong id="sentToEmail"></strong>.') %>
+                    <%- format(gettext('Check your email at <strong %(emailId)></strong>.'), { emailId: 'id="sentToEmail"' }) %>
                   </p>
 
                   <p>
@@ -94,7 +95,7 @@
                 <!-- This has to go down here because of the button.  Firefox clicks the first button in the form whenever the user hits enter in the form, whether the button is shown or not, and even if there is an input[type=submit].  Ghetto.  -->
                 <li class="notification" id="primary_verify">
                   <p>
-                    <%- gettext('To verify that you own <strong id="primary_email">address</strong>, you must sign in with your provider.  A new window will be opened.') %>
+                    <%- format(gettext('To verify that you own <strong %(emailId)>address</strong>, you must sign in with your provider.  A new window will be opened.'), { emailId: 'id="primary_email"' }) %>
                   </p>
 
                   <p class="submit">
diff --git a/resources/views/unsupported_dialog.ejs b/resources/views/unsupported_dialog.ejs
index 01340c242..942164297 100644
--- a/resources/views/unsupported_dialog.ejs
+++ b/resources/views/unsupported_dialog.ejs
@@ -13,11 +13,11 @@
       </a>
 
       <p>
-        <%- gettext('Persona works with <a href="http://getfirefox.com" target="_blank" title="Get Firefox">Firefox</a>') %>
+        <%- format(gettext('Persona works with <a %(getFirefoxLink)>Firefox</a>'), { getFirefoxLink: 'href="http://getfirefox.com" target="_blank" title="Get Firefox"' }) %>
       </p>
 
       <p class="lighter">
-       <%- gettext('and other <a href="http://whatbrowser.org" target="_blank">modern browsers.</a>') %>
+       <%- format(gettext('and other <a %(otherBrowserLink)>modern browsers.</a>'), { otherBrowserLink: 'href="http://whatbrowser.org" target="_blank"' }) %>
       </p>
 
   </section>
-- 
GitLab