Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hello
I want to localize the return of a function depending of the current language of the session of the connected user.
Everything is ok with the labels inot mashups using the "localization tables" but when i want to know the current language in a javascript I cannot get it
I'm using this
var Language = Resources["CurrentSessionInfo"].GetCurrentUserLanguage();
but it is returning an empty string (the user has "fr" in the languages item
any ideas
(ThingWorx 7.3.2-b42)
Thanks
I will try to reproduce this during the U.S office hours tomorrow and will let you know whether it's a bug or a configuration issue.
Hello
any news ?
Thanks
Have you assigned result = Language; to display the result? also assign type String to the output.
yes I did that (and got an empty String)
I am not able to reproduce the issue. Could you please supply a screenshot of your service content along with the application log?
Hello
I have isolated the function into a very simple service :
// result: STRING
var Language = Resources["CurrentSessionInfo"].GetCurrentUserLanguage();
result= Language;
the session language (fr) is selected using the preference widget, it is OK into the user description but the service is returning "Default" (English)
Labels are iwell displayed nto French
see screen copies
I progressed a little bit
The language is well modified using the preferences widget , I can see it in the user preferences (System -> Users -> General Information).
But this is not returned by the function Resources["CurrentSessionInfo"].GetCurrentUserLanguage();
If I press the "save" button in System -> "Users -> General Information " it works !!
Please get current user language setting as below.
var result1 = Users[Username].GetUserPreferenceInfo();
result=result1.getRow(2).value;
Below snippets DOES NOT return current setting, but return last setting when saving user settings directly from Composer. Report to R&D by Jira PSPT-5621