Chosen script strings translation

Forums › Forums › Search & Filter Pro › Chosen script strings translation

Viewing 3 posts – 1 through 3 (of 3 total)
  • Anonymous
    #21340

    Hello

    I observed that strings which are coming from Chosen jQuery script are always displayed in English language.

    For example, when you search in combobox and there are no results on the list you will see “No results match” string ( http://imgur.com/Ro8sR8e ).

    I checked language strings in your plugin via Poedit app, but I didn’t find similiar string. I checked Chosen jQuery source code and these strings are hardcoded there.

    After small research I found this topic on StackOverflow – http://stackoverflow.com/questions/16669592/how-to-change-the-language-for-alerts-in-chosen-js I tried to add this code:

    $(“.postform”).chosen({no_results_text: “Testing no results text”});

    to my template JS file, but I’m getting “Uncaught TypeError: Cannot read property ‘length’ of undefined” message in Console. Unfortunatelly I’m stuck here. Do you have any recommendations how to handle this problem?

    Regards

    Anonymous
    #21347

    Well I fixed this problem by adding this code to my template JS file:

    
        // Pass language variable to chosen script
        var $chosen = $('form.searchandfilter').find("select[data-combobox=1]");
    
        if($chosen.length>0) {
            if (typeof $chosen.chosen != "undefined") {
                $chosen.chosen('destroy').chosen({
                    no_results_text: LG_no_results
                });
            }
        }
    

    I’m destroying chosen instance from Search & Filter plugin and initializing it again with my custom string.

    Probably it’s not the best solution, but it’s working.

    If you know better method to handle it, please advice.

    Regards

    Ross Moderator
    #21404

    Hi there

    Its strange, no one has mentioned this until now – thanks for the update and info, I take a look further into this and see if its something I can add in to the plugin 🙂

    Thanks!

Viewing 3 posts – 1 through 3 (of 3 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.