I am trying to shorten some words so they don't go on forever on my site. Where can I change the words under the stars from "Average" to "Avg" and "Your Rating:" to "you:"?

Thanks

Comments

quicksketch’s picture

Currently it's not easy to do within Fivestar. I'd suggest trying out the String Overrides module.

sammyman’s picture

I don't think that changed any of the vocabulary that I was hoping it would change. Thanks for the suggestion. The only one it worked on was "None" -> "N/A", haha.

quicksketch’s picture

I'm pretty sure it will work. You just have to look for the correct strings. For example it's "Average" not "Average:". String Overrides can replace any string that's wrapped in t() in the source code, and since Fivestar is fully translatable, it should find it just as the translated versions of Fivestar have.

sammyman’s picture

I tried "Average", "Average:", " average", "average" etc and nothing. Do I have to reset the cache or something?

quicksketch’s picture

I don't *think* you have to clear the cache, but it's not going to hurt clicking "clear all caches" on admin/settings/performance.

sammyman’s picture

hmmm. still no luck. I have tried %Average and everything. Thanks for the help though.

dawehner’s picture

the string is

t('Average')

If string overwrite does not work for you, you could enable the locale module and translate the ord into a custom english language, but using string overwrites should be much better

quicksketch’s picture

Category: feature » support
Status: Active » Closed (fixed)
leelooch’s picture

well, the problem is in line 257 of fivestar.theme.inc (v 7.x-2.0-alpha2) :

function theme_fivestar_summary($variables) {
 ...
    $output .= '<span class="average-rating">'. t('Average: <span !microdata>!stars</span>', array('!stars' => $average_stars, '!microdata' => $average_rating_microdata)) .'</span>';

t('Average: !stars') can't be translated as it contains forbidden html and should be changed to :

    $output .= '<span class="average-rating">'. t('Average: ').
    '<span ' . $average_rating_microdata . '>' . $average_stars . '</span>' .
    '</span>';
leelooch’s picture

Version: 6.x-1.x-dev » 7.x-2.0-alpha2
Category: support » bug
Status: Closed (fixed) » Needs review

reopening the issue so we can solve the t() string problem

astutonet’s picture

The code in #9 works to me.

whiteph’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Issue summary: View changes
Status: Needs review » Closed (duplicate)

Duplicate of Cannot translate Average: !stars. I've applied the patch there - it's in the latest 7.x-2.x-dev version.