Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Internationalize your WP plugins

Tuesday, January 24th, 2012 by Servage

If you’re developing WordPress plugins, remember that sharing them is really great for anyone facing similar needs as you. However, sharing plugins only makes sense, if the plugins have a decent quality. That meant obeying to general coding standards, documenting source code etc. This not only helps others understand your code, but also yourself (have you ever tried understanding an own, poorly written, and undocumented piece of code a year after you wrote it?).

In addition to general standards and good practices, you should consider internationalizing your plugin as well. That doesn’t mean you have to translate it into various languages, but merely that you use functions which prepare your plugin for other language versions. In WordPress this is done simply by using a function every time you output something. Why? Well, when using different languages, these functions determine the correct output text. It may sound like a big thing, but once you’re going, its actually pretty simple. This is all you need:

Instead of:
echo 'The text.';
Use this:
__('The text.');

If you want to get started, check out these resources that explain internationalization-issues more in depth:

Internationalize your WP plugins, 3.5 out of 5 based on 2 ratings
Categories: Tips & Tricks


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.