Configure a Website on the Global Delivery Network

Sort Translated Dropdown Menus

It's common to have drop downs alphabetically sorted on your site. For example, an address form might have an alphabetized list of countries, allowing for a better user experience. When translating the contents of a drop down menu, options may appear out of order on your translated sites (i.e when Germany is translated to Deutschland).

For these cases, Smartling has a feature that allows you to resort drop downs on your translated site, called the Sort class (sl_sort).

Using the Sort Class

If you include the class sl_sort on the <select> element on your source site, Smartling will reorder the dropdown in each language.


<select name="countryList" class="sl_sort">
<option value="Albania">Albania</option>
<option value="France">France</option>
<option value="Germany">Germany</option>
<option value="South Africa">South Africa</option>
<option value="United States">United States</option>
</select>
 

The Sort works for latin character languages (i.e this method will not work when translating to Chinese). Alternatively, you can use JavaScript to sort drop downs.

Variations

  • sl_sort_desc - This will sort the dropdown in descending alphabetical order (from Z to A).
  • sl_sort_preserve_top - This will sort the drop down but keep the first entry in place regardless of language. This is useful when the first option is a default value such as "Choose your country".
Was this article helpful?