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 #134

Closed
wants to merge 7 commits into 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 2 commits August 7, 2019 11:24
* add preprocessKey method to parserInterface
* refcator cli.ts to load parser and compilers impls with IoC
@ebottacin ebottacin marked this pull request as ready for review August 7, 2019 10:22
@ebottacin
Copy link
Author

I'm closing this PR because the source branch is wrong, new PR (#136) replace this with correct branch

@ebottacin ebottacin closed this Aug 20, 2019
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