1

I'm on Drupal 7 and to easily add an image to a string, I did this:

<img src="/icons/icon_32.png" height="32" width="32" /> My text here

I used this technique in several places: field labels, views titles, field values, etc.

Now I'm translating the site.

As it turns out, using the standard translation interface and the i18n modules (views, fields, etc.), field labels containing these img tags can be translated, but field values cannot. I'm also noticing other inconsistencies. Should strings containing HTML not be used with t() or am I doing something else wrong?

1 Answer 1

0

After looking into this for a bit, here's what I've found so far. t() runs everything through format_string(), which sanitizes/wipes out HTML such as the IMG tag. Hopefully someone who understands this better is able to provide greater insight into how it all works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.