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

Fails to extract on Windows due to wrong path.sep used (2.4) #262

Closed
MartijnHols opened this issue Aug 9, 2018 · 3 comments
Closed

Fails to extract on Windows due to wrong path.sep used (2.4) #262

MartijnHols opened this issue Aug 9, 2018 · 3 comments

Comments

@MartijnHols
Copy link

MartijnHols commented Aug 9, 2018

Describe the bug
lingui extract returns No locales defined! when extracting messages on Windows.

To Reproduce
Run lingui extract on a Windows machine in cmd.

Additional context
The issue is that locale returned by

const [locale] = filename.split(path.sep).reverse()
contains the entire path, not just the locale name. This is because path.sep is \ while the result from glob.sync contains paths with forward slashes /. Replacing path.sep with / fixes this specific issue (but my extraction still fails because of a different error).

I would have made a PR if I didn't fear side-effects.

@MartijnHols MartijnHols changed the title Fails to extract on Windows (2.4) due to wrong path.sep used Fails to extract on Windows due to wrong path.sep used (2.4) Aug 9, 2018
@tricoder42
Copy link
Contributor

tricoder42 commented Aug 10, 2018

Hey @MartijnHols,
thank you for bug report! Don't fear side-effects at all :) Feel free to follow contributors guide, the tests should back you up.

I tried to make this method platform compatible, but didn't realize glob.sync normalize slashes...

@tricoder42
Copy link
Contributor

No worries, I'm going to release it with upcoming patch

@tricoder42 tricoder42 self-assigned this Aug 10, 2018
@tricoder42
Copy link
Contributor

Released in v2.4.1, thanks for reporting the issue!

Photonios pushed a commit to SectorLabs/js-lingui that referenced this issue Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants