WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Comment Rating Field Plugin] Multi language site

[Resolved] [Plugin: Comment Rating Field Plugin] Multi language site

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tim Carr

    @n7studios

    Hi Marco,

    If you’d like this to be included in the plugin, send through the changes you’ve made and I’ll merge these into the next release.

    Thanks,

    Tim.

    Hello,
    There are two strings that needs localization (at least for the frontend side), both are set in file jquery.rating.settings.js:
    – “Rating”
    – “Cancel rating”
    The latter should be added as a parameter ‘cancel’ to the jquery rating plugin initialization.
    The recommended way for javascript localization is described here in the codex.

    Here’s the JS code:

    jQuery(document).ready(function($) {
        if ($('form#commentform textarea[name=comment]').length > 0) {
            $('form#commentform textarea[name=comment]').after('<p><label for="rating-star">' + crfpL10n.rating + '</label><input name="rating-star" type="radio" class="star" value="1" /><input name="rating-star" type="radio" class="star" value="2" /><input name="rating-star" type="radio" class="star" value="3" /><input name="rating-star" type="radio" class="star" value="4" /><input name="rating-star" type="radio" class="star" value="5" /><input type="hidden" name="crfp-rating" value="0" /></p>');
        	$('input.star').rating({cancel: crfpL10n.cancel_rating}); // Invoke rating plugin
        	$('div.star-rating a').bind('click', function(e) { $('input[name=crfp-rating]').val($(this).html()); }); // Stores rating in hidden field ready for POST
        	$('div.rating-cancel a').bind('click', function(e) { $('input[name=crfp-rating]').val('0'); }); // Stores rating in hidden field ready for POST
    	}
    });

    and here’s the PHP code:

    ...
    wp_enqueue_script('crfp-jquery-rating-settings');
    wp_localize_script( 'crfp-jquery-rating-settings', 'crfpL10n', array(
    	'rating' => __( 'Rating' ),
    	'cancel_rating' => __( 'Cancel Rating' )
    ) );

    Note: the above code is to be tested.

    Plugin Author Tim Carr

    @n7studios

    Hi Marco,

    Options have been added to 1.4 to allow the rating field to be defined.

    All strings within the Administration Panels have been set for localisation, although no translations are provided as yet.

    Hope that helps.

    Tim.

    Hi Tim,
    thank you very much for this update, I’ll try it as soon as possible.
    I think I should be able to provide an italian translation for the plugin in the near future.
    Cheers,
    Marco

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Comment Rating Field Plugin] Multi language site’ is closed to new replies.