Skip to content

Commit

Permalink
cross-platform path resolution for locale name (added path module)
Browse files Browse the repository at this point in the history
  • Loading branch information
theodoregold committed Nov 28, 2015
1 parent e2c74ad commit a628954
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"dependencies": {
"gulp-util": "^3.0.6",
"path": "^0.12.7",
"s18n": "^2.0.0",
"through2": "^2.0.0"
},
Expand Down

0 comments on commit a628954

Please sign in to comment.