-
-
Notifications
You must be signed in to change notification settings - Fork 211
fix(transloco): take the last provided scope on selectTranslate #866
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
base: master
Are you sure you want to change the base?
Conversation
@jsverse/transloco
@jsverse/transloco-locale
@jsverse/transloco-messageformat
@jsverse/transloco-optimize
@jsverse/transloco-persist-lang
@jsverse/transloco-persist-translations
@jsverse/transloco-preload-langs
@jsverse/transloco-scoped-libs
@jsverse/transloco-utils
@jsverse/transloco-validator
commit: |
|
Hi @shaharkazaz |
|
@matheo yes I'll get to it this week, tnx! |
|
hey @shaharkazaz, any plans to go ahead with this? we're having a simlar-ish problem in our project :( |
|
@shaharkazaz let's say, we load a component which module provides its particular scope, so it gets added to the last position of the array of the scopes. While loading translations from this component, I would expect to take the module scope by default, or the scope provided in the same (standalone) component (it will be the last one in the Currently the library takes the first registered scope as the default one, and that's kinda not intuitive IMHO, and doesn't work without a explicit scope in the leaf component/module. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently we updated the way to provide the scope from:
to the util provided by transloco:
and we started to see untranslated content.
Turns out it was because the util provides
multi: true, inside our components, we get an array of scopes like:What is the new behavior?
Currently
TranslocoService.selectTranslate()takes the array of scopes, and only loads the first one.Turns out, that the scope provided by the module is the last one, so with this PR the
TranslocoServicewill load the scope provided last (at the end of the array).I wonder if all the scopes in the array should be loaded instead.
Does this PR introduce a breaking change?
Other information
@jsverse/transloco v7.6.1