cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

GetCurrentUserLanguage() is returning empty string

pjoly
12-Amethyst

GetCurrentUserLanguage() is returning empty string

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

8 REPLIES 8
posipova
20-Turquoise
(To:pjoly)

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.

pjoly
12-Amethyst
(To:posipova)

Hello

any news ?

Thanks

posipova
20-Turquoise
(To:pjoly)

Have you assigned result = Language; to display the result? also assign type String to the output.

pjoly
12-Amethyst
(To:posipova)

yes I did that (and got an empty String)

posipova
20-Turquoise
(To:pjoly)

I am not able to reproduce the issue. Could you please supply a screenshot of your service content along with the application log?

pjoly
12-Amethyst
(To:posipova)

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

language selected for user.pngpreference widget.png

Language Service result.png

pjoly
12-Amethyst
(To:pjoly)

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 !!


wcui
16-Pearl
(To:pjoly)

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

  • Resources["CurrentSessionInfo"].GetCurrentUserLanguage();
  • Users[username].language

 

Announcements


Top Tags