WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering what is the best way to translate some longer texts with html formatting. There was a couple of solutions I came across, but did not know what would be the best one.

  • Writing a couple of html files with language extension (e.g. maintext_en.html, maintext_de.html, ...) and import this files.

    Pro: It's easy for me

    Contra: Not so easy for translators

  • Writing only one html file with some markers and parse the file.

    Pro: A bit easier for translators, they have to edit only one file.

    Contra: I need a parser

  • Using l10n inside the code

    Pro: The easiest way for translators

    Contra: Uses a lot of memory when the plugin runs. And the risk of losing some formattings.

What is the best and most efficient way to make long texts within a plugin translateable?

share|improve this question
up vote 1 down vote accepted

Most translation tools are really hard to use when you try to handle a long text, so the translators have to use a HTML editor anyway. Use separate files, but use the language prefix as directory name:

  • en
    • main.html
    • help-main-options.html
    • help-special-options.html
  • de
    • main.html
    • help-main-options.html
    • help-special-options.html

That’s easier to handle for translators and for you too.

You could also set up a WordPress site for translations and use a custom post type, so translators can use the regular editor (outdated example), and you handle just the import and export.

share|improve this answer

Using gettext is the only proper way translations in WordPress, but it really depends on the context.

In my themes, for example, I always have a place in footer for some copyright text and whatnot. I can assume that this text will be changed by any user (even the English-speaking one), so using gettext in this context is a little bit pointless, as user would have to go through the entire process of translating the theme just for the footer text. For this purpose I use WordPress settings API and create an option page that lets users choose their own footer text.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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