WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Localization issue (7 posts)

  1. Stevesan
    Member
    Posted 1 year ago #

    Hi.

    Thanks for this excellent plugin. It was a requested plugin for a theme I bought, and I think it's great!

    However, I have an issue. I use the Codestyling Localization plugin. It alerts me that your plugin isn't loading properly, see message below.

    If you can solve this issue, I'll PP you some bucks! :)

    Thanks!

    Steve

    Message from the Codestyling Localization plugin:

    Loading Issue: Author is using load_textdomain instead of load_plugin_textdomain function. This may break behavior of WordPress, because some filters and actions won't be executed anymore. Please contact the Author about that.

    http://wordpress.org/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    It's a wrong alert. Please contact the Codestyling Localization author about that.

  3. Stevesan
    Member
    Posted 1 year ago #

    Ahh... I see! Thanks for answering. Bucks coming soon! :)

    Steve

  4. Stevesan
    Member
    Posted 1 year ago #

    Hi again.

    I contacted the author of Codestyling Localization. He checked your code and says it's not a false alert. See his response below.

    Steve

    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 )

  5. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. Stevesan
    Member
    Posted 1 year ago #

    Just don't shoot the messenger. :)

    I guess why Codestyling Localization bothers with this code is because it is a translation plugin. But the thing is I'm no code guru (to say the least) so I'm just trying to find out what is going on.

    I'll let the author know your point above.

    Thanks

    Steve

  7. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, I didn't intend to shoot you! And forgot to say thank you for taking the trouble of telling the plugin author about this :)

    Actually I often see this Codestyling Localization message and got tired of explaining every time. Maybe the author assumes that every load_textdomain in other plugins is misuse of load_plugin_textdomain.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic