@@ -831,7 +831,7 @@ function addPackage (plugin, packageInfo, options, cb) {
831831 if ( results && 0 !== results . length ) {
832832 // don't add duplicate
833833 if ( options . strict ) {
834- return addCb ( new PluginPackageError ( "Can't add plugin: plugin already exists!" ) ) ;
834+ return addCb ( new PluginPackageError ( app . polyglot . t ( 'app.versionexists' ) ) ) ;
835835 }
836836 return addCb ( null ) ;
837837 }
@@ -1077,7 +1077,7 @@ function handleUploadedPlugin (req, res, next) {
10771077
10781078 var file = files . file ;
10791079 if ( ! file || ! file . path ) {
1080- return next ( new PluginPackageError ( 'File upload failed!' ) ) ;
1080+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.fileuploaderror' ) ) ) ;
10811081 }
10821082
10831083 // try unzipping
@@ -1123,17 +1123,19 @@ function handleUploadedPlugin (req, res, next) {
11231123
11241124 } , function ( hasResults ) {
11251125 if ( ! hasResults ) {
1126- return next ( new PluginPackageError ( 'Cannot find expected bower.json file in the plugin root, please check the structure of your zip file and try again. ') ) ;
1126+ return next ( app . polyglot . t ( 'app.cannotfindbower ') ) ;
11271127 }
11281128
11291129 if ( ! packageJson ) {
1130- return next ( new PluginPackageError ( 'Unrecognized plugin - a plugin should have a bower.json file ') ) ;
1130+ return next ( app . polyglot . t ( 'app.unrecognisedplugin ') ) ;
11311131 }
11321132
11331133 // extract the plugin type from the package
11341134 var pluginType = extractPluginType ( packageJson ) ;
11351135 if ( ! pluginType ) {
1136- return next ( new PluginPackageError ( 'Unrecognized plugin type for package ' + packageJson . name ) ) ;
1136+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.unrecognisedpluginforpackage' , {
1137+ package : packageJson . name
1138+ } ) ) ) ;
11371139 }
11381140
11391141 // mark as a locally installed package
@@ -1151,7 +1153,9 @@ function handleUploadedPlugin (req, res, next) {
11511153 }
11521154 // Check if the framework has been defined on the plugin and that it's not compatible
11531155 if ( packageInfo . pkgMeta . framework && ! semver . satisfies ( semver . clean ( frameworkVersion ) , packageInfo . pkgMeta . framework , { includePrerelease : true } ) ) {
1154- return next ( new PluginPackageError ( 'This plugin is incompatible with version ' + frameworkVersion + ' of the Adapt framework' ) ) ;
1156+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.incompatibleframework' , {
1157+ framework : frameworkVersion
1158+ } ) ) ) ;
11551159 }
11561160 app . contentmanager . getContentPlugin ( pluginType , function ( error , contentPlugin ) {
11571161 if ( error ) {
@@ -1164,10 +1168,9 @@ function handleUploadedPlugin (req, res, next) {
11641168
11651169 function sendResponse ( ) {
11661170 res . statusCode = 200 ;
1167- return res . json ( {
1168- success : true ,
1169- pluginType : pluginType ,
1170- message : 'successfully added new plugin'
1171+ return res . json ( {
1172+ success : true ,
1173+ pluginType : pluginType
11711174 } ) ;
11721175 }
11731176
0 commit comments