lib/index.js
function writeLocales (locales, params, callback) {
  try {
    var jsonPath, json;
    for (var key in locales) {
      if (locales.hasOwnProperty(key)) {
        json = locales[key];
        jsonPath = path.join(params.dirPath, json.localeName, 'messages.json');

        // remove empty messages
        for (var msg_key in json.messages) {
          if (json.messages.hasOwnProperty(msg_key)) {
            if (json.messages[msg_key]['message'] == undefined) {
              delete json.messages[msg_key];
            }
          }
        }

        fs.outputJsonSync(jsonPath, json.messages);
        if (params.debug) {
          log('Created file', jsonPath, json.messages);
        }
      }
    }
    callback(null);
  } catch (err) {
    callback(err);
  }
}
function writeLocales (locales, params, callback) {
  try {
    var jsonPath, json;
    for (var key in locales) {
      if (locales.hasOwnProperty(key)) {
        json = locales[key];
        jsonPath = path.join(params.dirPath, json.localeName, 'messages.json');

        // remove empty messages
        for (var msg_key in json.messages) {
          if (json.messages.hasOwnProperty(msg_key)) {
            if (json.messages[msg_key]['message'] == undefined) {
              delete json.messages[msg_key];
            }
          }
        }

        fs.outputJsonSync(jsonPath, json.messages);
        if (params.debug) {
          log('Created file', jsonPath, json.messages);
        }
      }
    }
    callback(null);
  } catch (err) {
    callback(err);
  }
}
function writeLocales ( locales , params , callback ) { try { var jsonPath , json ; for ( var key in locales ) { if ( locales . hasOwnProperty ( key ) ) { json = locales [ key ] ; jsonPath = path . join ( params . dirPath , json . localeName , 'messages.json' ) ; // remove empty messages for ( var msg_key in json . messages ) { if ( json . messages . hasOwnProperty ( msg_key ) ) { if ( json . messages [ msg_key ] [ 'message' ] == undefined ) { delete json . messages [ msg_key ] ; } } } fs . outputJsonSync ( jsonPath , json . messages ) ; if ( params . debug ) { log ( 'Created file' , jsonPath , json . messages ) ; } } } callback ( null ) ; } catch ( err ) { callback ( err ) ; } }
Writes locales to a file system
@param {object} locales
@param {object} params
@param {function} callback
Writes locales to a file system