Translating long texts with html formatting

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.

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

Related posts

Leave a Reply

2 comments

  1. 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.

  2. 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.