diff --git a/openecomp-ui/tools/gulp/deployment/gulpfile.js b/openecomp-ui/tools/gulp/deployment/gulpfile.js
deleted file mode 100644
index bf127e6..0000000
--- a/openecomp-ui/tools/gulp/deployment/gulpfile.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-var gulp = require('gulp');
-var i18nUpdateTask = require('./tools/gulp/tasks/i18nUpdate');
-
-gulp.task('i18nUpdate', function() {
-
-	return i18nUpdateTask({
-		warDir: process.cwd(),
-		lang: 'en'
-	});
-});
-
-gulp.task('default', ['i18nUpdate']);
-
diff --git a/openecomp-ui/tools/gulp/deployment/package.json b/openecomp-ui/tools/gulp/deployment/package.json
deleted file mode 100644
index 5f04905..0000000
--- a/openecomp-ui/tools/gulp/deployment/package.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-  "name": "sdc-client-tools",
-  "version": "9.3.0",
-  "description": "Service Designer & Catalog Client Tools",
-  "dependencies": {},
-  "devDependencies": {
-    "bluebird": "^2.10.1",
-    "gulp": "^3.9.0",
-    "gulp-rename": "^1.2.2",
-    "gulp-replace": "^0.5.4",
-    "prompt": "^0.2.14"
-  },
-  "author": "OPENECOMP",
-  "license": "LicenseRef-LICENSE",
-  "scripts": {
-    "start": "gulp run",
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "engines": {
-    "node": ">=0.12.7",
-    "npm": ">=2.11.3"
-  }
-}
diff --git a/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js b/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js
deleted file mode 100644
index d35ae2d..0000000
--- a/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-var gulp, replace, rename, fs, prompt, Promise;
-
-function mergePromptOptions(options) {
-
-	return new Promise(function(resolve, reject) {
-		var lang = options.lang;
-		var warDir = options.warDir;
-		prompt.start();
-		prompt.get([
-			{
-				description: 'Enter war directory',
-				default: warDir,
-				name: 'warDir'
-			},
-			{
-				description: 'Enter locale.json parent directory name',
-				default: lang,
-				name: 'lang'
-			}
-		], function (err, result) {
-
-			if(err) {
-				reject(new Error('mergePromptOptions::>\n    ' + err));
-				return;
-			}
-
-			var warDir = result.warDir;
-			var lang = result.lang;
-
-			console.log('\nlocale.json parent directory name> "' + lang + '"');
-			console.log('war director>"' + warDir + '"');
-
-			resolve({
-				warDir: warDir,
-				lang: lang
-			});
-		});
-	});
-}
-
-function isBundleExists(path) {
-	return new Promise(function(resolve) {
-		fs.stat(path, function(err) {
-			resolve(null == err);
-			/*if null == err then file exists.*/
-		});
-	});
-}
-
-function copyEnglishBundle(enBundlePath, lang) {
-	return new Promise(function(resolve, reject) {
-		gulp.src(enBundlePath, {base: './'})
-			.pipe(rename({basename: 'bundle_' + lang}))
-			.pipe(gulp.dest('./'))
-			.on('end', function() {
-				resolve();
-			})
-			.on('error', function(err) {
-				reject(new Error('copyEnglishBundle::>\n    ' + err));
-			});
-	});
-}
-
-function getLocaleContent(localePath) {
-
-	return new Promise(function(resolve, reject) {
-		fs.readFile(localePath, {encoding: 'utf-8'}, function(err,data){
-			if(err) {
-				reject('getLocaleContent()::>\n    ' + err);
-				return;
-			}
-			resolve(data);
-		});
-	});
-
-}
-
-function extractLocaleJsonContent(localeDataStr) {
-
-	var localeJsonStrI18nStartIdx = localeDataStr.indexOf('I18N_IDENTIFIER_START');
-	var localeJsonStrI18nEndIdx = localeDataStr.indexOf('I18N_IDENTIFIER_END');
-
-	if(-1 === localeJsonStrI18nStartIdx || -1 === localeJsonStrI18nEndIdx) {
-		return Promise.reject(new Error('extractLocaleJsonContent::> localeDataStr must contain %I18N_IDENTIFIER_START% and %I18N_IDENTIFIER_END%'));
-	}
-
-	var localeJsonStr = localeDataStr.substring(
-		localeDataStr.indexOf('{', localeJsonStrI18nStartIdx),
-		localeDataStr.lastIndexOf('}', localeJsonStrI18nEndIdx) + 1
-	);
-
-	try {
-		JSON.parse(localeJsonStr);
-	} catch(e) {
-		return Promise.reject(new Error('extractLocaleJsonContent::> localeDataStr must contain a valid json between %I18N_IDENTIFIER_START% and %I18N_IDENTIFIER_END%=>' + e));
-	}
-
-	return Promise.resolve(localeJsonStr);
-}
-
-function setBundleLocaleContent(bundlePath, localeJsonStr) {
-	return new Promise(function(resolve, reject) {
-		gulp.src(bundlePath, {base: './'})
-			.pipe(replace(/I18N_IDENTIFIER_START(.|[\r\n])*?I18N_IDENTIFIER_END/i, function(expr) {
-				return expr.substring(0, expr.indexOf('{')) + localeJsonStr + expr.substring(expr.lastIndexOf('}') + 1);
-			}))
-			.pipe(gulp.dest('./'))
-			.on('end', function() {
-				resolve();
-			})
-			.on('error', function(err) {
-				reject(new Error('setBundleLocaleContent::>\n    ' + err));
-			});
-	});
-}
-
-
-function update(options) {
-
-	gulp = require('gulp');
-	replace = require('gulp-replace');
-	rename = require('gulp-rename');
-	fs = require('fs');
-	prompt = require('prompt');
-	Promise = require('bluebird');
-
-	return mergePromptOptions(options).then(function(mergedOptions) {
-		var lang = mergedOptions.lang;
-		var warDir = mergedOptions.warDir;
-
-		var bundlePath = warDir + '/js/bundle_' + lang + '.js';
-		var localePath = warDir + '/i18n/' + lang + '/locale.json';
-
-		return isBundleExists(bundlePath)
-			.then(function(isBundleExist) {
-				var englishBundlePath;
-				if(!isBundleExist) {
-					englishBundlePath = warDir + '/js/bundle_en.js';
-					return copyEnglishBundle(englishBundlePath, lang);
-				}
-			})
-			.then(getLocaleContent.bind(null, localePath))
-			.then(extractLocaleJsonContent)
-			.then(setBundleLocaleContent.bind(null, bundlePath));
-	});
-
-}
-
-
-
-module.exports = update;
\ No newline at end of file
diff --git a/openecomp-ui/tools/gulp/tasks/i18n.js b/openecomp-ui/tools/gulp/tasks/i18n.js
index a17e846..85d5c37 100644
--- a/openecomp-ui/tools/gulp/tasks/i18n.js
+++ b/openecomp-ui/tools/gulp/tasks/i18n.js
@@ -17,56 +17,13 @@
 var fs = require('fs');
 var replace = require('gulp-replace');
 var clean = require('gulp-clean');
-var mkdirp = require('mkdirp');
-
-/**
- *
- * @param options.localesPath
- * @param options.lang = options.lang
- *
- * @returns {string}
- */
-function composeLocalesDirPath(options) {
-	return options.localesPath + options.lang;
-}
-
-/**
- *
- * @param options.localesPath
- * @param options.lang
- *
- * @returns {string}
- */
-function composeLocaleFilePath(options) {
-	return composeLocalesDirPath(options) + '/locale.json';
-}
-
-
-/**
- *
- * @param options.localesPath
- * @param options.lang = options.lang
- */
-function ensureLocalesDir(options) {
-
-	return new Promise(function (resolve, reject) {
-		mkdirp(composeLocalesDirPath(options), function (err) {
-			if (err) {
-				reject(err);
-			}
-			else {
-				resolve();
-			}
-		});
-	});
-}
-
+var tap = require('gulp-tap');
 /**
  *
  * @param options
- * @param options.outputPath
- * @param options.localesPath
- * @param options.lang = options.lang
+ * @param options.outDir
+ * @param options.srcDir
+ * @param options.i18nBundles - optional. if given will check the that all keys from js are mapped
  *
  */
 function i18nTask(options) {
@@ -75,31 +32,66 @@
 
 	function addWord(expr) {
 		var word = expr.substring('i18n(\''.length, expr.length - 1);
-		i18nJson[word] = word;
+		if (word !== '') {
+			i18nJson[word] = word;
+		}
 		return expr;
 	}
 
-	return ensureLocalesDir(options).then(function () {
-		return new Promise(function(resolve, reject) {
-			gulp.src(options.outputPath + '**/*.js', {base: './'})
-				.pipe(replace(/i18n\('.*?'/g, addWord))
-				.pipe(clean())
-				.pipe(gulp.dest('./'))
-				.on('end', function () {
-
-					var i18nJsonWrapper = { dataWrapperArr: ["I18N_IDENTIFIER_START", i18nJson, "I18N_IDENTIFIER_END"] , i18nDataIdx: 1};
-
-					fs.writeFile(composeLocaleFilePath(options), JSON.stringify(i18nJsonWrapper), function (err) {
+	let createBundle = new Promise(function(resolve, reject) {
+		gulp.src(options.srcDir + '**/*.{js,jsx}', {base: './'})
+			.pipe(replace(/i18n\('.*?'/g, addWord))
+			.pipe(clean())
+			.pipe(gulp.dest('./'))
+			.on('end', function () {
+				console.log('Retrieved keys from static references.');
+				if (options.i18nBundles === undefined) {
+					// creating the file from the words saved during the replace
+					let outfile = options.outDir + '/bundleForStaticKeys.json';
+					fs.writeFile(outfile,JSON.stringify(i18nJson, null, '\t'), function (err) {
 						if (err) {
 							reject(err);
 						}
 						else resolve();
 					});
-				}).on('error', function (err) {
-				reject(err);
-			});
+					console.log('Bundle with static keys was created under: ' + outfile);
+				}
+				resolve();
+			}).on('error', function (err) {
+			reject(err);
 		});
 	});
+
+
+	if (options.i18nBundles === undefined) {
+		return createBundle;
+	} else {
+		return createBundle.then(() => {
+			new Promise(function (resolve, reject) {
+				gulp.src(options.i18nBundles)
+					.pipe(tap(function (file) {
+						console.log('Checking against bundle: ' + file.path);
+						let bundle = JSON.parse(file.contents.toString());
+						for (entry in i18nJson) {
+							if (!bundle[entry]) {
+								console.log('Missing Key: ' + entry);
+							} else {
+								delete bundle[entry];
+							}
+						}
+						for (entry in bundle) {
+							console.log('Unused in static files: ' + entry);
+						}
+					}))
+					.pipe(gulp.dest('./'))
+					.on('end', function () {
+						console.log('done');
+					}).on('error', function (err) {
+					reject(err);
+				});
+			});
+		});
+	}
 }
 
 module.exports = i18nTask;
diff --git a/openecomp-ui/tools/gulp/tasks/prod.js b/openecomp-ui/tools/gulp/tasks/prod.js
index cb6e251..509bec8 100644
--- a/openecomp-ui/tools/gulp/tasks/prod.js
+++ b/openecomp-ui/tools/gulp/tasks/prod.js
@@ -15,65 +15,51 @@
  */
 'use strict';
 
-let gulp, replace, Promise, webpack, webpackProductionConfig;
+let gulp, replace, Promise, webpack, webpackProductionConfig,cloneDeep, tap;
+let langs = [];
 
-const supportedLanguages = ['en'];
-
-function start(options) {
-
-	let promises = [buildIndex(options)];
-	supportedLanguages.forEach(function (lang) {
-		promises.push(bundleJS(options, lang));
-	});
-	return Promise.all(promises);
-}
-
-function bundleJS(options, lang) {
+/*
+Runs the webpack build.
+Will first seach for the resource bundles to see how many languages are supported and then run a build per langauage
+ */
+function buildWebPackForLanguage(prodConfig, lang) {
 	return new Promise(function (resolve, reject) {
-		let prodConfig = webpackProductionConfig;
-		prodConfig.resolve.alias.i18nJson = options.outDir + '/i18n/' + lang + '/locale.json';
-		prodConfig.output.filename = jsFileByLang(options.outFileName, lang);
 		webpack(prodConfig, function (err, stats) {
-			console.log('[webpack:build]', stats.toString());
+			console.log('[webpack:build ' + prodConfig.output.filename + ']', stats.toString());
 			if (err || stats.hasErrors()) {
-				console.log('bundleJS : Failure!!', '\n		-language: ', lang);
+				console.log('webpack:build : Failure!! ' + prodConfig.output.filename + ']');
 				reject(err || stats.toJson().errors);
 			}
 			else {
-				console.log('bundleJS : Done', '\n		-language: ', lang);
+				console.log('webpack:build : Done ' + prodConfig.output.filename + ']');
 				resolve();
 			}
 		});
 	});
 }
-
-function buildIndex(options) {
-
-	return new Promise(function (resolve, reject) {
-
-		// gulp.src returns a stream object
-		gulp.src(options.outDir + '/index.html')
-			.pipe(replace(/\/\/<!--prod:delete-->(.|[\r\n])*?<!--\/prod:delete-->/g, ''))//in script occurrences.
-			.pipe(replace(/<!--prod:delete-->(.|[\r\n])*?<!--\/prod:delete-->/g, ''))//out of script occurrences.
-			.pipe(replace(/<!--prod:add(-->)?/g, ''))
-			.pipe(replace(/\/\/<!--prod:supported-langs-->(.|[\r\n])*?<!--\/prod:supported-langs-->/g, supportedLanguages.map(function (val) {
-				return "'" + val + "'";
-			}).toString()))
+/*
+ // this will check in the src directory which language bundles we have and will
+ // create the array to that we can run a webpack build per language afterwards
+ */
+function getSupportedLanguages(options) {
+	return new Promise((resolve, reject) => {
+		gulp.src(options.i18nBundles)
+			.pipe(tap(function(file) {
+				let languageStartIndex = file.path.lastIndexOf('i18n') + 5;
+				let languageStr =  file.path.indexOf('.json') - languageStartIndex;
+				let currentLang = file.path.substr(languageStartIndex, languageStr);
+				console.log('Found bundle ' +  file.path + ' for [' + currentLang  + ']');
+				langs[currentLang] = file.path;
+			}))
 			.pipe(gulp.dest(options.outDir))
 			.on('end', function () {
-				console.log('buildIndex : Done');
 				resolve();
 			})
 			.on('error', function (e) {
-				console.log('buildIndex : Failure!!');
+				console.log('getLanguages : Failure!!');
 				reject(e);
 			});
 	});
-
-}
-
-function jsFileByLang(fileName, lang) {
-	return fileName.replace(/.js$/, '_' + lang + '.js');
 }
 
 /**
@@ -85,22 +71,27 @@
 	replace = require('gulp-replace');
 	Promise = require('bluebird');
 	webpack = require('webpack');
+	cloneDeep = require('lodash/cloneDeep');
+	tap = require('gulp-tap');
 
+
+	// updating webpack for the production build. no need for sourcemaps in this case.
 	webpackProductionConfig = require('../../../webpack.production');
-	webpackProductionConfig.module.rules = webpackProductionConfig.module.rules.filter(rule => ((rule.enforce !== 'pre') || (rule.enforce === 'pre' && rule.loader !== 'source-map-loader')));
-	webpackProductionConfig.module.rules.forEach(loader => {
-		if (loader.use && loader.use[0].loader === 'style-loader') {
-			loader.use = loader.use.map(loaderObj => loaderObj.loader.replace('?sourceMap', ''));
+
+	// get the languages so that we can bulid per language with the correct bundle
+	let getLanguages =getSupportedLanguages(options);
+	// this will run a webpack build per language
+	return getLanguages.then(() => {
+		let promises = [];
+		for (var lang in langs) {
+			let prodConfig = cloneDeep(webpackProductionConfig);
+			prodConfig.resolve.alias.i18nJson = langs[lang];
+			prodConfig.output.filename = (options.outFileName || '[name].js').replace(/.js$/, '_' + lang + '.js');
+			promises.push(buildWebPackForLanguage(prodConfig, lang));
 		}
+		return Promise.all(promises);
 	});
 
-
-	webpackProductionConfig.module.rules.push({test: /config.json$/, use: [{loader:'config-json-loader'}]});
-
-	return start({
-		outFileName: options.outFileName || '[name].js',
-		outDir: options.outDir
-	});
 }
 
 module.exports = prodTask;
