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

Make Parsers and Compilers configurable #136

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ebottacin
Copy link

My Goal is to extend ngx-translate-extract to use as a library using my custom implementantion of Parsers and compilers that extends the standard implementations.

I've added a method to ParserInterface (preprocessKeys) in order to rewrite extracted keys before adding them to TranslateCollection. In the standard Parser the method implementation simply return the input.

In order to load my custom implementations i've used InversifyJS: the default implementations is still the same but i can write my custom app with ngx-translate-extract as dependency and plug my custom implementations.

this is done by adding to cli.js some configuration lines

`#! /usr/bin/env node

//need to be imported once per application: @see inversify/InversifyJS#262 (comment)
let reflectMetadata = require('reflect-metadata');

//IoC configuration: imported here to allow redefintion for usage as library
let inversifyConfig = require('../dist/ioc/inversify.config');

let inversifyConfigParsers = require('../dist/ioc/inversify.config.parsers.custom-impl');

let container = inversifyConfig.default;
inversifyConfigParsers.configParsers(container); // load custom parsers
inversifyConfigParsers.configCompilers(container); // load custom compilers

let cli = require('../dist/cli/cli');

cli.extractTask.execute();
`

Do you think it's possible to merge this?

Enrico Bottacin and others added 7 commits August 7, 2019 11:24
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

Successfully merging this pull request may close these issues.

1 participant