-
Notifications
You must be signed in to change notification settings - Fork 30
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
Why ngx-extractor only works with plainly injected i18N instance? #47
Comments
Can we add the following code into extractor.ts
} And this piece of code to the end of the extract method: ` This will cover the code like this: |
Nice. Is there a planned release shortly to include this fix? |
I'm building a fairly complex software, https://github.com/cyclosproject/cyclos4-ui.
Initially we had thought in our own i18n solution, because we need translations in services / components. But then we found i18n-polyfill and started using it.
We were happy, and did a lot of restructuring of the code.
As components have a lot of common dependencies, we've created a base class which receives the Injector instance and gets all the services it needs. We started doing the same with
i18n
.Then I suddenly realized none of the keys in components were being catched by
ngx-extractor
, because the i18n instance was not injected directly, but obtained from the Injector.The point is: why can't the i18n instance be passed around? I guess it would work if the string is set in the xlf file, but ngx-extractor ignores them.
To my surprise, when trying to find what happened, I found this answer: #37 (comment)
The point is: why does the processor needs to work on directly injected references of i18n? Couldn't it just parse all the usages of I18N, and that's it?
The requirement that i18n MUST be injected is not documented anywhere, and is something fundamental for the extractor to work. And without the extractor working, there's no point in using i18n-polyfill...
The text was updated successfully, but these errors were encountered: