Add placeholder translation for empty title and description
authorymh <ymh.work@gmail.com>
Tue, 04 Dec 2018 18:56:31 +0100
changeset 192 e4c2c1919c20
parent 191 3f71ad81a5a9
child 193 99e342f9fb0c
Add placeholder translation for empty title and description
client/src/components/SessionForm.js
client/src/locales/en/translation.json
client/src/locales/fr/translation.json
--- a/client/src/components/SessionForm.js	Tue Dec 04 18:17:56 2018 +0100
+++ b/client/src/components/SessionForm.js	Tue Dec 04 18:56:31 2018 +0100
@@ -4,6 +4,8 @@
 import * as sessionsActions from '../actions/sessionsActions';
 import * as authActions from '../actions/authActions';
 import _ from 'lodash';
+import { withNamespaces } from 'react-i18next';
+
 
 class SessionForm extends Component {
 
@@ -113,13 +115,15 @@
 
   titleEditMode = () => {
 
+    const t = this.props.t;
+
     if (this.state.titleEditMode === false) {
       return (
       <div
         onClick={this.toggleOnTitleEditMode}
         className='session-page-title border-0 bg-irinotes-headers text-muted ml-3'
       >
-        { this.props.currentSession.title || <span className='session-placeholder'>Espace titre</span> }
+        { this.props.currentSession.title || <span className='session-placeholder'>{ t('session_form.empty_title_placeholder') }</span> }
       </div>
     );
     }
@@ -133,7 +137,7 @@
         type="textarea"
         name="title"
         defaultValue={ this.props.currentSession.title }
-        placeholder="Espace titre"
+        placeholder={ t('session_form.empty_title_placeholder') }
         ref={title => this.title = title}
       ></textarea>
     </div>
@@ -143,13 +147,15 @@
 
   descriptionEditMode = () => {
 
+  const t = this.props.t;
+
   if (this.state.descriptionEditMode === false) {
     return (
     <div
       onClick={this.toggleOnDescriptionEditMode}
       className="session-page-description border-0 bg-irinotes-headers text-muted ml-3"
     >
-      { this.props.currentSession.description || <span className='session-placeholder'>Espace description</span> }
+      { this.props.currentSession.description || <span className='session-placeholder'>{ t('session_form.empty_description_placeholder') }</span> }
     </div>
   );
   }
@@ -163,7 +169,7 @@
         type="textarea"
         name="description"
         defaultValue={ this.props.currentSession.description }
-        placeholder="Espace description"
+        placeholder={ t('session_form.empty_description_placeholder') }
         ref={desc => this.desc = desc}
       ></textarea>
     </div>
@@ -214,4 +220,4 @@
   }
 }
 
-export default connect(mapStateToProps, mapDispatchToProps)(SessionForm);
+export default withNamespaces()(connect(mapStateToProps, mapDispatchToProps)(SessionForm));
--- a/client/src/locales/en/translation.json	Tue Dec 04 18:17:56 2018 +0100
+++ b/client/src/locales/en/translation.json	Tue Dec 04 18:56:31 2018 +0100
@@ -23,6 +23,10 @@
         "no_session": "you didn't create any session.",
         "delete_modal_message": "Delete this session?"
     },
+    "session_form": {
+        "empty_title_placeholder": "Empty title",
+        "empty_description_placeholder": "Empty description"
+    },
     "notes_list": {
         "delete_note_msg": "Delete this note?"
     },
--- a/client/src/locales/fr/translation.json	Tue Dec 04 18:17:56 2018 +0100
+++ b/client/src/locales/fr/translation.json	Tue Dec 04 18:56:31 2018 +0100
@@ -26,6 +26,10 @@
         "no_session": "vous n'avez créé aucune session pour le moment",
         "delete_modal_message": "Supprimer cette session ?"
     },
+    "session_form": {
+        "empty_title_placeholder": "Titre vide",
+        "empty_description_placeholder": "Description vide"
+    },
     "slate_editor": {
         "press_enter_msg": "Appuyer sur <1>Entrée</1> pour ajouter une note",
         "placeholder": "Votre espace de prise de note..."