# HG changeset patch # User ymh # Date 1543946191 -3600 # Node ID e4c2c1919c2050cd85fc7d923e67df7f31e72de4 # Parent 3f71ad81a5a9fc80d7a81cdcca478fd9570ee561 Add placeholder translation for empty title and description diff -r 3f71ad81a5a9 -r e4c2c1919c20 client/src/components/SessionForm.js --- 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 (
- { this.props.currentSession.title || Espace titre } + { this.props.currentSession.title || { t('session_form.empty_title_placeholder') } }
); } @@ -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} > @@ -143,13 +147,15 @@ descriptionEditMode = () => { + const t = this.props.t; + if (this.state.descriptionEditMode === false) { return (
- { this.props.currentSession.description || Espace description } + { this.props.currentSession.description || { t('session_form.empty_description_placeholder') } }
); } @@ -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} > @@ -214,4 +220,4 @@ } } -export default connect(mapStateToProps, mapDispatchToProps)(SessionForm); +export default withNamespaces()(connect(mapStateToProps, mapDispatchToProps)(SessionForm)); diff -r 3f71ad81a5a9 -r e4c2c1919c20 client/src/locales/en/translation.json --- 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?" }, diff -r 3f71ad81a5a9 -r e4c2c1919c20 client/src/locales/fr/translation.json --- 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 pour ajouter une note", "placeholder": "Votre espace de prise de note..."