gettext-extractor
gettext-extractor copied to clipboard
Custom parser e.g. JSON
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