@@ -7,13 +7,19 @@ const path = require('path');
77const Promise = require ( 'bluebird' ) ;
88const moment = require ( 'moment' ) ;
99const config = require ( '../../../shared/config' ) ;
10- const i18n = require ( '../../../shared/i18n ' ) ;
10+ const tpl = require ( '@tryghost/tpl ' ) ;
1111const logging = require ( '@tryghost/logging' ) ;
1212const errors = require ( '@tryghost/errors' ) ;
1313const constants = require ( '@tryghost/constants' ) ;
1414const urlUtils = require ( '../../../shared/url-utils' ) ;
1515const StorageBase = require ( 'ghost-storage-base' ) ;
1616
17+ const messages = {
18+ imageNotFound : 'Image not found' ,
19+ imageNotFoundWithRef : 'Image not found: {img}' ,
20+ cannotReadImage : 'Could not read image: {img}'
21+ } ;
22+
1723class LocalFileStore extends StorageBase {
1824 constructor ( ) {
1925 super ( ) ;
@@ -119,7 +125,7 @@ class LocalFileStore extends StorageBase {
119125 if ( err ) {
120126 if ( err . statusCode === 404 ) {
121127 return next ( new errors . NotFoundError ( {
122- message : i18n . t ( 'errors.errors. imageNotFound' ) ,
128+ message : tpl ( messages . imageNotFound ) ,
123129 code : 'STATIC_FILE_NOT_FOUND' ,
124130 property : err . path
125131 } ) ) ;
@@ -169,7 +175,7 @@ class LocalFileStore extends StorageBase {
169175 if ( err . code === 'ENOENT' || err . code === 'ENOTDIR' ) {
170176 return reject ( new errors . NotFoundError ( {
171177 err : err ,
172- message : i18n . t ( 'errors.errors. imageNotFoundWithRef' , { img : options . path } )
178+ message : tpl ( messages . imageNotFoundWithRef , { img : options . path } )
173179 } ) ) ;
174180 }
175181
@@ -183,7 +189,7 @@ class LocalFileStore extends StorageBase {
183189
184190 return reject ( new errors . GhostError ( {
185191 err : err ,
186- message : i18n . t ( 'errors.errors. cannotReadImage' , { img : options . path } )
192+ message : tpl ( messages . cannotReadImage , { img : options . path } )
187193 } ) ) ;
188194 }
189195
0 commit comments