I’m using a component to show messages and I need to pass the message translated according to the language selected, is there a way to pass a JavaScript variable as a parameter to my component ?
Now I have this:
{{component “success-alert” “User Created!”}}
Hi @Thiago_zils,
Welcome to the Losant Forums!
It is not possible to pass a JavaScript variable as a parameter to your component. Experiences are rendered sever-side and the client-side JavaScript inputs (i.e. language selection) will not be able to interact with the arguments of your component: {{component “success-alert” “User Created!”}}.
That template will be rendered into the HTML it represents before the client-side JS has access.
Could you provide some additional details on what it is exactly you are looking to translate? And where that information is located within the component? A screenshot of your current component configuration would be really helpful.
The component you described is a fairly light wrapper around the bootstrap alert component, and you may want to look into implementing on your own, the below is a great resource:
https://getbootstrap.com/docs/3.3/components/#alerts
Thanks,
@Aidan_Zebertavage