3

Several users of my RSVPMaker plugin have submitted translation/localization files that I have redistributed, but for some reason the page in the WordPress.org repository that is supposed to help with translations displays a message saying:

This plugin is not properly prepared for localization.

I've gone over the localization coding guidelines several times and worked to weed out issues I thought might cause problems such as line returns in strings coded with the __( and _e( functions. Doesn't seem to have made a difference.

Again, my code actually works to load translation strings, but seems to be missing something that the translation repository is looking for. Unfortunately, no debugging info.

Here are the relevant lines of code from the header and first few lines of my plugin that load the localization files in case you spot something wrong here:

/*
Plugin Name: RSVPMaker
Description: Schedule events, send invitations to your mailing list and track RSVPs....
Author: David F. Carr
Version: 4.3.3
Text Domain: rsvpmaker
Domain Path: /translations
*/

$locale = get_locale();

$mofile = WP_PLUGIN_DIR . '/rsvpmaker/translations/rsvpmaker-' . $locale . '.mo';

load_textdomain('rsvpmaker',$mofile);
1

I figured it out almost immediately after asking the question, after months of frustration. The issue was I was using the load_textdomain function (which was the way I learned it) instead of the apparently newer/favored load_plugin_textdomain.

The working code looks like this

function rsvpmaker_load_plugin_textdomain() {
  load_plugin_textdomain( 'rsvpmaker', FALSE, basename( dirname( __FILE__ ) ) . '/translations/' );
}
add_action( 'plugins_loaded', 'rsvpmaker_load_plugin_textdomain' );
1
  • 1
    Small hint. If you use always the translation via GlotPress, from the repository, the translation service, of wordpress.org is the path not necessary. Only the domain key is enough, like in your context load_plugin_textdomain( 'rsvpmaker' );
    – bueltge
    Dec 14 '16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.