WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Translate options for checkboxes and dropdown (4 posts)

  1. emcyze
    Member
    Posted 6 months ago #

    Hello,

    I have just upgraded to WP-members 2.9 and THANKS for the improvements.

    I have successfuly integrated WPML with this version for translating field labels.

    Although, option values for checkboxes and dropdown do not show translated..

    Any idea what i am doing wrong?

    https://wordpress.org/plugins/wp-members/

  2. Chad Butler
    Member
    Plugin Author

    Posted 6 months ago #

    Part of the intent with this release was to move the translation strings toward better WPML integration. It might take one or two more releases during the 2.9 release cycle to get everything right, though.

    So, I do see where we can add a translation string for the dropdown. I think if you change line 82 in utilities.php (in the wpmem_create_formfield function) from this:

    $str = $str . "<option value=\"$pieces[1]\"" . wpmem_selected( $pieces[1], $valtochk, 'select' ) . ">$pieces[0]</option>\n";

    to this:

    $str = $str . "<option value=\"$pieces[1]\"" . wpmem_selected( $pieces[1], $valtochk, 'select' ) . ">" . __( $pieces[0], 'wp-members' ) . "</option>\n";

    That would allow you to translate what displays to the user in the dropdown.

    But I don't think you'll want to change the option values of either checkboxes or dropdowns. These are the values if the option is selected and they need to be compared against a value to determine if they are checked or selected. If that value is translated, that process may not work correctly.

  3. emcyze
    Member
    Posted 6 months ago #

    Thanks Chad,

    It's a perfect solution.

    It feels like WPML and Wpmembers are going to tie the knot ;)

    Thanks again and
    Best regards,

  4. emcyze
    Member
    Posted 6 months ago #

    Forgot to close the ticket.
    It solved the issue.

Reply

You must log in to post.

About this Plugin

About this Topic