From 23672be5c0b5079aa3a8197dfe62bbdb2fe568cf Mon Sep 17 00:00:00 2001
From: jovuit <jo.vuitton@gmail.com>
Date: Mon, 11 Feb 2019 09:43:57 +0100
Subject: [PATCH] #662: Resolve "Add contexts to translatable strings"

---
 front/src/views/auth/EmailConfirm.vue         | 18 ++++++++---------
 front/src/views/auth/PasswordReset.vue        | 17 ++++++++--------
 front/src/views/auth/PasswordResetConfirm.vue | 20 +++++++++----------
 3 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/front/src/views/auth/EmailConfirm.vue b/front/src/views/auth/EmailConfirm.vue
index fd509272..554b424a 100644
--- a/front/src/views/auth/EmailConfirm.vue
+++ b/front/src/views/auth/EmailConfirm.vue
@@ -2,29 +2,29 @@
   <main class="main pusher" v-title="labels.confirm">
     <section class="ui vertical stripe segment">
       <div class="ui small text container">
-        <h2><translate>Confirm your e-mail address</translate></h2>
+        <h2><translate :translate-context="'Content/Signup/Title'">Confirm your e-mail address</translate></h2>
         <form v-if="!success" class="ui form" @submit.prevent="submit()">
           <div v-if="errors.length > 0" class="ui negative message">
-            <div class="header"><translate>Could not confirm your e-mail address</translate></div>
+            <div class="header"><translate :translate-context="'Content/Signup/Paragraph'">Could not confirm your e-mail address</translate></div>
             <ul class="list">
               <li v-for="error in errors">{{ error }}</li>
             </ul>
           </div>
           <div class="field">
-            <label><translate>Confirmation code</translate></label>
+            <label><translate :translate-context="'Content/Signup/Form.Label'">Confirmation code</translate></label>
             <input name="confirmation-code" type="text" required v-model="key" />
           </div>
           <router-link :to="{path: '/login'}">
-            <translate>Return to login</translate>
+            <translate :translate-context="'Content/Signup/Link/Verb'">Return to login</translate>
           </router-link>
           <button :class="['ui', {'loading': isLoading}, 'right', 'floated', 'green', 'button']" type="submit">
-            <translate>Confirm your e-mail address</translate></button>
+            <translate :translate-context="'Content/Signup/Button.Label/Verb'">Confirm your e-mail address</translate></button>
         </form>
         <div v-else class="ui positive message">
-          <div class="header"><translate>E-mail address confirmed</translate></div>
-          <p><translate>You can now use the service without limitations.</translate></p>
+          <div class="header"><translate :translate-context="'Content/Signup/Message'">E-mail address confirmed</translate></div>
+          <p><translate :translate-context="'Content/Signup/Paragraph'">You can now use the service without limitations.</translate></p>
           <router-link :to="{name: 'login'}">
-            <translate>Proceed to login</translate>
+            <translate :translate-context="'Content/Signup/Link/Verb'">Proceed to login</translate>
           </router-link>
         </div>
       </div>
@@ -48,7 +48,7 @@ export default {
   computed: {
     labels() {
       return {
-        confirm: this.$gettext("Confirm your e-mail address")
+        confirm: this.$pgettext('Head/Signup/Title', "Confirm your e-mail address")
       }
     }
   },
diff --git a/front/src/views/auth/PasswordReset.vue b/front/src/views/auth/PasswordReset.vue
index 7940c170..1cba54bc 100644
--- a/front/src/views/auth/PasswordReset.vue
+++ b/front/src/views/auth/PasswordReset.vue
@@ -2,17 +2,17 @@
   <main class="main pusher" v-title="labels.reset">
     <section class="ui vertical stripe segment">
       <div class="ui small text container">
-        <h2><translate>Reset your password</translate></h2>
+        <h2><translate :translate-context="'Content/Signup/Title'">Reset your password</translate></h2>
         <form class="ui form" @submit.prevent="submit()">
           <div v-if="errors.length > 0" class="ui negative message">
-            <div class="header"><translate>Error while asking for a password reset</translate></div>
+            <div class="header"><translate :translate-context="'Content/Signup/Card.Title'">Error while asking for a password reset</translate></div>
             <ul class="list">
               <li v-for="error in errors">{{ error }}</li>
             </ul>
           </div>
-          <p><translate>Use this form to request a password reset. We will send an email to the given address with instructions to reset your password.</translate></p>
+          <p><translate :translate-context="'Content/Signup/Paragraph'">Use this form to request a password reset. We will send an email to the given address with instructions to reset your password.</translate></p>
           <div class="field">
-            <label><translate>Account's email</translate></label>
+            <label><translate :translate-context="'Content/Signup/Input.Label'">Account's email</translate></label>
             <input
               required
               ref="email"
@@ -23,10 +23,10 @@
               v-model="email">
           </div>
           <router-link :to="{path: '/login'}">
-            <translate>Back to login</translate>
+            <translate :translate-context="'Content/Signup/Link'">Back to login</translate>
           </router-link>
           <button :class="['ui', {'loading': isLoading}, 'right', 'floated', 'green', 'button']" type="submit">
-            <translate>Ask for a password reset</translate></button>
+            <translate :translate-context="'Content/Signup/Button.Label/Verb'">Ask for a password reset</translate></button>
         </form>
       </div>
     </section>
@@ -50,9 +50,8 @@ export default {
   },
   computed: {
     labels() {
-      let reset = this.$gettext("Reset your password")
-      let placeholder = this.$gettext(
-        "Input the email address binded to your account"
+      let reset = this.$pgettext('Head/Signup/Title', "Reset your password")
+      let placeholder = this.$pgettext('Content/Signup/Input.Placeholder', "Enter the email address binded to your account"
       )
       return {
         reset,
diff --git a/front/src/views/auth/PasswordResetConfirm.vue b/front/src/views/auth/PasswordResetConfirm.vue
index df0589be..22f06ddb 100644
--- a/front/src/views/auth/PasswordResetConfirm.vue
+++ b/front/src/views/auth/PasswordResetConfirm.vue
@@ -2,34 +2,34 @@
   <main class="main pusher" v-title="labels.changePassword">
     <section class="ui vertical stripe segment">
       <div class="ui small text container">
-        <h2><translate>Change your password</translate></h2>
+        <h2><translate :translate-context="'Content/Signup/Title'">Change your password</translate></h2>
         <form v-if="!success" class="ui form" @submit.prevent="submit()">
           <div v-if="errors.length > 0" class="ui negative message">
-            <div class="header"><translate>Error while changing your password</translate></div>
+            <div class="header"><translate :translate-context="'Content/Signup/Card.Title'">Error while changing your password</translate></div>
             <ul class="list">
               <li v-for="error in errors">{{ error }}</li>
             </ul>
           </div>
           <template v-if="token && uid">
             <div class="field">
-              <label><translate>New password</translate></label>
+              <label><translate :translate-context="'Content/Signup/Input.Label'">New password</translate></label>
               <password-input v-model="newPassword" />
             </div>
             <router-link :to="{path: '/login'}">
-              <translate>Back to login</translate>
+              <translate :translate-context="'Content/Signup/Link'">Back to login</translate>
             </router-link>
             <button :class="['ui', {'loading': isLoading}, 'right', 'floated', 'green', 'button']" type="submit">
-              <translate>Update your password</translate></button>
+              <translate :translate-context="'Content/Signup/Button.Label'">Update your password</translate></button>
           </template>
           <template v-else>
-            <p><translate>If the email address provided in the previous step is valid and binded to a user account, you should receive an email with reset instructions in the next couple of minutes.</translate></p>
+            <p><translate :translate-context="'Content/Signup/Paragraph'">If the email address provided in the previous step is valid and binded to a user account, you should receive an email with reset instructions in the next couple of minutes.</translate></p>
           </template>
         </form>
         <div v-else class="ui positive message">
-          <div class="header"><translate>Password updated successfully</translate></div>
-          <p><translate>Your password has been updated successfully.</translate></p>
+          <div class="header"><translate :translate-context="'Content/Signup/Card.Title'">Password updated successfully</translate></div>
+          <p><translate :translate-context="'Content/Signup/Card.Paragraph'">Your password has been updated successfully.</translate></p>
           <router-link :to="{name: 'login'}">
-            <translate>Proceed to login</translate>
+            <translate :translate-context="'Content/Signup/Link/Verb'">Proceed to login</translate>
           </router-link>
         </div>
       </div>
@@ -59,7 +59,7 @@ export default {
   computed: {
     labels() {
       return {
-        changePassword: this.$gettext("Change your password")
+        changePassword: this.$pgettext('Head/Signup/Title', "Change your password")
       }
     }
   },
-- 
GitLab