• Resolved pmdci

    (@pmdci)


    Hi there,

    I am having a hard time trying to localize a plug-in called custom-taxonomies and I would appreciate some help.

    I ran POEDIT against the sourcecode of the plug-in (I have used POEDIT to localise themes and plugins before), and I successfully translated all the strings and saved the localisation as custom-taxonomies-pt_BR.po and custom-taxonomies-pt_BR.mo

    Then I added the following code in custom-taxonomies.php file. This is the first function being called at the very top of the file, just after the license comments:

    // Enable internationalisation
    $plugin_dir = basename(dirname(__FILE__));
    load_plugin_textdomain( 'custom-taxonomies', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );

    OBS: I checked other plug-ins which can works with localisations and this is pretty much the way they enable internationalisation. Please correct me if I am wrong.

    2) Then I uploaded my translated files custom-taxonomies-pt_BR.mo and custom-taxonomies-pt_BR.po (even though I am quite sure this one is not necessary) to the plug-in’s root directory.

    However, for some reason this plug-in just doesn’t want to be localised!!! Can someone please advise?

    Thanks,
    P.

Viewing 1 replies (of 1 total)
  • Thread Starter pmdci

    (@pmdci)

    I found the solution. Basically the author of this plug-in didn’t prepare it enough for localisations. This is what needs to be added to the very first function in custom-taxonomies.php:

    // Enable internationalisation
    $plugin_dir = basename(dirname(__FILE__));
    load_plugin_textdomain( 'custom_taxonomies', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );

    You can see that the textdomain for this plug-in is custom_taxonomies and NOT custom-taxonomies (which is how the plug-in is called, its directory and its main php file). By replacing custom-taxonomies with custom_taxonomies in the above function, everything works fine.

    you MUST add this function in the custom-taxonomy.php file as the very function at the top, just after the license comments. The author of this plug-in haven’t added this. Without this function, it would never load the localisations.

Viewing 1 replies (of 1 total)
  • The topic ‘Help translating a plug-in: custom-taxonomies (doesn’t work)’ is closed to new replies.