Translate Select Attribute Values
Permalink
Hello,
I'm having trouble displaying translated select attributes values on a site I'm working on.
The values appear in the Translate Site Interface but don't update on the site. Lots of other strings are translating fine, but not attributes. Is there something else I need to do?
I already tried wrapping in the template with t($value) and tc('SelectAttributeValue', $value ) but that returns empty.
Any suggestions?
Thank you
I'm having trouble displaying translated select attributes values on a site I'm working on.
The values appear in the Translate Site Interface but don't update on the site. Lots of other strings are translating fine, but not attributes. Is there something else I need to do?
I already tried wrapping in the template with t($value) and tc('SelectAttributeValue', $value ) but that returns empty.
Any suggestions?
Thank you
Any help on this issue would be great. Having to duplicate each tag is the only alternative I can find right now.
This discussion is old, but I had the same problem recently.
When you use
tc('SelectAttributeValue', $value );
the variable $value must be a string, otherwise it will not work.
So, I solved the problem doing this:
Hope it will help!
When you use
tc('SelectAttributeValue', $value );
the variable $value must be a string, otherwise it will not work.
So, I solved the problem doing this:
$value = $page->getAttribute("my_select_attribute"); // now $value is an object $value = "".$value; // now $value is a string tc('SelectAttributeValue', $value );
Hope it will help!
Use this instead:
$translated = $page->getAttribute("my_select_attribute", 'display');
You are right, this is the right way to do it.