Translations and Language

Change default translations

Default translations are the small pieces of text that appear in the template of the website, such as “did you mean..” or “your search for …”. These are automatically translated into the language that the search is set up for. However, it is possible to rephrase or change the translation.

In order to change the translations, follow this link and search for translateProvider function. Here, you will find a list of the translations you are able to change. Find the section with the desired language.
As an example, this is the English section:

"en": {
                "did_you_mean": "Did you mean <a href='' aria-label='Did you mean {{value}}'><b>{{value}}</b></a>?",
                "your_search_on": "Your search for '<b>{{value}}</b>' ",
                "total_results": "returned <b>{{value}}</b> results",
                "total_result": "returned <b>{{value}}</b> result",
                "in_category": " in the category <b>{{value}}</b>",
                "and": " and",
                "searched_instead": "<br />Showing results for <b>{{value}}</b> instead",
                "searched_instead_found": " and gave <b>{{value}}</b> results",
                "error": "<p style='color: red' class='cludo-error-message'>Sorry, an error occurred.</p>",
                "no_search_term": "<div class='cludo-no-search-term'>Please enter a search term</div>",
                "overlay_close_button": "ESC or",
                "load_more": "show more",
                "poweredBy_title": "Take control over the search on your website - Cludo",
                "backToTop": "Back to top",
                "search_input_label": "Search",
                "search_button_text": "Search",
                "overlay_close_button_title": "Exit search",
                "template_all_results": "All Results",
                "template_suggestions": "Suggestions",
                "template_search_results": "Search Results",
                "template_autocomplete_hint": "Autocomplete suggestions are available. Use up and down arrows to review and enter to select.",
		"related_searches_title": "Related Searches"
            },

In the template script, add the line of code to define the label key to change as well as the new value. Make sure to include the language key as well.

CludoSearch.translateProvider.translations["en"]["template_all_results"] = "My custom all results text";

Example

A user would like to change the english “back to top” button to say “Scroll to top”.
navigating the “en” section of the translateProvider function, this label is located in the “backToTop” key. In order to change it the following line must be added:
CludoSearch.translateProvider.translations["en"]["backToTop"] = "Scroll to top";

Note: If the original label contains “{{value}}“, it is recommended to also include these in the custom translation, as they are placeholders for the actual value that is generated according to the search.

Once the translation(s) have been prepared, simply add them in the script. It must be located after the CludoSearch= new Cludo(cludoSettings); line and before the CludoSearch.init(); line:

<script type="text/javascript" src="//customer.cludo.com/scripts/bundles/search-script.min.js"></script>;;
<script>
    var CludoSearch;
    (function () {
        var cludoSettings = {
        customerId: 0000,
        engineId: 0000,
        searchUrl: 'https://yourblog.com';;,
        language: 'en',
        searchInputs: ['cludo-search-box'],
        type: 'inline', 
        hideSearchFilters: true, 
        searchApiUrl: 'https://api-us1.cludo.com/api/v3';;
        };
        CludoSearch= new Cludo(cludoSettings);
        CludoSearch.translateProvider.translations["en"]["backToTop"] = "Scroll to top";
        CludoSearch.init();
    })();
</script>

Change the search page language


You can customize the language of your search results page directly within the Cludo Search script. To do this, simply modify the language parameter in the script, as shown in the example below:

language: 'da'


This will set the search page language to Danish (da). You can replace ‘da’ with the appropriate language code to match your needs.