[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Currently in order to specify alias for component scope translations you have to do it in main APP module's TRANSLOCO_CONFIG object. This means that every time you add or remove component with it's own scope, you have to keep in mind that you have to update another file, which has nothing to do with component itself.
What I propose, is to be able to define scope alias on component level. We think it will make the whole process much easier and will avoid repetitions in the code.
For bug reports please provide the _STEPS TO REPRODUCE_ and if possible a _MINIMAL DEMO_ of the problem, for that you could use our stackblitz example
Right now we keep translation files in the same folder with components, each component has its own translation files - to keep components as self contained as possible. So it would be much easier to specify scope alias within component itself rather than going to APP module every time you create/remove a component.
And in general we think it will be much easier, not only in our case.
I've implemented the test version of this feature which is backwards compatible.
Please have a look at: https://github.com/zufarzhan/transloco/tree/feat/scope-alias
Let me know what you think about this feature, and maybe I should finish it and make a PR?
P.S. Another thing I noticed: when you specify scope on module level, then specify scope on component level which is part of the module, you get error if you try using translations from module scope level. So maybe it's better to mention it in the doc or maybe handle it somehow in the code?
Angular version: 7.2.0
Browser:
- [x] Chrome (desktop) version 76
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 10.16.1
- Platform: MacOS 10.14.6
Others:
@zufarzhan Would you like to open a PR for it?
@shaharkazaz sure, will do it a bit later :)
Added in #100 published in v2.1.0, @zufarzhan thanks 馃帀
Most helpful comment
Added in #100 published in v2.1.0, @zufarzhan thanks 馃帀