-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Bug(scope): Transloco loads nested scopes in a wrong way. #559
Comments
I think, that the problem is in these lines: https://github.com/ngneat/transloco/blob/master/libs/transloco/src/lib/transloco.service.ts#L531 and https://github.com/ngneat/transloco/blob/master/libs/transloco/src/lib/transloco.service.ts#L792 From https://github.com/ngneat/transloco/blob/master/BREAKING_CHANGES.md |
@PavelTurkish did you get any solution on this ? I am facing the same issue |
@cs-pratap-nikam As I remember I used some workaround. But I don't remember what it was, I even don't remember the project I used it in. Sorry. |
@cs-pratap-nikam Maybe I merged some folders into one. Something like this:
But I am not sure |
@PavelTurkish thanks for the quick response. I am stuck in similar situation. I am thinking to go with camelCase approach because there are going to hundreds of such subfolders. so it will be difficult to in maintaining foo.bar structure. |
@cs-pratap-nikam You are welcome to suggest a solution and open a PR 👍 |
@shaharkazaz I added a new pull request for this here: #738 |
After revisiting this issue, from what I see, when providing |
I know you can just change it with an alias, but having it generate like "nestedScopesAdminPage" by default makes zero sense. In your scenario, nested/scopes/admin-page would make way more sense to generate like "nested.scope.adminPage". Telling people "change it if you want" is not a solution. |
@JordanW9232 makes zero sense in your opinion, if you ask someone else you might hear a different answer, Otherwise this issue would have had a lot more traffic. As stated here depending on the nesting of the scopes, things can get pretty ugly pretty fast, this goes for the camel case strategy as well. The camel case strategy is what Transloco provides OOTB, I think this is easily resolved with a pure helper function that gets a scope path and returns the scope definition: export function translocoScope(scope: string) {
return {
scope,
alias: // You define whatever you want
}
} I think that scopes are flexible enough for you to get the variation you want with very little effort. |
Is there an existing issue for this?
Which Transloco package(s) are the source of the bug?
Transloco
Is this a regression?
No
Current behavior
I have nested scope:
To load and translate via code I use translocoService:
However, when I try to translate, I get an error - Missing translation for 'foo.bar.test'. Using debugger I found out that at this line of the
TranslocoService
the following translations is returned:As it is seen instead of
"foo.bar.test": "some text"
transloco created"fooBar.test": "some text"
.Expected behavior
Transloco must create
"foo.bar.test": "some text"
instead of"fooBar.test": "some text"
.Please provide a link to a minimal reproduction of the bug
Transloco Config
No response
Please provide the environment you discovered this bug in
Browser
Additional context
I've started to use transloco recently, so, I am not sure if this is a bug.
I would like to make a pull request for this bug
No
The text was updated successfully, but these errors were encountered: