@@ -5,6 +5,7 @@ import { bindActionCreators } from 'redux';
55import { Link } from 'react-router' ;
66import { Helmet } from 'react-helmet' ;
77import prettyBytes from 'pretty-bytes' ;
8+ import { withTranslation } from 'react-i18next' ;
89
910import Loader from '../../App/components/loader' ;
1011import * as AssetActions from '../actions/assets' ;
@@ -85,7 +86,7 @@ class AssetListRowBase extends React.Component {
8586 onClick = { this . toggleOptions }
8687 onBlur = { this . onBlurComponent }
8788 onFocus = { this . onFocusComponent }
88- aria-label = "Toggle Open/Close Asset Options"
89+ aria-label = { this . props . t ( 'AssetList.ToggleOpenCloseARIA' ) }
8990 >
9091 < DownFilledTriangleIcon focusable = "false" aria-hidden = "true" />
9192 </ button >
@@ -100,7 +101,7 @@ class AssetListRowBase extends React.Component {
100101 onBlur = { this . onBlurComponent }
101102 onFocus = { this . onFocusComponent }
102103 >
103- Delete
104+ { this . props . t ( 'AssetList. Delete' ) }
104105 </ button >
105106 </ li >
106107 < li >
@@ -111,7 +112,7 @@ class AssetListRowBase extends React.Component {
111112 onFocus = { this . onFocusComponent }
112113 className = "asset-table__action-option"
113114 >
114- Open in New Tab
115+ { this . props . t ( 'AssetList.OpenNewTab' ) }
115116 </ Link >
116117 </ li >
117118 </ ul > }
@@ -131,7 +132,8 @@ AssetListRowBase.propTypes = {
131132 size : PropTypes . number . isRequired
132133 } ) . isRequired ,
133134 deleteAssetRequest : PropTypes . func . isRequired ,
134- username : PropTypes . string . isRequired
135+ username : PropTypes . string . isRequired ,
136+ t : PropTypes . func . isRequired
135137} ;
136138
137139function mapStateToPropsAssetListRow ( state ) {
@@ -153,7 +155,7 @@ class AssetList extends React.Component {
153155 }
154156
155157 getAssetsTitle ( ) {
156- return 'p5.js Web Editor | My assets' ;
158+ return this . props . t ( 'AssetList.Title' ) ;
157159 }
158160
159161 hasAssets ( ) {
@@ -167,13 +169,13 @@ class AssetList extends React.Component {
167169
168170 renderEmptyTable ( ) {
169171 if ( ! this . props . loading && this . props . assetList . length === 0 ) {
170- return ( < p className = "asset-table__empty" > No uploaded assets. </ p > ) ;
172+ return ( < p className = "asset-table__empty" > { this . props . t ( 'AssetList.NoUploadedAssets' ) } </ p > ) ;
171173 }
172174 return null ;
173175 }
174176
175177 render ( ) {
176- const { assetList } = this . props ;
178+ const { assetList, t } = this . props ;
177179 return (
178180 < article className = "asset-table-container" >
179181 < Helmet >
@@ -185,9 +187,9 @@ class AssetList extends React.Component {
185187 < table className = "asset-table" >
186188 < thead >
187189 < tr >
188- < th > Name </ th >
189- < th > Size </ th >
190- < th > Sketch </ th >
190+ < th > { t ( 'AssetList.HeaderName' ) } </ th >
191+ < th > { t ( 'AssetList.HeaderSize' ) } </ th >
192+ < th > { t ( 'AssetList.HeaderSketch' ) } </ th >
191193 < th scope = "col" > </ th >
192194 </ tr >
193195 </ thead >
@@ -212,7 +214,8 @@ AssetList.propTypes = {
212214 sketchId : PropTypes . string
213215 } ) ) . isRequired ,
214216 getAssets : PropTypes . func . isRequired ,
215- loading : PropTypes . bool . isRequired
217+ loading : PropTypes . bool . isRequired ,
218+ t : PropTypes . func . isRequired
216219} ;
217220
218221function mapStateToProps ( state ) {
@@ -227,4 +230,4 @@ function mapDispatchToProps(dispatch) {
227230 return bindActionCreators ( Object . assign ( { } , AssetActions ) , dispatch ) ;
228231}
229232
230- export default connect ( mapStateToProps , mapDispatchToProps ) ( AssetList ) ;
233+ export default withTranslation ( ) ( connect ( mapStateToProps , mapDispatchToProps ) ( AssetList ) ) ;
0 commit comments