- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2016 11:52 PM
Hi all,
Is it any simple way on the new Self service portal for adding the language option on the login page as we have on the backend?
thanks in advance
Regs,
Lô Mouhamadou
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2016 11:48 AM
I completed a widget solution that ties into the Service Portal Header.
- Import the widget record that is attached to this reply
- Navigate to your header
- Find the following code in the Body HTML Template:
<ul ng-if="::user.logged_in" class="nav navbar-nav">
<!-- chat, avatar, and logout -->
<li ng-if="::data.connect_support_queue_id"><a href ng-click="openPopUp()">${Live Chat}</a></li>
<li class="dropdown hidden-xs">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
<span class="navbar-avatar"><sn-avatar class="avatar-small-medium" primary="userID" /></span>
<span class="visible-lg-inline">{{::user.name}}</span>
</a>
Add the following code (to line 4):
<li><sp-widget widget="data.languagePicker"></sp-widget></li>
Navigate down to Server Script and add the following line.
data.languageSelector = $sp.getWidget("language-picker", {});
The end result will look like this:
Please let me know if you any more help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 04:27 AM
Hi Fred,
I'm not sure why the setLanguage function of I18nUtils() isn't working for you, though I am using it in Istanbul so maybe it's something recently enabled for the guest user?
Other than that, we have the same setup, the widget containing the language setter is global, and is being called from a header in a custom scope.
The only thing I can think of is to check whether the user is logged in before doing anything.
i.e.
if(gs.getSession().isLoggedIn()){
userLang = gs.getUser().getPreference("user.language");
}
else {
userLang = util.getLanguage();
}
and
if(gs.getSession().isLoggedIn()){
var user = gs.getUser();
user.setPreference("user.language", input.newLanguage);
user.savePreferences();
}
else{
util.setLanguage(input.newLanguage);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 01:34 AM
Dear thomaswright
Thanks for attempting to help.
I made some tests and could observe that I18nUtils is working fine on my developer instance running Istanbul.
However, the same code on Helsinki is not working.
I have opened an incident on HI and am now waiting for an answer (so far I got an off-topic suggestion about GlideAjax... well...)
It looks like some other people had issues with different versions
Re: How to change system language in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2017 06:44 AM
I'd like to add to this thread that in order to change the language automatically to a static language (my customer wants different languages as default in portal and backend) just add an empty widget to the portals homepage, and only include these two lines in the server script:
var util = new I18nUtils();
util.setLanguage("lang");
Where lang = code of language like "en", "fr" or whatever.
This also works for non-logged in users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 10:22 AM
Wow...lots of really good info here...for a widget that isn't the same as what is available on the share. This is all about version 1.0, but 1.02 is what is available on the share.
Does the 1.02 version of the Language Picker work in newer versions of the SN platform?
How would one add this picker that is currently available to the header menu?
Also, while I can add it to the page and it works, knowledge base articles are not sorted.
Any updates to this thread?
Thanks,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 11:38 AM