-
Notifications
You must be signed in to change notification settings - Fork 93
Dropdown Alignment for locale names - Fix #19, #127 #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 25 commits
cb5801d
26813c0
f0ceb1b
a6a91f5
ac58ded
0b5212a
f56e6cd
bda28d6
405ab95
ee1f6b4
d7a6cbe
3c12e62
ba1fbd9
f2a5416
3525be4
13c48fa
375fa10
fac9d09
c35bc9a
383957a
388db58
bc98919
cc01036
f4e7e8d
95abf26
8018e6a
83124bf
da42d9c
a8cba41
67a3cb5
449e813
32163af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,16 +76,29 @@ $(document).ready(function () { | |
console.warn('No config.LOCALES'); | ||
} | ||
$('.localeSelect').val(locale); | ||
$('#localeName').text($('#localeDropdown').data(locale)); | ||
localizeEverything(localizedHTML); | ||
persistChoices('localization'); | ||
}); | ||
|
||
$('.localeSelect').change(function () { | ||
locale = $(this).val(); | ||
$('#localeName').text($('#localeDropdown').data(locale)); | ||
localizeCurrentInterface(); | ||
}); | ||
|
||
$('#localeDropdown li > a').click(function () { | ||
locale = $(this).data('locale'); | ||
$('.localeSelect').val(locale); | ||
$('#localeName').text(this.text); | ||
localizeCurrentInterface(); | ||
}); | ||
|
||
function localizeCurrentInterface() { | ||
sendEvent('localization', 'localize', locale); | ||
localizeEverything(false); | ||
persistChoices('localization'); | ||
}); | ||
} | ||
|
||
function localizeEverything(stringsFresh) { | ||
localizeInterface(); | ||
|
@@ -114,6 +127,7 @@ $(document).ready(function () { | |
window.location.hash; | ||
window.history.replaceState({}, document.title, newURL); | ||
} | ||
$('#localeDropdownCaret').css('left', rtlLanguages.indexOf(locale) !== -1 ? '5%' : '90%'); | ||
} | ||
}); | ||
|
||
|
@@ -169,7 +183,6 @@ function getLocale() { | |
deferred.resolve(); | ||
} | ||
} | ||
|
||
return deferred.promise(); | ||
} | ||
|
||
|
@@ -212,13 +225,28 @@ function getLocales() { | |
return a[1].toLowerCase().localeCompare(b[1].toLowerCase()); | ||
}); | ||
$('.localeSelect').empty(); | ||
$('#localeDropdown').empty(); | ||
$.each(localePairs, function () { | ||
var isRtlLanguage = (rtlLanguages.indexOf(this[0]) !== -1); | ||
$('.localeSelect').append( | ||
$('<option></option>') | ||
.val(this[0]) | ||
.text(this[1]) | ||
.prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
.prop('dir', isRtlLanguage ? 'rtl' : 'ltr') | ||
); | ||
|
||
$('#localeDropdown').append( | ||
$('<li></li>').append( | ||
$('<a>', { | ||
'data-locale': this[0] | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use |
||
.text(this[1]) | ||
.prop('dir', isRtlLanguage ? 'rtl' : 'ltr') | ||
.css('text-align', isRtlLanguage ? 'right' : 'left') | ||
.css('padding-left', isRtlLanguage ? '105px' : '5px') | ||
.css('padding-right', isRtlLanguage ? '5px' : '105px') | ||
) | ||
).data(this[0], this[1]); | ||
}); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,9 +90,11 @@ | |
<p data-text="tagline" class="tagline"></p> | ||
</div> | ||
<div style="width: 35%" class="pull-right hidden-xs"> | ||
<!-- <i class="icon-globe localeGlobe pull-right"></i> --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :D |
||
<i class="fa fa-globe fa-2x fa-inverse pull-right localeGlobe" style="padding: 5px 5px 0px 0px"></i> | ||
<select class="localeSelect pull-right"><option> </option></select> | ||
<div class="dropdown pull-right"> | ||
<button id="localeDropdownSelect" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown"><span id="localeName" class="pull-left"></span><span class="caret" id="localeDropdownCaret"></span></button> | ||
<ul class="dropdown-menu" id="localeDropdown"></ul> | ||
</div> | ||
</div> | ||
<ul class="nav navbar-nav navbar-right collapse navbar-collapse"> | ||
<li><a href="#translation" data-mode="translation" data-text="Translation" class="hide">Translation</a></li> | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that
"</option>"
is required here?