- 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-23-2017 06:29 AM
Hi @Frederic Klein,
Try this,
On the server script : add these lines
if (input) {
setLanguage(input.language);
}
//gs.addInfoMessage("language 2"+input.language);
function setLanguage(language) {
if (language == '' || typeof language == 'undefined') {
language = 'en';
}
//gs.addInfoMessage("language "+language);
var util = new I18nUtils();
util.setLanguage(language);
}
On the client script : add these lines
c.getLanguage = function(language) {
//c.server.update();
// $window.location.reload();
//$window.location.href='?id=hr_login';
c.server.get({
language: language.toString()
}).then(function(r) {
$window.location.href='?id=hr_login';
});
}
And in the HTML you should have something like this below
<div class="form-group">
<input id="username" name="username" ng-click="message = ''" class="form-control" type="text" placeholder='${Username}' autofocus="true" ng-model="c.username"/>
</div>
<div class="form-group">
<input id="password" name="password" ng-click="message = ''" class="form-control" type="password" placeholder='${Password}' ng-model="c.password"/>
</div>
</form>
</div>
<div class="panel-footer"> <button name="login" type="submit" ng-click="c.login(c.username, c.password, c.language)" class="btn btn-lg btn-primary btn-block">
${Login}
</button>
</div>
</div>
</div>
</div>
<div class="col-md-5 col-md-offset-1">
<div class="panel-group">
<div class="panel panel-primary">
<div class="panel-body">
<div>
<div style="float: left;"><img src="new_psw.png"> </div>
<div>
<h4> ${I don't know my password}</h4>
<h5><a href="myhr?id=hr_password">${Request a new one}</a></h5>
</div>
Let me know if you still have issues. If you can share your code, I invite you to do it so we can help you more easily

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 02:38 AM
Thank you for your reply lomouhamadou
However, your code is rather confusing.
The c.getLanguage function in your client script is never called from the html.
Looks like something is missing.
What version have you tried this on?
I am running Helsinki and calling this code on the server side
var util = new I18nUtils();
util.setLanguage(some_new_language_in_2_letter_code);
has no effect on
- util.getLanguage()
- gs.getSession().getLanguage();
- gs.getMessage('msg_key');
br
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 03:23 AM
On the client script function, the first line normally you should have the params that I put in bold in the line below.
function loginCtrl($scope, $http, $window, $location, urlTools) {
Add them in case you do not have them yet and let me know

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 03:36 AM
hmm... This makes no sense to me:
How would any change on the client script as you are suggesting impact what's going on on the servicer script (I18nUtils)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017 03:42 AM
On the widget if you want to make a call from HTML to server, you cannot.
So, you have to call a function in client script part the it calls another one on the server part of the widget.
It is called record watch I believe.
Anyway, in the Client script function you have to add some parameters else the call won't work.
I think it is easier if you share you scripts in the widget