How to get the logged in user locale/language pref

Hello Dears,

How can we get the logged in user locale or language preference in a Gadget script file?

Is there any built-in function available for this ?

Thanks and Regards,
Anish

you can use the getUserPreferenceByName(ā€œpreferenceNameā€) API available in the SharedService.

In this case preference name is ā€œcurrentUserLocaleā€

e.g.
You can try including this code snippet you can include it in your gadget controller.js,

this.$scope.sharedService = SharedService;
var userName=this.$scope.sharedService.getUserPreferenceByName(ā€œcurrentUserLocaleā€);

note: pass SharedService as param to the init function of gadget controller.

1 Like

Dear Yashwanth,

Thank you for your prompt response.

Appreciated.

Regards,
Anish