diff --git a/README.md b/README.md index e989f06..567c892 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ var l10n = require('gulp-l10n'); var opts = { elements: ['title', 'p', 'h1'], attributes: ['alt', 'title'], - directives: 'translate=yes' + directives: 'translate=yes', attributeSetter: 'translate-attrs' }; diff --git a/index.js b/index.js index b8a9c40..f82d062 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ var through = require('through2'); var gutil = require('gulp-util'); var s18n = require('s18n'); +var path = require('path'); var PLUGIN_NAME = 'gulp-l10n'; @@ -110,7 +111,7 @@ module.exports.setLocales = function(options) { return; } // file is buffer - var localeId = file.path.split('/').pop().split('.').shift(); + var localeId = path.basename(file.path, '.json'); var locale = JSON.parse(String(file.contents)); localeCaches[options.cacheId].locales[localeId] = locale; cb();