WordPress.org

Ready to get started?Download WordPress

Forums

Codestyling Localization
[resolved] False alert for load_textdomain (5 posts)

  1. Stevesan
    Member
    Posted 1 year ago #

    Hi.

    I'm getting the alert message that some plugins are using load_textdomain instead of the load_plugin_textdomain. So I'm contacting the plugin authors one by one. And step by step I'm having it fixed.

    One of them, however, claims it to be a false alert. It's the Contact Form 7 plugin here at the repository. Could you clarify to me what's up here?

    Thanks for a super plugin.

    Steve

    http://wordpress.org/plugins/codestyling-localization/

  2. codestyling
    Member
    Plugin Author

    Posted 1 year ago #

    This is not a false alert.
    Here the code snippet from actual "Contact Form 7" code version 3.4.2:

    function wpcf7_get_contact_form_default_pack( $args = '' ) {
    	global $l10n;
    
    	$defaults = array( 'locale' => null, 'title' => '' );
    	$args = wp_parse_args( $args, $defaults );
    
    	$locale = $args['locale'];
    	$title = $args['title'];
    
    	if ( $locale && $locale != get_locale() ) {
    		$mo_orig = $l10n['wpcf7'];
    		unset( $l10n['wpcf7'] );
    
    		if ( 'en_US' != $locale ) {
    			$mofile = wpcf7_plugin_path( 'languages/wpcf7-' . $locale . '.mo' );
    			if ( ! load_textdomain( 'wpcf7', $mofile ) ) {
    				$l10n['wpcf7'] = $mo_orig;
    				unset( $mo_orig );
    			}
    		}
    	}

    As can be seen, it uses indeed:
    load_textdomain( 'wpcf7', $mofile )

  3. Stevesan
    Member
    Posted 1 year ago #

    I sort of suspected that. I'll send this info to the author of the Contact code plugin. Thanks!

    Steve

    PS. I'm no codeguru, but is this an esy fix, I mean simply repacing the call for load_textdomain with load_plugin_textdomain ?

  4. Stevesan
    Member
    Posted 1 year ago #

    I got a message back from the developer. I showed him your message above, this is what he says:

    "The load_textdomain is not used instead of load_plugin_textdomain. Also, use of load_textdomain can't break behavior of WordPress. It merely makes Codestyling Localization impossible to interfere in other plugins process. As you may know from the code above, the load_textdomain is used for loading a translation for a specific language (not current locale), there is no need for Codestyling Localization to interfere in."

    I'm no code guru, and I don't get any of this. I'm not sure if you talk about the same thing or if there's a misundrestanding involved or something.

    Thanks for helping!

    Steve

  5. ChristianMediastyle
    Member
    Posted 5 months ago #

    I'm having the same issue with "Author is using load_textdomain instead of load_plugin_textdomain function" while using a Barberry theme and Woocommerce. It makes the plugin Codestyling Localization unable to do any actual localization meaning no translation. There seems to be no solution from either Codestyling or theme developers.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic