Support » Plugin: Dave's WordPress Live Search » [Plugin: Dave's WordPress Live Search] How to enable translation files?

  • There are dwls.pot, dwls-sv_SE.po and files in the language folder, but the pot and po files appear empty when opening in poedit version 1.4.6.

    A half hour later, I managed to open the spanish translation file in the poedit catalog manager. I overwrote the swedish po file and the translatino works, except the string “view more results” still does not change! Tried clearing browser and plugin cache.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have exactly the same problem (DWLS 2.8).

    If I try to use the dwls.pot I get an empty PoEdit-File.

    If I take another language and change it to my language it will work, but “View more result” is still showing in english, although it is translated and prepared for translation [ __(‘View more results’, dwls’) ].

    I think it is the only frontend-string, maybe this is the problem, because all backend-strings are working fine …

    Kind regards

    Here is the solution for the problem. You need to change the following Function in the file DavesWordPressLiveSearch.php

    Current Version 2.8 Code

    public static function advanced_search_init() {
            if (self::isSearchablePage()) {
                wp_enqueue_script('daves-wordpress-live-search', plugin_dir_url(__FILE__).'js/daves-wordpress-live-search.js', 'jquery');
            load_plugin_textdomain('dwls', false, dirname( plugin_basename( __FILE__ )) . '/languages/');

    Change into this Function:

    public static function advanced_search_init() {
            load_plugin_textdomain( 'dwls', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
            if ( self::isSearchablePage() ) {
                wp_enqueue_script( 'daves-wordpress-live-search', plugin_dir_url( __FILE__ ) . 'js/daves-wordpress-live-search.js', array( 'jquery' ) );

    Hints to the solution:

    • The function “load_plugin_textdomain” need to be loaded before self::inlineSettings
    • The request of jQuery can be made in “wp_enqueue_script” with the parameter “jQuery” as an array in dependencies, currently jQuery is loaded before because the parameter is a string and should be an array

    This is so awesome!

    Thank you very much again, Robert! This was a great WP Camp Germany. I love this community …

    Best Regards

    Plugin Author Dave Ross


    Great catch, Robert! I’ve always just passed a string for the dependency and never had a problem. I wonder if I just got lucky, or there’s some weird combination of PHP & WordPress settings that causes this to be a problem. Regardless, the Codex says that needs to be an array, and an array it shall be!

    Gosh, I’m still having “View more results” not translate… wonder if I’m doing something wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Dave's WordPress Live Search] How to enable translation files?’ is closed to new replies.