@@ -8,6 +8,7 @@ import threadlib from 'patchwork-threads'
8
8
import SimpleInfinite from 'patchkit-simple-infinite'
9
9
import explain from 'explain-error'
10
10
import u from 'patchkit-util'
11
+ import t from 'patchwork-translations'
11
12
12
13
// how many messages to fetch in a batch?
13
14
const DEFAULT_BATCH_LOAD_AMT = 30
@@ -83,7 +84,7 @@ export default class MsgList extends React.Component {
83
84
// toggle in the DB
84
85
ssb . patchwork . toggleBookmark ( msg . key , ( err , isBookmarked ) => {
85
86
if ( err )
86
- return events . emit ( 'error' , explain ( err , 'Failed to toggle bookmark' ) )
87
+ return events . emit ( 'error' , explain ( err , t ( 'error.toggleBookmark' ) ) )
87
88
88
89
// re-render
89
90
msg . isBookmarked = isBookmarked
@@ -104,7 +105,7 @@ export default class MsgList extends React.Component {
104
105
var voteMsg = schemas . vote ( msg . key , newVote )
105
106
let done = ( err ) => {
106
107
if ( err )
107
- return events . emit ( 'error' , explain ( err , 'Failed to publish vote' ) )
108
+ return events . emit ( 'error' , explain ( err , t ( 'error.publishVote' ) ) )
108
109
109
110
// re-render
110
111
msg . votes [ this . context . user . id ] = newVote
@@ -198,7 +199,7 @@ export default class MsgList extends React.Component {
198
199
199
200
loadingElement ( ) {
200
201
return < div className = "msg-view summary" >
201
- Loading...
202
+ { t ( ' Loading' ) }
202
203
</ div >
203
204
}
204
205
@@ -283,7 +284,7 @@ export default class MsgList extends React.Component {
283
284
pull . take ( amt ) , // apply limit
284
285
pull . collect ( ( err , msgs ) => {
285
286
if ( err )
286
- console . warn ( 'Error while fetching messages' , err )
287
+ console . warn ( t ( 'error.fetchingMessages' ) , err )
287
288
288
289
// add msgs
289
290
if ( msgs )
@@ -364,12 +365,12 @@ export default class MsgList extends React.Component {
364
365
lastDate = moment ( m . ts || m . value . timestamp ) . endOf ( 'day' )
365
366
if ( this . props . dateDividers && ! lastDate . isSame ( oldLastDate , 'day' ) ) {
366
367
let label = ( lastDate . isSame ( endOfToday , 'day' ) )
367
- ? ' today'
368
+ ? t ( 'msgs. today')
368
369
: ( lastDate . isSame ( endOfToday , 'month' ) )
369
370
? lastDate . from ( endOfToday )
370
371
: ( lastDate . isSame ( endOfToday , 'year' ) )
371
372
? lastDate . format ( "dddd, MMMM Do" )
372
- : lastDate . format ( "MMMM Do YYYY " )
373
+ : lastDate . format ( "LL " )
373
374
listEls . push ( < hr key = { m . key + '-divider' } className = "labeled" data-label = { label } /> )
374
375
}
375
376
@@ -411,12 +412,12 @@ export default class MsgList extends React.Component {
411
412
< div className = "flex-fill" >
412
413
{ TopNav ? < TopNav { ...this . props . topNavProps } /> : '' }
413
414
{ nQueued ?
414
- < a className = "new-msg-queue" onClick = { this . reload . bind ( this ) } > { nQueued } new update { u . plural ( nQueued ) } </ a >
415
+ < a className = "new-msg-queue" onClick = { this . reload . bind ( this ) } > { t ( 'msgs.newUpdates' , u . plural ( nQueued ) ) } </ a >
415
416
: '' }
416
- { this . state . msgs . length === 0 && this . state . isLoading ? < div style = { { fontWeight : 300 , textAlign : 'center' } } > Loading... </ div > : '' }
417
+ { this . state . msgs . length === 0 && this . state . isLoading ? < div style = { { fontWeight : 300 , textAlign : 'center' } } > { t ( ' Loading' ) } </ div > : '' }
417
418
{ isEmpty ?
418
419
< div className = "empty-msg" >
419
- { ( this . props . emptyMsg || 'No messages.' ) }
420
+ { ( this . props . emptyMsg || t ( 'msgs.NoMessages' ) ) }
420
421
</ div >
421
422
:
422
423
< ReactCSSTransitionGroup component = "div" transitionName = "fade" transitionAppear = { true } transitionAppearTimeout = { 500 } transitionEnterTimeout = { 500 } transitionLeaveTimeout = { 1 } >
0 commit comments