Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
6 subscribers
Views
2599 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
Try to get the primary locale of the system
Stefan Helzle
A Score Level 3
over 8 years ago
I am working on replacing an old plugin which uses deprecated API. In case the user did not set any preferences for his locale
UserProfileService.getUser(context).getLocale()
returns NULL. The old code is
if (locale == null) {
locale = AdministrationService.getSiteLocaleSettings().getPrimaryLocale();
}
Now the AdministrationService is deprecated. How do I get the system locale using current API calls? I did not find anything in the API docs.
OriginalPostID-241441
Discussion posts and replies are publicly visible
0
Vinod Bongoni
Certified Lead Developer
over 8 years ago
Try to use ServiceContextFactory to get the administrator user or context and then use getLocale() method.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 8 years ago
Hm ... this might work, but I would like to implement to most "official" way of doing that. The expression userlocale() can do it. But that does not help me in Java code.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
I think you can use com.appiancorp.suiteapi.portal.GlobalizationService. It has the same method getSiteLocaleSettings(). This service is not yet deprecated.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 8 years ago
There is no public API available that replaces the AdministrationService. I will raise a ticket to bring some awareness to it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel