From 73d10e55b36076c8d812b71b07e30e961bd26291 Mon Sep 17 00:00:00 2001 From: chrisgarrity <chrisg@media.mit.edu> Date: Wed, 27 Jun 2018 10:47:09 -0400 Subject: [PATCH] Localize how-tos title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Another approach would be to have the title be part of what’s imported from `lib/libraries/decks/index.jsx` --- src/containers/tips-library.jsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/containers/tips-library.jsx b/src/containers/tips-library.jsx index 20304cab4..4db0d0665 100644 --- a/src/containers/tips-library.jsx +++ b/src/containers/tips-library.jsx @@ -1,6 +1,7 @@ import bindAll from 'lodash.bindall'; import PropTypes from 'prop-types'; import React from 'react'; +import {injectIntl, intlShape, defineMessages} from 'react-intl'; import decksLibraryContent from '../lib/libraries/decks/index.jsx'; @@ -17,6 +18,14 @@ import { activateDeck } from '../reducers/cards'; +const messages = defineMessages({ + tipsLibraryTitle: { + defaultMessage: 'How-Tos', + description: 'Heading for the help/how-tos library', + id: 'gui.tipsLibrary.howtos' + } +}); + class TipsLibrary extends React.PureComponent { constructor (props) { super(props); @@ -45,7 +54,7 @@ class TipsLibrary extends React.PureComponent { <LibraryComponent data={decksLibraryThumbnailData} filterable={false} - title="How-Tos" + title={this.props.intl.formatMessage(messages.tipsLibraryTitle)} visible={this.props.visible} onItemSelected={this.handleItemSelect} onRequestClose={this.props.onRequestClose} @@ -55,6 +64,7 @@ class TipsLibrary extends React.PureComponent { } TipsLibrary.propTypes = { + intl: intlShape.isRequired, onActivateDeck: PropTypes.func.isRequired, onRequestClose: PropTypes.func, visible: PropTypes.bool @@ -69,7 +79,7 @@ const mapDispatchToProps = dispatch => ({ onRequestClose: () => dispatch(closeTipsLibrary()) }); -export default connect( +export default injectIntl(connect( mapStateToProps, mapDispatchToProps -)(TipsLibrary); +)(TipsLibrary)); -- GitLab