index.js
function replace(file, options) {
  var contents = file.contents;
  var copied = 0;

  var processed = translate(options, contents, copied, file.path);

  var files = [];
  for (var lang in processed) {
    var params = {};
    params.ext = path.extname(file.path).substr(1);
    params.name = path.basename(file.path, path.extname(file.path));
    params.path = file.path.substring(file.base.length, file.path.lastIndexOf(path.sep));
    params.lang = lang;

    var filePath = options.filename;
    for (var param in params) {
      filePath = filePath.replace('${' + param + '}', params[param]);
    }
    filePath = path.join(file.base,filePath);

    var newFile = new gutil.File({
      base: file.base,
      cwd: file.cwd,
      path: filePath,
      contents: new Buffer(processed[lang], 'utf8')
    });
    files.push(newFile);
  }

	return files;
}
function replace(file, options) {
  var contents = file.contents;
  var copied = 0;

  var processed = translate(options, contents, copied, file.path);

  var files = [];
  for (var lang in processed) {
    var params = {};
    params.ext = path.extname(file.path).substr(1);
    params.name = path.basename(file.path, path.extname(file.path));
    params.path = file.path.substring(file.base.length, file.path.lastIndexOf(path.sep));
    params.lang = lang;

    var filePath = options.filename;
    for (var param in params) {
      filePath = filePath.replace('${' + param + '}', params[param]);
    }
    filePath = path.join(file.base,filePath);

    var newFile = new gutil.File({
      base: file.base,
      cwd: file.cwd,
      path: filePath,
      contents: new Buffer(processed[lang], 'utf8')
    });
    files.push(newFile);
  }

	return files;
}
function replace ( file , options ) { var contents = file . contents ; var copied = 0 ; var processed = translate ( options , contents , copied , file . path ) ; var files = [ ] ; for ( var lang in processed ) { var params = { } ; params . ext = path . extname ( file . path ) . substr ( 1 ) ; params . name = path . basename ( file . path , path . extname ( file . path ) ) ; params . path = file . path . substring ( file . base . length , file . path . lastIndexOf ( path . sep ) ) ; params . lang = lang ; var filePath = options . filename ; for ( var param in params ) { filePath = filePath . replace ( '${' + param + '}' , params [ param ] ) ; } filePath = path . join ( file . base , filePath ) ; var newFile = new gutil . File ( { base : file . base , cwd : file . cwd , path : filePath , contents : new Buffer ( processed [ lang ] , 'utf8' ) } ) ; files . push ( newFile ) ; } return files ; }
Performs the actual replacing of tokens with translations.
@param {File} file
@param {Object} options
@returns {File[]}
Performs the actual replacing of tokens with translations .