RTL & Internationalization
DotSelect has full support for right-to-left (RTL) layouts and ships with 15 built-in locales.
RTL Support
Automatic Detection
DotSelect automatically detects RTL direction from the document or nearest parent element's dir attribute:
<html dir="rtl" lang="ar">
<body>
<!-- DotSelect automatically renders in RTL mode -->
</body>
</html>Per-Element RTL
Apply RTL to a specific select without changing the document direction:
Or use the data-dir attribute directly:
What RTL Affects
- Dropdown alignment flips to the right edge
- Search input text aligns right
- Selected items flow right-to-left
- Clear and arrow icons swap positions
- Remove buttons appear on the left side of items
- Keyboard navigation respects RTL direction
Internationalization (i18n)
Setting a Locale
Use data-locale to set the language for UI strings:
Available Locales
DotSelect ships with the following built-in locales:
| Code | Language | Code | Language |
|---|---|---|---|
en | English (default) | it | Italian |
ar | Arabic | ja | Japanese |
de | German | ko | Korean |
es | Spanish | nl | Dutch |
fr | French | pt | Portuguese |
he | Hebrew | ru | Russian |
hi | Hindi | tr | Turkish |
zh | Chinese (Simplified) |
Locale Strings
Each locale provides translations for the following UI strings:
| Key | English Default | Description |
|---|---|---|
noResults | "No results found" | Shown when search yields no matches |
searching | "Searching..." | Shown while an AJAX request is in progress |
loadMore | "Load more results" | Pagination trigger text |
addItem | "Add \"{@term}\"" | Prompt for creating new items (tagging) |
loading | "Loading..." | Shown during initial data load |
removeItem | "Remove" | Aria label for item remove buttons |
clearAll | "Clear all" | Aria label for clear button |
inputTooShort | "Type at least {@count} characters" | Shown when input is below min-chars threshold |
Registering a Custom Locale
Add your own locale using DotSelect.registerLocale():
DotSelect.registerLocale('custom-locale', {
noResults: 'Nothing matches your search',
searching: 'Looking for results...',
loadMore: 'Show more',
addItem: 'Create "{@term}"',
loading: 'Please wait...',
removeItem: 'Delete',
clearAll: 'Reset',
inputTooShort: 'Please type at least {@count} characters',
});Then use it:
Overriding Specific Strings
You do not need to provide all strings. Missing keys fall back to the English default:
DotSelect.registerLocale('en-custom', {
noResults: 'Sorry, nothing found!',
// All other strings use English defaults
});Per-Element String Overrides
Override individual strings on a specific select without creating a full locale:
TIP
Per-element overrides take priority over the locale. This lets you set a global locale while customizing text for specific selects.
Combining RTL and i18n
For full RTL language support, combine dir="rtl" with the appropriate locale:
<html dir="rtl" lang="ar">
<body>
</body>
</html>Hebrew Example
Bidirectional Content
DotSelect handles mixed LTR/RTL content within the same select:
WARNING
When using RTL with templates, make sure your template HTML includes appropriate dir attributes on inline elements if they contain LTR content (such as numbers or English text) to ensure correct rendering.