Bug(transloco): Multiple languages on the application simultaneously with pipe
Opened this issue · 4 comments
Is there an existing issue for this?
- I have searched the existing issues
Which Transloco package(s) are the source of the bug?
Transloco
Is this a regression?
No
Current behavior
In my application, I want to display one or more components in a language other than the active language throughout the rest of the application (this is a preview of a printable report). I've tried passing the language as a pipe parameter, using the directive, but it doesn't work dynamically. Changing the language of this preview is done through a drop-down list. And when I change the language, the content translated by the pipe or the directive doesn't change. What's wrong?
Expected behavior
When I change the language in a drop-down list, I want to be able to display only that component in the desired language without changing the active language of the rest of the application.
Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.
Transloco Config
No response
Please provide the environment you discovered this bug in
Transloco:
Angular:
Node:
Package Manager:
OS:
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
No
@GitHubish I can't fully understand your scenario and there are no instructions for your reproduction (seems like it's just the playground app).
Please provide a reproduction for your case. generally speaking, if you want to control the language of a specific component you can do that by using the static
flag, e.g. lang: '{previewLang}|static'
.
Sorry @shaharkazaz for not providing enough in my explanation. What I'm trying to do is display a component in a selected language (so the change is dynamic) and this language may therefore be different from the "global" language of my application. The use case is that of a preview of a page that will be printable, this page is made up of a set of components (graphics) and must therefore be displayed in the language selected in a drop-down list without changing the language of the rest of the application. I use an @input to pass them the selected language and I wanted the translations to change using one of the methods on the "Multiple Languages Simultaneously" page, but this doesn't work. I can't use the static argument as it's dynamic.
I hope this has made things clearer?
Thank you
@GitHubish Thanks, it's clear.
I'll think about how I want to approach this, but generally speaking, the directive isn't listening to input changes and that's the issue here
@shaharkazaz Thank you very much! Also with the pipe, I guess it's the same thing, it doesn't listen to the change and therefore doesn't update the key translation