-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use keys-manager tools with a built angular project folder passed as input option #38
Comments
Hi, At this moment I added modification to handle keys detection used in template (HTML) inside a built angular project folder thanks to the Concerning keys used in TypeScript files, it seems to be a bit more complicated because it will not be possible to reuse the TSExtractor. @shaharkazaz, let me know your feeling about it 😉. |
@pedraldo Hi, great to see that you are developing this feature! |
@shaharkazaz Yes exactly ! |
@pedraldo why not create the keys from the uncompiled version and just add the file at the end? |
@shaharkazaz I don't understand what you mean by adding the file at the end ? The thing that could be possible would be :
And finally I could access to the library translation keys from the project that uses the library as a node_module, and compare with its own keys, but with that solution I couldn't use one of the transloco-keys-manager tools (?!) ... I could try this, it would be easier ... To be clearer, if myNgApp has myNgLib as a node module dependency, with that "build flow" I could try to compare translation keys of myNgApp/src/assets/i18n and translation keys of myNgApp/node_modules/myNgLib/i18n ... |
I'm submitting a...
Current behavior
My team and I develop angular libraries (let's take one as an example and call it ngLib) that use Transloco very well (congrats for your job btw 👍 ).
We published this library in our private npm repository.
Then we install ngLib in a classic angular project (call it ngClassic) via npm. So ngLib is a dependency of ngClassic (a node module).
We define JSON translation files inside ngClassic and ngLib consumes correctly translation files and display well translations thanks to a Transloco Root Module well configured in ngLib.
But the thing is that we can't use transloco-keys-manager tools in ngClassic project.
Actually, it's not possible to check keys defined in ngClassic and used in its ngLib dependency (node module).
This is due to the fact that ngLib dependency is build and so translations (template or typescript) are included in generated js files (for typescript translations) and apparently the ***.metadata.json file (for template translation).
IMPORTANT THING
In reality, in my team project, we will have multiple ngClassic projects. Each will use (or not) ngLib libraries we develop in different ways. It means that each ngClassic project has same translation files structure (= same keys) but not same translations.
SO : We can't have a single angular project with all libraries inside.
Expected behavior
It could be awesome if transloco-keys-manager tools could detect translation keys of a built angular project (in my case build angular library project).
Minimal reproduction of the problem with instructions
First possibility : Create an angular project with a library, install and configure transloco, add some tranlsations in JSON files and use it on template / typescript files.
Create a classic angular project that will have in dependency the previous angular library created (for that use
npm link
). Install transloco-keys-manager and configure it to check the node module library files in input of extract / find script.Second possibity : Create a classic angular project, install and configure transloco, add some tranlsations in JSON files and use it on template / typescript files. Build it with
ng build --prod
. Install transloco-keys-manager and configure it to check the build result indist
project root folder as the input of extract / find script.What is the motivation / use case for changing the behavior?
The main goal of the request is to allow keys checking and extraction in an angular project where its translation files are consumed by a an angular library dependency (node module).
Today, if we want to use transloco-keys-manager, we have to use it in the ngLib project :
But if all keys checking is ok, then we have to manually copy JSON translation files from ngLib to ngClassic.
Environment
Anyway, thank you for your excellent work on Transloco and its tools 👍
The text was updated successfully, but these errors were encountered: