Best practice to add long text for localization?
-
In a plugin I would like to display several paragraphs of HTML-formatted text, with large passages without any PHP or variables inside. So far I’ve been using the usual __() or _e(), wrapped by the HTML tags and concatenated. The problem I see is that:
- The code becomes very bloated and difficult to read.
- Translators only see one sentence at a time and don’t have the context. So, resulting sentences might not fit together.
- Depending on the progress of translators, the result might be a mixture of original and target languages.
- The text is a bit difficult to browse and edit.
Now I was thinking about simply including the entire text in one go from a separate text file that contains nothing but that text. Is it still possible to make this text available for localization? Do I have to wrap the text in the external file in _() and execute it as PHP script? Or is there any way how to tell WordPress that this is translatable content and what is the text domain?
Thanks for sharing your experiences!
- The topic ‘Best practice to add long text for localization?’ is closed to new replies.