Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force POSIX implementation for strings relative path output #622

Merged
merged 2 commits into from
May 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions i18n/babel-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

const { po } = require( 'gettext-parser' );
const { pick, reduce, uniq, forEach, sortBy, isEqual, merge, isEmpty } = require( 'lodash' );
const { relative } = require( 'path' );
const { relative, sep } = require( 'path' );
const { writeFileSync } = require( 'fs' );

/**
Expand Down Expand Up @@ -199,10 +199,12 @@ module.exports = function() {
translation.msgstr = '';
}

// Assign file reference comment
// Assign file reference comment, ensuring consistent pathname
// reference between Win32 and POSIX
const { filename } = this.file.opts;
const pathname = relative( '.', filename ).split( sep ).join( '/' );
translation.comments = {
reference: relative( process.cwd(), filename ) + ':' + path.node.loc.start.line
reference: pathname + ':' + path.node.loc.start.line
};

// If exists, also assign translator comment
Expand Down