• Resolved agundabbo

    (@agundabbo)


    Hi guys.
    I would like to translating a plugin in my language, but it has not any pot file. So I try to modify a simpler plugin to learn how to do so.
    This is the plugin I use for my tries.
    https://github.com/wpexplorer/ban-users-wordpress-plugin/blob/master/ban-users-wordpress.php
    And the modification I have done are the following:

    //Text Domain: ban-users
    Domain Path: /languages/

    In function rc_admin_init(), I insert

    load_plugin_textdomain('ban-users', false, basename( dirname( __FILE__ ) ) . '/languages' );

    Then in the end I modify the print string in this:

    return new WP_Error( 'rc_banned', '<strong>'.__('This account has been suspended.', 'ban-users').'</strong>' );

    Then I made the .pot file manually(coping from other plugin) and generate the .po and .mo with poedit, but the whole process does not work. Can you tell me what I am missing?
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter agundabbo

    (@agundabbo)

    Sorry if I double post but I have figure how makepot works.
    But I have a problem: i have done these two modification before creating the pot

    />Check to ban this user <
    /><?php _e('Check to ban this user','ban-users')?> <

    and

    WP_Error( 'rc_banned', __('This account has been suspended', 'ban-users'))

    The first modification works fine, I have the string displayed like I set in my .po/.mo file.
    The second one instead does not work but I do no figure why. Maybe with WP_error there are some issues?
    Thanks

    Thread Starter agundabbo

    (@agundabbo)

    Ok, I get it.
    I have to load the load_text_domain also where/when the wp_error is called.

    You can close.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem when translating a plugin’ is closed to new replies.