• Hello Polylang team.

    In olt-manager.php around line 113, there is a comment stating “Since WP 4.6, plugins translations are first loaded from wp-content/languages”, however, the code that follows it loads text-domain files from the default location first, which, when var_dump-ing the content of the used filepath, shows the plugin folder instead of wp-content/languages/plugins.

    This affects the pro version as well.

    Since the comment is “languages folder first”, should that code block not read something like;

    
    foreach ( $this->list_textdomains as $textdomain ) {
    	// Since WP 4.6, plugins translations are first loaded from wp-content/languages				
    	// Since WP 3.5 themes may store languages files in /wp-content/languages/themes
    	if ( ! load_textdomain( $textdomain['domain'], WP_LANG_DIR . "/themes/{$textdomain['domain']}-$new_locale.mo" ) ) {
    		// Since WP 3.7 plugins may store languages files in /wp-content/languages/plugins
    		if (!load_textdomain( $textdomain['domain'], WP_LANG_DIR . "/plugins/{$textdomain['domain']}-$new_locale.mo" ) ) {
    			// Try plugin/theme location last.
    			load_textdomain( $textdomain['domain'], str_replace( "{$this->default_locale}.mo", "$new_locale.mo", $textdomain['mo'] ) );
    		}
    	}
    }
    
    

    Thank you for your time.

    Remon.

    • This topic was modified 2 years, 8 months ago by Remon Pel.
Viewing 1 replies (of 1 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    In our tests we did not successfully reproduced loading languages files in the wrong order.

    We did the tests with 2 different language files, one in the plugin directory, the other in the default directory and selected The language is set from the content in Polylang settings.

    Could you provide steps to reproduce?

    I did not checked deeply, however it seems to me that the 2 last load_textdomain() are now useless (and maybe counterproductive). This succession of tests has been written when the hook used was override_load_textdomain instead of load_textdomain_mofile. The change of hook was made to counter breakages introduced by WP 4.6 and I did not adapt the part you are mentionning.

Viewing 1 replies (of 1 total)
  • The topic ‘Language files loaded in wrong priority order’ is closed to new replies.