<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>How to reproduce the bug:<br>
<br>
1) Set Dutch(nl) language at system and browser<br>
2) Go to login page and see no language and locale selected.<br>
<br>
<br>
<br>
</p>
<br>
<div class="moz-cite-prefix">On 11/08/2016 07:24 PM, Ramon Medeiros
wrote:<br>
</div>
<blockquote
cite="mid:1478640299-31394-1-git-send-email-ramonn@linux.vnet.ibm.com"
type="cite">
<pre wrap="">Signed-off-by: Ramon Medeiros <a class="moz-txt-link-rfc2396E" href="mailto:ramonn@linux.vnet.ibm.com"><ramonn@linux.vnet.ibm.com></a>
---
ui/js/src/wok.login.js | 27 +++++++++++++++++++--------
ui/pages/login.html.tmpl | 4 ++--
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/ui/js/src/wok.login.js b/ui/js/src/wok.login.js
index 0b09508..6545858 100644
--- a/ui/js/src/wok.login.js
+++ b/ui/js/src/wok.login.js
@@ -19,17 +19,28 @@
*/
wok.login_main = function() {
"use strict";
+
+ // verify if language is available
var selectedLanguage = wok.lang.get();
- $('#userLang').val(selectedLanguage);
- $('#userLang option[value="'+selectedLanguage+'"]').attr("selected", "selected");
- $('.filter-option:first').parent().attr('title',$('#userLang option[value="'+selectedLanguage+'"]').text());
- $('.filter-option:first').text($('#userLang option[value="'+selectedLanguage+'"]').text());
+ for (var i = 0; i < $('#userLang')[0].length; i++ ){
+ if ($('#userLang')[0][i] == selectedLanguage) {
+ $('#userLang').val(selectedLanguage);
+ $('#userLang option[value="'+selectedLanguage+'"]').attr("selected", "selected");
+ $('.filter-option:first').parent().attr('title',$('#userLang option[value="'+selectedLanguage+'"]').text());
+ $('.filter-option:first').text($('#userLang option[value="'+selectedLanguage+'"]').text());
+ }
+ }
+ // verify if locale is available
var selectedLocale = wok.lang.get_locale();
- $('#userLocale').val(selectedLocale);
- $('#userLocale option[value="'+selectedLocale+'"]').attr("selected", "selected");
- $('.filter-option:last').parent().attr('title',$('#userLocale option[value="'+selectedLocale+'"]').text());
- $('.filter-option:last').text($('#userLocale option[value="'+selectedLocale+'"]').text());
+ for (var i = 0; i < $('#userLocale')[0].length; i++ ){
+ if ($('#userLocale')[0][i] == selectedLocale) {
+ $('#userLocale').val(selectedLocale);
+ $('#userLocale option[value="'+selectedLocale+'"]').attr("selected", "selected");
+ $('.filter-option:last').parent().attr('title',$('#userLocale option[value="'+selectedLocale+'"]').text());
+ $('.filter-option:last').text($('#userLocale option[value="'+selectedLocale+'"]').text());
+ }
+ }
$('#userLang').on('change', function() {
diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
index 431806c..d74b795 100644
--- a/ui/pages/login.html.tmpl
+++ b/ui/pages/login.html.tmpl
@@ -128,7 +128,7 @@
<div class="form-group">
<label for="userLang">$_("Language")</label>
<select id="userLang" class="selectpicker col-md-12 col-lg-12">
- <option value="en_US">English (US)</option>
+ <option value="en_US" selected="selected">English (US)</option>
<option value="zh_CN">中文(简体)</option>
<option value="pt_BR">Português (Brasil)</option>
<option value="de_DE">Deutsch (Deutschland)</option>
@@ -202,7 +202,7 @@
<option value="en-ZA">$_("English (South Africa)")</option>
<option value="en-TZ">$_("English (Tanzania)")</option>
<option value="en-GB">$_("English (United Kingdom)")</option>
- <option value="en-US">$_("English (United States)")</option>
+ <option value="en-US" selected="selected">$_("English (United States)")</option>
<option value="en-ZM">$_("English (Zambia)")</option>
<option value="et-EE">$_("Estonian (Estonia)")</option>
<option value="tl-PH">$_("Filipino (Philippines)")</option>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a class="moz-txt-link-abbreviated" href="mailto:ramonn@br.ibm.com">ramonn@br.ibm.com</a> </pre>
</body>
</html>