jsverse / transloco-keys-manager

🦄 The Key to a Better Translation Experience
https://github.com/jsverse/transloco/
MIT License
203 stars 49 forks source link

Bug: Read input is ignored for template comments #165

Closed zsimuno closed 3 months ago

zsimuno commented 1 year ago

Is there an existing issue for this?

Is this a regression?

Yes

Current behavior

I have a "pricing" scope and inside it I have code like this

` <div *transloco="let t; read 'pricing';">

<custom-title [title]="t('title')">

....
` When it extracts the translations the "title", "investors" and such are put properly inside pricing/en.json. These: ` ` are just poot in the root en.json file as if they have no parent. I tried even removing the other read like this: `
....
` But it still didn't put them in proper file. With this I'm basically forced to write all prefixes manually which is what I've been doing untill now but no I had like 20 of these at once an putting prefixes on the will look really ugly and unreadable. Module provider looks like this: `providers: [{provide: TRANSLOCO_SCOPE, useValue: {scope: 'pricing', alias: 'pricing'}}],` ### Expected behavior Expected that translations are put inside the pricing/en.json with proper parent file and not the root translation file. ### Please provide a link to a minimal reproduction of the bug None ### Transloco Config ```markdown keysManager: { input: ['common', 'services', 'app'], unflat: true, defaultValue: "{{key}}", } ``` ### Debug Logs ```markdown I tried this but it just said > DEBUG=* transloco-keys-manager extract 'DEBUG' is not recognized as an internal or external command, operable program or batch file. ``` ### Please provide the environment you discovered this bug in ```markdown Transloco: ^4.2.2 Transloco Keys Manager:^3.7.0 Angular: 15.2.4 Node: 18.13.0 Package Manager: npm 8.19.3 OS: win32 x64 ``` ### Additional context _No response_ ### I would like to make a pull request for this bug No
shaharkazaz commented 4 months ago

@zsimuno Please provide a reproduction link as I don't fully understand your issue.

The comments and all the other keys are not affected by the fact that you are providing a scope, it just allows the keys manager to map the keys prefixed with the scope alias to the correct files.

You pasted 2 identical template snippets:

<custom-title
[title]="t('title')">

So it's hard to understand.

Note that the debug logs didn't work as you are trying to set an environment variable using the Linux syntax

shaharkazaz commented 3 months ago

@zsimuno Feel free to reopen this with a reproduction link 👍