Skip to content

Commit

Permalink
Release 0.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
seeden committed Mar 6, 2016
1 parent fde2690 commit 689ebcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "translate-maker-loader",
"version": "0.2.9",
"version": "0.2.10",
"description": "Locale loader module for webpack",
"author": {
"name": "Zlatko Fedor",
Expand Down
13 changes: 9 additions & 4 deletions src/getLocalIdent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dropRightWhile from 'lodash/dropRightWhile';
import path from 'path';
import { interpolateName, stringifyRequest } from 'loader-utils';
import { interpolateName } from 'loader-utils';

const LOCALE_DIRNAME = 'locale';

Expand All @@ -11,13 +11,18 @@ function getPath(filepath) {
return dropRightWhile(parts, (part) => part === LOCALE_DIRNAME).join('/');
}

export default function getLocalIdent(context, filepath, type) {
export default function getLocalIdent(loaderContext, filepath, type) {
// ext is required in the interpolateName
const resourcePath = stringifyRequest(context, getPath(filepath) + '.js');
const context = loaderContext.options && typeof loaderContext.options.context === 'string'
? loaderContext.options.context
: loaderContext.context;

const filePathJS = getPath(filepath) + '.js';
const resourcePath = path.relative(context, filePathJS);

return interpolateName({
resourcePath,
}, type, {
content: filepath,
content: resourcePath,
});
}

0 comments on commit 689ebcf

Please sign in to comment.