diff --git a/cli.js b/cli.js
index a8eb90c31dcceb7677a8cae4f3117312adeaa7ad..a546f761d5b6cea8fcb431a24e225b0b7b7dfc6b 100755
--- a/cli.js
+++ b/cli.js
@@ -54,6 +54,7 @@ var argv = require('optimist')
   .argv;
 
 const docs = _.fromPairs(_.toPairs(argv).filter(([ key, value ]) => { return key.startsWith('link-'); }).map(([ key, value ]) => { return [ key.substr(5), value ];}));
+const i18n = require('i18n');
 
 const logger = winston.createLogger({
   level: 'info',
@@ -82,7 +83,6 @@ var schemaDir = argv.x === '-' ? '' : argv.x ? path.resolve(argv.x) : outDir;
 var target = fs.statSync(schemaPath);
 const readme = argv.n !== true;
 const schemaExtension = argv.e || 'schema.json';
-
 if (argv.s){
   ajv.addMetaSchema(require(path.resolve(argv.s)));
 }
@@ -102,6 +102,19 @@ if (argv.m) {
     }
   }
 }
+let i18nPath;
+if (argv !== undefined && argv.i !== undefined){
+  i18nPath=path.resolve(argv.i) ;
+} else {
+  i18nPath=path.resolve(path.join(__dirname, 'lib/locales'));
+}
+i18n.configure({
+  // setup some locales - other locales default to en silently
+  locales:[ 'en' ],
+  // where to store json files - defaults to './locales' relative to modules directory
+  directory: i18nPath,
+  defaultLocale: 'en'
+});
 
 logger.info('output directory: %s', outDir);
 if (target.isDirectory()) {
diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js
index 52d97faed511622fd1c0079d5f5d157b14145003..42df15b3a932a5e12f868f98adbcfe1e26bd336a 100644
--- a/lib/markdownWriter.js
+++ b/lib/markdownWriter.js
@@ -171,20 +171,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen
   };
 
   outDir = outDir ? outDir : path.resolve(path.join('.', 'out'));
-  let i18nPath;
-  if (consoleArgs !== undefined && consoleArgs.i !== undefined){
-    i18nPath=path.resolve(consoleArgs.i) ;
-  } else {
-    i18nPath=path.resolve(path.join(__dirname, 'locales'));
-  }
   console.log(filename);
-  i18n.configure({
-    // setup some locales - other locales default to en silently
-    locales:[ 'en' ],
-    // where to store json files - defaults to './locales' relative to modules directory
-    directory: i18nPath,
-    defaultLocale: 'en'
-  });
   //console.log(dependencyMap);
   // this structure allows us to have separate templates for each element. Instead of having
   // one huge template, each block can be built individually
diff --git a/lib/readmeWriter.js b/lib/readmeWriter.js
index acf4641e35c791f5f36619b49f736fba86d457f3..2d40abe1e4f79ecd4492a83256651f065416c699 100644
--- a/lib/readmeWriter.js
+++ b/lib/readmeWriter.js
@@ -35,14 +35,6 @@ function directory(full, base) {
  * @param {string} base - schema base directory
  */
 const generateReadme = function(paths, schemas, out, base) {
-  let i18nPath=path.resolve('./lib/locales');
-  i18n.configure({
-    // setup some locales - other locales default to en silently
-    locales:[ 'en' ],
-    // where to store json files - defaults to './locales' relative to modules directory
-    directory: i18nPath,
-    defaultLocale: 'en'
-  });
   const coreinfo = _.values(schemas).map(schema => {
     return {
       id: schema.jsonSchema.$id,
diff --git a/spec/lib/header.spec.js b/spec/lib/header.spec.js
index c253f401d4e27ec1a0d3a3c4b40682a9144b1259..0fcd8348ed4cf944a39e5b72114b17481834fbf7 100644
--- a/spec/lib/header.spec.js
+++ b/spec/lib/header.spec.js
@@ -7,7 +7,7 @@ beforeEach(function() {
     colors: true,
     inline: true
   }));
-  let i18nPath=path.resolve('./lib/locales');
+  let i18nPath=path.resolve(path.join(__dirname, '../../lib/locales'));
   i18n.configure({
     // setup some locales - other locales default to en silently
     locales:[ 'en' ],