@@ -285,8 +285,12 @@ function validateCourse(data, cb) {
285285 let components = data . component ;
286286
287287 if ( typeof contentObjects === 'undefined' ) {
288- let courseString = app . polyglot . t ( 'app.course' ) . charAt ( 0 ) . toUpperCase ( ) + app . polyglot . t ( 'app.course' ) . slice ( 1 ) ;
289- errors += courseString + ' "' + data . course [ 0 ] . title + '" ' + app . polyglot . t ( 'app.doesnotcontain' ) + ' ' + app . polyglot . t ( 'app.page' ) + 's\n' ;
288+ let courseString = app . polyglot . t ( 'app.course' ) ;
289+ errors += app . polyglot . t ( 'app.doesnotcontain' , {
290+ type : courseString [ 0 ] . toUpperCase ( ) + courseString . slice ( 1 ) ,
291+ title : data . course [ 0 ] . title ,
292+ childType : app . polyglot . t ( 'app.page' , 0 )
293+ } ) + '\n' ;
290294 return cb ( errors , false ) ;
291295 }
292296
@@ -302,13 +306,17 @@ function validateCourse(data, cb) {
302306function iterateThroughChildren ( parents , children ) {
303307 let errors = '' ;
304308 parents . forEach ( parent => {
305- let parentType = app . polyglot . t ( 'app.' + parent . _type ) . charAt ( 0 ) . toUpperCase ( ) + app . polyglot . t ( 'app.' + parent . _type ) . slice ( 1 ) ;
309+ let parentType = app . polyglot . t ( 'app.' + parent . _type , 1 ) ;
306310 let childType = app . polyglot . t ( 'app.children' ) ;
307- if ( children [ 0 ] && children [ 0 ] . _type ) childType = app . polyglot . t ( 'app.' + children [ 0 ] . _type ) + 's' ;
311+ if ( children [ 0 ] && children [ 0 ] . _type ) childType = app . polyglot . t ( 'app.' + children [ 0 ] . _type , 0 ) ;
308312 let found = children . find ( child => JSON . stringify ( child . _parentId ) === JSON . stringify ( parent . _id ) ) ;
309313
310314 if ( typeof found === 'undefined' ) {
311- errors += parentType + ' "' + parent . title + '" ' + app . polyglot . t ( 'app.doesnotcontain' ) + ' ' + childType + '\n' ;
315+ errors += app . polyglot . t ( 'app.doesnotcontain' , {
316+ type : parentType [ 0 ] . toUpperCase ( ) + parentType . slice ( 1 ) ,
317+ title : parent . title ,
318+ childType : childType
319+ } ) + '\n' ;
312320 }
313321 } ) ;
314322 return errors ;
0 commit comments