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

Disable line numbers #27

Open
pronebird opened this issue Apr 9, 2019 · 6 comments
Open

Disable line numbers #27

pronebird opened this issue Apr 9, 2019 · 6 comments

Comments

@pronebird
Copy link

Hi,

Is it possible to disable the output of line numbers in references field? The idea behind is to reduce the amount of noise in gettext catalogues because our codebase changes a lot but translations normally remain the same, so when running the gettext-extractor we get a dirty git because of the line numbers change.

@lukasgeiter
Copy link
Owner

Currently this is not possible, but I will consider implementing it in the next feature release.

@pronebird
Copy link
Author

@lukasgeiter a little input on this: we could also implement a feature to disable file references at once, not just line numbers 👍

@lukasgeiter
Copy link
Owner

Sure thing, that should be easy to implement 🙂

@pronebird
Copy link
Author

pronebird commented Apr 25, 2019

The workaround that I use for now (taking advantage of mutability and object references, which is not really cool but easier than parsing POT line-by-line)

// clean file references
extractor.getMessages().forEach((msg) => {
  msg.references = [];
});
extractor.savePotFile(outputPotFile);

@fatihacet
Copy link

Nice workaround from @pronebird 👍

msg.references = []; will completely delete the file reference comment. If you only want to delete the line number which is usually the reason for conflicts, you can do:

extractor.getMessages().forEach((msg) => {
  msg.references = msg.references.map((ref) => {
    return ref.replace(/:([^:]+)$/, '');
  });
});

@kreba
Copy link

kreba commented May 16, 2024

And you'd probably want to remove duplicated file names after that.

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

4 participants