Skip to content

Custom parser e.g. JSON #69

@sfc-gh-kbregula

Description

@sfc-gh-kbregula

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions