All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Please read about the changes to BoldMinded add-on licensing.

Ticket: Cannot translate cookies consent cookies titles

Status Resolved
Add-on / Version Publisher 3.5.3
Severity
EE Version 6.3.4

pixi

May 09, 2022

Hi Brian,

I have phrases named for example : consent-title__ee_cookies_targeting

I want to translate cookies titles in the cookies consent loop with the exp:publisher:translate_phrase tag. But it doesn’t seem to work.
As I can’t name a publisher variable with a “:” symbol in it, I use the plugin Stringer to replace the semicolon with an underscore.

{exp:consent:form}
{consents}
{exp:publisher:translate_phrase name="consent-title__{exp:stringer:find_replace find=':' replace='_'}{consent_short_name}{/exp:stringer:find_replace}”}
{/consents}
{/exp:consent:form}

It gives me “consent-title__ee_cookies_targeting” instead of the current language translation.

Any idea? A bug?

Thanks in advance.

#1

BoldMinded (Brian)

This isn’t a bug, phrases are variable names similar to custom fields, and as such I’ve made them follow similar naming scheme and don’t plan on changing that. Unfortunately I don’t have a better suggestion at the moment though.

#2

pixi

I understand but what I don’t is that {exp:publisher:translate_phrase} tag is to use when you have a phrase name from another module variable or custom field value according to the doc.

The phrase name seems to parse correctly (it “prints out” the correct phrase name) but why it doesn’t give the translation, I don’t know… it should work according to the docs.

May I ask you to test it on your end to see if it works please?

#3

BoldMinded (Brian)

I don’t think I need to test it on my end b/c I know it works if the phrase name that is passed to the tag is correct. I’m guessing it might be a parse order issue because your exp:stringer:find_replace tag is inside another module tag. Try adding parse=”inward” to the translate_phrase tag.

#4

pixi

Indeed a parse order issue, always had problems with parse order. Hahaha obviously I tested the parse inward in the stringer tag, it could not work then! Thanks for the solution, adding parse inward to the translatee_phrase tag fixed it! 😉

#5

BoldMinded (Brian)

Huzzah!

Login to reply