diff --git a/css/jquery.uls.lcd.css b/css/jquery.uls.lcd.css index 50f236c..819bcb6 100644 --- a/css/jquery.uls.lcd.css +++ b/css/jquery.uls.lcd.css @@ -5,6 +5,7 @@ .uls-lcd-region-section ul li:hover { background-color: #eaeff7; } + /* Language list */ .uls-language-list { height: 22em; @@ -22,7 +23,32 @@ font-weight: normal; overflow: hidden; white-space: nowrap; + + /* + * Some languages have long names for various reasons and we still want + * them to appear on one line. + * To make it work correctly, the directionality must be set correctly + * on the item level. + */ text-overflow: ellipsis; + + /* + * The directionality (ltr/rtl) for each list item is set dynamically + * as HTML attributes in JavaScript. Setting directionality also applies + * alignment, but a list with mixed alignment is hard to read. + * All items are therefore explicitly aligned to the left, including names + * of right-to-left languages in left-to-right environment and vice versa. + * As long as the directionality of the item is set correctly, the text + * is readable. + */ + text-align: left; + + + /* + * We don't want any visible bullets in this list. + */ + list-style-image: none; + list-style-type: none; } .uls-language-list strong { diff --git a/src/jquery.uls.data.utils.js b/src/jquery.uls.data.utils.js index 4adbb1a..591a6e3 100644 --- a/src/jquery.uls.data.utils.js +++ b/src/jquery.uls.data.utils.js @@ -339,6 +339,15 @@ return $.inArray( $.uls.data.script( language ), $.uls.data.rtlscripts ) !== -1; }; + /** + * Return the direction of the language + * @param string language code + * @return string + */ + $.uls.data.getDir = function( language ) { + return $.uls.data.isRtl( language ) ? 'rtl' : 'ltr'; + }; + /** * Returns the languages spoken in a territory. * @param string Territory code diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 1f4a9a0..a6ced8b 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -19,10 +19,9 @@ * @licence MIT License */ -(function( $ ) { +( function( $ ) { "use strict"; - var noResultsTemplate = '\