I have a lot of panels to which I have added bits of text/HTML using the "New custom content" option of the Panels module.
By default, such text does not show up on the Translate Interface screen. How should I go about translating them?
Two approaches I have found are:
- Changing the custom content text format to
PHP codeand printing the string(s) of text using t(). This then allows me to translate the strings on the Translate Interface screen, but I worry that injecting PHP code like this is a bad precedent.
- Since I only have two languages, I can add a second piece of custom content that is localized in the other language. Then, I can add a visibility rule to each piece of custom content in Panels and set each piece to show only when the user's language matches the content language. This works but it is time consuming and ugly on the backend. It would be even worse if I decide to add more languages to my site in the future, which I may do.
Is there a more efficient, maintainable way to translate such custom content?