• Resolved Flint

    (@flintstoned)


    Dear community,

    I’m struggling with adding the ability to translate my plugin.
    I’ve added ‘Requires at least: 4.6’ in the readme file and used for my echo
    echo __('my text', 'my-text-domain-same-as-plugin-slug');

    Also inside this PHP I’ve added Text Domain: my-text-domain-same-as-plugin-slug.

    When visiting the plugin link, I can translate the read-me file but can’t translate the string in the PHP file.

    While checking the slack channel, it says it’s all imported.

    Any ideas?

    Kind regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @flintstoned,

    Did you also added the header to the plug-in?

    /*
     * Plugin Name: My Plugin
     * Author: Plugin Author
     * Text Domain: my-plugin
     * Domain Path: /languages
     */

    Make sure the Text Domain: is same as slug (I believe in this case ‘my-text-domain-same-as-plugin-slug’)

    Also the Domain Path: is where the .mo and .po files are placed.
    Read HERE for more information.

    Thread Starter Flint

    (@flintstoned)

    Hi @helldog2018,

    Thank you for your reply.

    In the documentation I’ve read the following:

    After WordPress 4.6 came out, translations now take translate.ww.wp.xz.cn as priority and so plugins that are translated via translate.ww.wp.xz.cn 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.

    I understand from this, that if I add the ‘Requires at least: 4.6’ in the readme file, I don’t need the load_plugin_textdomain(). So my guess was that I don’t need a directory ‘language’ and a .mo file, or am I completely wrong and I still need a .mo file etc?

    Kind regards,

    • This reply was modified 8 years, 1 month ago by Flint.

    Hi @flintstoned,

    I believe that hosting your translation via translate.ww.wp.xz.cn your plugin must also be contributed via wp.org (I think if you are still developing the plug-in it is not being contributed yet).

    HERE is a tutorial on how to start creating your own internationalization for themes and plugins and how to eventually use the translate page of wordpress.

    Cheers.

    Thread Starter Flint

    (@flintstoned)

    Hi @helldog2018

    Alright! Thank you kindly for your guidance ;-).

    I’ll use PoEdit to make the files and follow this tutorial so I don’t need the Pro version to create po/mo files.

    Thanks!

    Kind regards,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Make plugin translatable – not working’ is closed to new replies.