Hey,
I was wondering if there is a way to use the ingition translations inside a custom module.
I’d also like to know how to get the locale, for now i use a param, but then i would have to bind it with the session param every time and that is a bit bothersome xd
Thank you!
1 Like
The easiest way to use translations in a frontend Perspective component is to wrap whatever text you want to display in an <I18n>
component. If you can’t do that, or need access to the translated string for some reason, you can use the static i18n function - both the component and the function are in @inductiveautomation/perspective-client
.
3 Likes
Thanks, thats what i needed
@PGriffith
Alright so the i18n function is all working great. But i also need access to the locale, (to display what locale is being used).
I could do it with a binding, but is there a way to access session props from js?
ahah! found it
window.__client.page.sessionProps.read('locale')
If you're within the context of a component, you should be able to walk up from the ComponentProps your component is provided, e.g:
1 Like
yeah i had just found something similar with
window.__client.page.sessionProps.read('locale')
thanks!