• WPML takes care of all admin aspects. For the shortcode to properly work in the current language it is needed to filter out the non-current language sections. This can be done with this hack added to wp_resume.php

    // WPML doesn't filter get_terms directly (version WPML: 2.0.3 ; WP: 3.0.3)
    // This function will help exclude the non-current language terms when get_terms is called - therefore the resume sections.
    // Only works on pages specified within the function if enabled.
    add_filter( 'list_terms_exclusions', 'exclude_the_terms' );
    function exclude_the_terms($exclusions) {
     if (class_exists('SitePress')) {
       //if ( is_page( array ( 2017, 3000 ) ) ) {
           global $sitepress;
    
           $exclusions .= $sitepress->exclude_other_terms( '', array( 'taxonomy' => 'wp_resume_section' ) );
    
           return $exclusions;
       //}
     }
    }

    https://www.ads-software.com/extend/plugins/wp-resume/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ben Balter

    (@benbalter)

    Thanks for the heads up — had no idea.
    I’ll be sure this makes it into the next release.

    Plugin Author Ben Balter

    (@benbalter)

    rvencu, I am looking over this post and your other post on WPML, I am not too familiar with the plugin, but do you have any suggestions on how to implement these changes without breaking the code for users who do not have that specific plugin enabled?

    Is this related?

    Thread Starter Richard Vencu

    (@rvencu)

    Hi Benjamin,

    testing for WPML is done by this line

    if (class_exists('SitePress'))

    so to protect non-WPML users the above code should look like:

    add_filter( 'list_terms_exclusions', 'exclude_the_terms' );
    function exclude_the_terms($exclusions) {
     if (class_exists('SitePress')) { //if WPML we change the $exclusions
           global $sitepress;
           $exclusions .= $sitepress->exclude_other_terms( '', array( 'taxonomy' => 'wp_resume_section' ) );
     }
           return $exclusions;
    }
    Thread Starter Richard Vencu

    (@rvencu)

    The i18n is related, of course. If you plan to make your plugin translatable you need to take care of your hardcoded strings by including them in gettext calls.

    The code in the other post on WPML should not break non-WPML users. WPML introduces a lot of filters on almost every aspect of WordPress so most of the queries return only current language results. The above get_terms() function is an exception this is why we need to filter it. However it is most probable if a new version of WPML will include this filter then we need to revert and delete this custom code.

    When integrating with other plugins (of whom WPML might not be aware) we need to take care and add such filters for the non-standard queries.

    Please take a look at wpml.org, I know they give free license of the commercial version for plugin developers so you can get your copy and your support access and play with it. In my opinion cooperating with such a plugin can only open the interest to non-English based WordPress users.

    Plugin Author Ben Balter

    (@benbalter)

    Thanks for all your help. I added the above function to the development version (1.6b). If you have a moment to grab the zip and try it out, any feedback would be greatly appreciated.

    Plugin Author Ben Balter

    (@benbalter)

    I also added internationalization support if you would like to translate the backend as well. You can grab the POT file from the plugin itself, and WordPress has some instructions on the process

    Thread Starter Richard Vencu

    (@rvencu)

    Hi,

    I might be slow in checking the beta. I need to re-setup my dev site first.

    I know how to localize, I will check this too,

    Thanks,
    Richard

    Thread Starter Richard Vencu

    (@rvencu)

    I setup another test site I got and all seems fine so far. On the localization job please review this kind of translations

    //Custom post type labels array
    	$labels = array(
        'name' => _x('Positions', 'post type general name'),
        'singular_name' => _x('Resume Position', 'post type singular name'),
        'add_new' => __('Add New Position'),
        'add_new_item' => __('Add New Position'),
        'edit_item' => __('Edit Position'),
        'new_item' => __('New Position'),
        'view_item' => __('View Position'),
        'search_items' => __('Search Positions'),
        'not_found' =>  __('No Positions Found'),
        'not_found_in_trash' => __('No Positions Found in Trash'),
        'parent_item_colon' => '',
        'menu_name' => 'Resume',
      );

    I think they need to be translated against your textdomain as well.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP Resume] How to make WP Resume plugin multilingual with WPML’ is closed to new replies.