var _ = require('underscore');
var fs = require('fs');

var intlKey = exports.intlKey = function(obj, key) {
  if (typeof obj[key] !== 'string') {
    return;
  }

  obj[key] = {
    'en_US': obj[key]
  };
  return obj;
};

var intlLevel = exports.intlLevel = function(level) {
  var keys = [
    'hint',
    'name'
  ];
  _.each(keys, function(key) {
    intlKey(level, key);
  }, this);

  return level;
};

var intlPath = exports.intlPath = function(path) {
  var level = require(path).level;
  level = intlLevel(level);

  var output = 'exports.level = ' +
    JSON.stringify(level, null, 2) +
    ';';
  fs.writeFileSync(path, output);
};

