gs.getSession().getLanguage()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 01:44 AM
Hello guys,
I have an issue with the above line.
I have a script email notification that is translating the variables based on user language. The issue is that some fields are translated in portuguese, even though the user has english selected.
So I ran the above code in background script and it returns en, but adding the same piece of code in the script email notification returns pb. The admin account is set to english as preferred language.
Do you have any suggestion where should I look into this? I ran out of ideas 😞
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 02:23 AM
Hi @valentin3
The discrepancy in language codes ('en' in a background script and 'pb' in an email script) when using gs.getSession().getLanguage() is likely due to the different user contexts in which the scripts are executed.
Background Script: When you run the gs.getSession().getLanguage() in a background script, it executes in the context of the user who is currently logged in and running the script, typically an administrator or a developer. If your user account's language preference is set to English, the method will return 'en'.
Email Script: The email script runs in the context of the user who is the recipient of the email or related to the event that triggered the email. If the email script returns 'pb', it suggests that the session in which the email script is running has a different language preference 'pb'
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 02:25 AM
Hi @valentin3
email notifications are performed in the background by the "system" user, that means decoupled from the user's session, and it's selected language. Without any special preparations, the system user will use the system's language. But it also depends on how exactly your implementation looks like.
Why in your case languages are mixed, cannot be answered by me as you left all the required details.
Maik