@@ -813,7 +813,7 @@ function addPackage (plugin, packageInfo, options, cb) {
813813 if ( results && 0 !== results . length ) {
814814 // don't add duplicate
815815 if ( options . strict ) {
816- return addCb ( new PluginPackageError ( "Can't add plugin: plugin already exists!" ) ) ;
816+ return addCb ( new PluginPackageError ( app . polyglot . t ( 'app.versionexists' ) ) ) ;
817817 }
818818 return addCb ( null ) ;
819819 }
@@ -1058,7 +1058,7 @@ function handleUploadedPlugin (req, res, next) {
10581058
10591059 var file = files . file ;
10601060 if ( ! file || ! file . path ) {
1061- return next ( new PluginPackageError ( 'File upload failed!' ) ) ;
1061+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.fileuploaderror' ) ) ) ;
10621062 }
10631063
10641064 // try unzipping
@@ -1104,17 +1104,19 @@ function handleUploadedPlugin (req, res, next) {
11041104
11051105 } , function ( hasResults ) {
11061106 if ( ! hasResults ) {
1107- 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. ') ) ;
1107+ return next ( app . polyglot . t ( 'app.cannotfindbower ') ) ;
11081108 }
11091109
11101110 if ( ! packageJson ) {
1111- return next ( new PluginPackageError ( 'Unrecognized plugin - a plugin should have a bower.json file ') ) ;
1111+ return next ( app . polyglot . t ( 'app.unrecognisedplugin ') ) ;
11121112 }
11131113
11141114 // extract the plugin type from the package
11151115 var pluginType = extractPluginType ( packageJson ) ;
11161116 if ( ! pluginType ) {
1117- return next ( new PluginPackageError ( 'Unrecognized plugin type for package ' + packageJson . name ) ) ;
1117+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.unrecognisedpluginforpackage' , {
1118+ package : packageJson . name
1119+ } ) ) ) ;
11181120 }
11191121
11201122 // mark as a locally installed package
@@ -1132,7 +1134,9 @@ function handleUploadedPlugin (req, res, next) {
11321134 }
11331135 // Check if the framework has been defined on the plugin and that it's not compatible
11341136 if ( packageInfo . pkgMeta . framework && ! semver . satisfies ( semver . clean ( frameworkVersion ) , packageInfo . pkgMeta . framework , { includePrerelease : true } ) ) {
1135- return next ( new PluginPackageError ( 'This plugin is incompatible with version ' + frameworkVersion + ' of the Adapt framework' ) ) ;
1137+ return next ( new PluginPackageError ( app . polyglot . t ( 'app.incompatibleframework' , {
1138+ framework : frameworkVersion
1139+ } ) ) ) ;
11361140 }
11371141 app . contentmanager . getContentPlugin ( pluginType , function ( error , contentPlugin ) {
11381142 if ( error ) {
@@ -1145,10 +1149,9 @@ function handleUploadedPlugin (req, res, next) {
11451149
11461150 function sendResponse ( ) {
11471151 res . statusCode = 200 ;
1148- return res . json ( {
1149- success : true ,
1150- pluginType : pluginType ,
1151- message : 'successfully added new plugin'
1152+ return res . json ( {
1153+ success : true ,
1154+ pluginType : pluginType
11521155 } ) ;
11531156 }
11541157
0 commit comments