WordPress translation with PoEdit

W

I was there, too, struggling to make a proper settings in my PoEdit program and prepare all the strings for WordPress translation.

But there is always some quirks there that made me go Oooh. Tried everything, premium plugins and stuff, those plugins are good, but when you’re on a deadline, you always mix languages in translation strings.

Anyway, first thing to know is that you always develop in English first. That is the way to go, and that way you will not have problems with mixed languages later.

Don’t be tempted to add those Chinese that your client gave you in your translate string. You will regret it later.

I will not talk much and will give you a link where everything is explained. This guy deserves it. Thanks to Luka Peharda for the link to this awesome resource.

So, go to WordPress translation secrets and enjoy. This guy has it all, and what is the most important, that I could not find anywhere, is the configuration for the PoEdit to suck in all those WordPress translation functions easily.

Poedit needs to know what functions it must look for and get information from. In reality, gettext knows by itself what to look for in a .php file, but since WordPress uses its own wrapper functions to make our lives easier, this knowledge is no longer applicable.

In a few words, you should add this stuff to your PoEdit preferences to make it dance with WordPress translation:

_e
__ngettext:1,2
_n:1,2
__ngettext_noop:1,2
_n_noop:1,2
_c
_nc:4c,1,2
_x:1,2c
_nx:4c,1,2
_nx_noop:4c,1,2
_ex:1,2c
esc_attr__
esc_attr_e
esc_attr_x:1,2c
esc_html__
esc_html_e
esc_html_x:1,2c

After you have this, no string will ever escape from PoEdit (if properly put in translate function, of course).

Again, many thanks to Anastis Sourgoutsidis who made my life easier.

About the author

Zvonko Biškup

A passionate web developer with more than 13 years experience in PHP and other web related technology. My main interest is WordPress and new PHP frameworks.
Owner of Influendo Programming.
Enjoys exploring new stuff and possibilities, using new technologies and just having fun developing awesome stuff.

<span class="dsq-postid" data-dsqidentifier="1889 https://www.codeforest.net/?p=1889">3 comments</span>

By Zvonko Biškup

Tags