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

Custom parser e.g. JSON #69

Open
sfc-gh-kbregula opened this issue Aug 8, 2024 · 0 comments
Open

Custom parser e.g. JSON #69

sfc-gh-kbregula opened this issue Aug 8, 2024 · 0 comments

Comments

@sfc-gh-kbregula
Copy link

sfc-gh-kbregula commented Aug 8, 2024

Hello,

I am working on a website, parts of it are downloaded and saved as JSON, and then the server loads and displays them.

However, I want the titles and short descriptions to be translated, so I wrote a JsonParser and JSPN Path Extractor that reads a JSON file and then extracts messages.

Its usage looks like below:

JsonParser.createFromExtractor(extractor, [
  JsonExtractors.jsonPath('$..title'),
  JsonExtractors.jsonPath('$..summary'),
]).parseFilesGlob('./generated/**/*.json');

Unfortunately while implementing I noticed that the Parser class is not public.

For now I have a workaround:

const { Parser } = require('gettext-extractor/dist/parser');

Ideally, this class would be public and I could import it directly from the package.

Best regards,
Kamil Breguła

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant