Translate results in SP Polls and make stars instead of radio buttons - Forum | JoomShaper
Staff replied Extensions

Translate results in SP Polls and make stars instead of radio buttons

Asked by Meander 1 year ago Last activity 1 year ago

Hi,

I hope I'm posting this in the right category because I couldn't find a category for SP Polls.

However, I'm having trouble translating the Vote and Votes in the results.

I've already tried creating language overrides for the language strings COM_SPPOLLS_VOTE and COM_SPPOLLS_VOTES, but that doesn't work.
I've also cleared the cache and all cookies.

Secondly, I'd like to have star images instead of radio buttons.

I've already created an override for the module, and I think I need to look for it in this section of the default .php file:

<div class="radio">
                <label>

                    <input type="radio" name="question" value="<?php echo $key; ?>" <?php echo !is_null($vote) && ($value->poll == $vote) ? 'checked': ($key==0 ? 'checked': ''); ?>>
                    <img src="https://mysite.nl/images/example/ster.png" alt="Option 1" class="ratingstar">
                    <?php echo $value->poll; ?>
                </label>
                            </div>

I've managed to add an image (and set the radio input to hidden), but then you get (obviously) the same image for every vote, so I have to repeat it somewhere with the different options (Option 1 to 5), but I'm not very good at PHP.

Is there a way to simply get those 5 options, each with its own image?

Please see the image to see what I mean.

2 replies

Atick Eashrak Shuvo Staff

Hello Meander,

Sorry for the inconvenience. Regarding the translation issue, unfortunately, those phrases are hardcoded and not directly translatable. To translate them, you would need to modify the code in the file JRoot/components/com_sppolls/layouts/results.php on line 23.

Concerning the star replacement, it isn't possible to use images directly. However, you can use star emojis. You can find some here: https://emojicombos.com/star.

Hope this helps!

Best regards

Meander Asked this

Thank you.

Regarding the translation, I would have to upload that .php file again after every update because I can't override it, right?

Atick Eashrak Shuvo Staff

Yes

Log in to reply.