Dropdown Alignment for locale names - Fix #19, #127#159
Dropdown Alignment for locale names - Fix #19, #127#159share-with-me wants to merge 32 commits intoapertium:masterfrom
Conversation
Probably
I don't know how I feel about the styling of that dropdown. Screenshot? |
|
@sushain97 , After this PR, i would set up travis locally too. Please (pliss) pardon me on this one :P |
On it! |
|
@share-with-me it looks a bit too much like a button now and not enough like a select looks. The |
|
@sushain97 , I have updated the styling of the dropdown button. It looks like this now: |
|
Does the alignment of “English” match that of a normal select? Seems to be center instead of right?
… On Jul 6, 2017, at 10:48 AM, Monish Godhia ***@***.***> wrote:
@sushain97 <https://github.com/sushain97> , I have updated the styling of the dropdown button. It looks like this now:
<https://user-images.githubusercontent.com/8894636/27916939-2bbb5db0-6288-11e7-8d05-9f0ca0e21133.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEfreXwIVepA3CIo06iuvnSqZNW-qoks5sLPOrgaJpZM4OLP3q>.
|
|
Yes.
… On Jul 6, 2017, at 10:58 AM, Monish Godhia ***@***.***> wrote:
Seems to be center instead of right?
Um, 'English' should appear in the left if that is what you are saying?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEftPGZYdgUZXg7UJB8i3BVMOyaujSks5sLPYsgaJpZM4OLP3q>.
|
|
Made the changes @sushain97 ! Made some changes in logic too after determining an edge case that was failing. |
|
Added the appropriate paddings! |
assets/js/localization.js
Outdated
| } | ||
| } | ||
|
|
||
| $('#localeDropdownCaret').css('left', rtlLanguages.indexOf(locale) !== -1 ? '5%' : '90%'); |
assets/js/localization.js
Outdated
| .text(this[1]) | ||
| .prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
| .css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '115px' : '5px') | ||
| .css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '115px') |
There was a problem hiding this comment.
Hm, this seems a bit brittle?
There was a problem hiding this comment.
Um, by brittle, do you mean that the logic to align the languages could be improved? Um, what suggestions do you have?
assets/js/localization.js
Outdated
| $('#localeDropdown').append( | ||
| $('<li></li>').append( | ||
| $('<a>', { | ||
| href: 'index.' + this[0] + '.html' |
There was a problem hiding this comment.
The current locale dropdown does not do this. We do not want to force a page refresh for switching languages! That's not great UX.
There was a problem hiding this comment.
Hm yes. I would try to use the same logic and update this.
index.html.in
Outdated
| <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> --> |
|
@sushain97 , Made all the changes. Also implemented the functionality where the page is not forced to refresh now. I have emulated the existing functionality :) |
sushain97
left a comment
There was a problem hiding this comment.
good work switching to the right behavior, some concerns
assets/js/localization.js
Outdated
| $('#localeDropdown').append( | ||
| $('<li></li>').append( | ||
| $('<a>', { | ||
| rel: this[0] // eslint-disable-line id-length |
There was a problem hiding this comment.
This doesn't seem to be a valid value for the rel attribute per https://www.w3.org/TR/html5/links.html#linkTypes. Have you tried using something like data-locale? Note that jQuery has a helpful $.data().
assets/js/localization.js
Outdated
| .prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
| .css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '105px' : '5px') | ||
| .css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '105px') | ||
| .hover( |
There was a problem hiding this comment.
This should go in CSS if at all possible. Is there a reason you put it here? CSS transitions might be helpful.
There was a problem hiding this comment.
Hm, yep. It does make sense to put it in CSS. Would change it
assets/js/localization.js
Outdated
| .text(this[1]) | ||
| .prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
| .css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '105px' : '5px') | ||
| .css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '105px') |
There was a problem hiding this comment.
Would it be possible to use text-align instead and then add padding on both sides?
assets/js/localization.js
Outdated
| rel: this[0] // eslint-disable-line id-length | ||
| }) | ||
| .text(this[1]) | ||
| .prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') |
There was a problem hiding this comment.
I wonder if it would be worth not exporting rtlLanguages and instead a function like isRtlLanguage or something like that... I don't recall if we use rtlLanguages for any other purpose though.
There was a problem hiding this comment.
Um, would making a function instead serve better? The entire usage of rtlLanguages is to determine if it is present in that particular array. Should I make a function instead?
Something like:
function isRtlLanguage(lang) {
return rtlLanguages.indexOf(lang) !== -1;
}
|
Um, but isn't scrollbar appearing 'always' a specific setting in OS? Are you suggesting that I could override it to always show?
I’m pretty certain it can also be done with CSS.
Also, if not, then when the user changes the settings of scrollbar, the appropriate margin gets added automatically right?
I don’t think it’s a margin per se. It’s out of the browser’s control.
… On Aug 10, 2017, at 12:26 AM, Monish Godhia ***@***.***> wrote:
Um, but isn't scrollbar appearing 'always' a specific setting in OS? Are you suggesting that I could override it to always show? Also, if not, then when the user changes the settings of scrollbar, the appropriate margin gets added automatically right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEfl2O6hjVllURbz94V65eJFnYbrf8ks5sWoZ7gaJpZM4OLP3q>.
|
|
@sushain97 , referring to this link, I have added the necessary CSS. Could you check how it looks now? |
assets/css/style.css
Outdated
| text-decoration: none; | ||
| } | ||
|
|
||
| @media(device-width: 768px) and (device-height: 1024px){ |
sushain97
left a comment
There was a problem hiding this comment.
Small concern. I also still think we can get rid of localeToLanguageMap! I think you need to use $('.someElement').data('locale-name', 'blah').
assets/css/style.css
Outdated
| } | ||
|
|
||
| @media(device-width: 768px) and (device-height: 1024px) { | ||
| ::-webkit-scrollbar { |
There was a problem hiding this comment.
Actually, this applies to all scrollbars on the page. We only want to affect the language dropdown one!
Thank you @sushain97 :D. I actually managed to achieve it. |
|
Implemented both :D |
assets/js/localization.js
Outdated
| $('<li></li>').append( | ||
| $('<a>', { | ||
| 'data-locale': this[0] | ||
| }) |
There was a problem hiding this comment.
Can we use .data('locale', this[0]) for the sake of consistency?
assets/js/localization.js
Outdated
| $.each(localePairs, function () { | ||
| var isRtlLanguage = (rtlLanguages.indexOf(this[0]) !== -1); | ||
| $('.localeSelect').append( | ||
| $('<option></option>') |
There was a problem hiding this comment.
I don't think that "</option>" is required here?
|
Made the changes. |
assets/js/localization.js
Outdated
| .data('locale', this[0]) | ||
| .text(this[1]) | ||
| .prop('dir', isRtlLanguage ? 'rtl' : 'ltr') | ||
| .css({ |
There was a problem hiding this comment.
Actually, on second thought, this should all go in the stylesheet. All you need to do is #localeDropdown li[dir='rtl'] { ... } .
There was a problem hiding this comment.
I made the changes but doing a git rebase now is causing conflicts :/ .
|
Implemented the CSS changes. |
|
Screenshot? |
|
This looks good to me. I guess mostly we need it tested on OS X, though. @sushain97 ? |
|
Hm, it appears good to me if I remove: Why did you add this? |
I had referred to some stackoverflow link and I was not sure how to test. I'd remove the media queries and update it now. |
|
Removed the media queries @sushain97 . |












This PR aims to fix #19 and #127 . I make use of a
bootstrap dropdownto display thelocales. This dropdown is visible only on larger (non-mobile devices) and it reverts to the currentselectfeature for displaying thelocaleswhile on mobile devices.Currently, for 3 lanaguages, the
bootstrap buttondoes not display the name of the locale. For instance,qaraqalpaksha. I could not find this name (and 2 others) anywhere (neither inlanguagesnor iniso639Codesand hence, am unable to populate this name currently ). How are theselect optionsfor these languages getting populated in the current functionality?