I am following this official guide to internationalise my plugin. But I am confused if the hints are must required incase of variables inside string?

    /* translators: 1: Name of a city 2: ZIP code */
    __( 'Your zip code is %2$s, and your city is %1$s.', 'my-plugin' ),

Also in this documentation, no where it is mentioned to use load_plugin_textdomain to load the text domain. It is only mentioned about the Domain Path. So can I omit load_plugin_textdomain if I use Domain Path?


The notes to translators aren't required, as far as I can tell, but they will definitely help anyone out who's trying to translate your plugin. You might want to think of them as best practices rather than requirements.

As to your second question:

Since WordPress 4.6 translations now take translate.wordpress.org as priority and so plugins that are translated via translate.wordpress.org do not necessary require load_plugin_textdomain() anymore. If you don’t want to add a load_plugin_textdomain() call to your plugin you have to set the Requires at least: field in your readme.txt to 4.6.
— from the docs

So I gather that, if you intend your plugin to be translated by the community at translate.wordpress.org, you don't need to call load_plugin_textdomain(). However, if you're not going to be distributing your plugin through the official WordPress repository (eg, you'll be using GitHub or your personal site to distribute it), you might still need to load_plugin_textdomain().

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.