Tip: Translating complex strings in WordPress

Very often i see people that don’t really bother about translation when they work on a WordPress project (theme or plugin), and it’s really annoying when you want to use the code with another language. And what happen is that when people deal with internationalization, they don’t do it that well… So this little tip is just to remind you that when you need to translate strings that contain variable elements, there’s a way to it simply, just have a look at the code above:

About the author

Remi Hey! My name is Rémi Corson, I'm a French WordPress Developer, I code stuff and I write from time to time ;-) Buy a coffee
Show your support

Related Posts

4 comments

  1. Rémy:

    How can we handle translated strings with html in it ? For example, a header title with a span inside to apply some styling for a part of the text ? Is it necessary to translate them separetely ?

  2. kress:

    Remi, what do you think about translating wordpress strings with localization tools? I would totally recommend https://poeditor.com/ as a good method to do it. Except for its user-friendly interface and helping features for translators, it also has a plugin for wordpress that allows you to transfer your translated strings directly on your website. What do you think?

Leave a Reply