Customization
Localization
Customize the SearchX widget text and support multiple languages.
Overview
SearchX supports multi-language interfaces through custom locale files. You can translate all widget text — from search placeholders to button labels and filter names.
Setting Up Translations
1. Create Locale Files
Create JSON translation files for each supported language:
/locales/en.json:
{
"search": {
"placeholder": "Search for products...",
"no_results": "No products found for \"{{query}}\"",
"results_count": "{{count}} products found"
},
"filters": {
"title": "Filters",
"clear_all": "Clear all",
"price_range": "Price range",
"brand": "Brand",
"category": "Category",
"size": "Size",
"color": "Color"
},
"product": {
"add_to_cart": "Add to Cart",
"add_to_wishlist": "Add to Wishlist",
"out_of_stock": "Out of Stock",
"sale": "Sale"
},
"pagination": {
"previous": "Previous",
"next": "Next"
},
"sort": {
"label": "Sort by",
"relevance": "Relevance",
"price_asc": "Price: Low to High",
"price_desc": "Price: High to Low",
"newest": "Newest"
}
}
2. Configure the SDK
Pass the locale URL pattern and default language:
SearchXSDK.init({
// ... other config
customLocaleUrl: '/locales/{{lng}}.json',
defaultLanguage: 'en',
});
The {{lng}} placeholder is replaced with the current language code.
Language Switching
The SDK automatically detects language changes. For OpenCart, language is persisted in localStorage:
localStorage.setItem('searchx_lang', 'el');
location.reload();
Supported Languages
SearchX has built-in support for:
- English (
en) - Greek (
el) - Additional languages via custom locale files
Right-to-Left (RTL)
RTL language support is on our roadmap. If you need RTL support, please contact our team.