Technology WordPress Tips & Tricks

Make Your WordPress Plugin Localization Ready

A localization ready plugin can reach a global audience in their own language. Here is how to make your WordPress plugin localization ready, so your code is prepared for translation from the start instead of as an afterthought.

Aparna Gawade Aparna Gawade 3 min read

Localization SupportWordPress Plugin developers do their best to meet client expectations. After development a lot of work is put into testing compatibility, performance, etc. You want your plugin to be free of any issues when you provide it for download or purchase. Similarly, in an attempt to reach customers across the globe, a feature many plugins provide is localization support. Now, I’m steering clear of the word multilingual, and there is a reason for this.

Many people who purchase or download plugins, do not understand the difference between multilingual support and localization support. Localization is translating strings to a local language. Multilingual, is the ability to translate strings in multiple languages. Okay, so at first glance you might not notice a difference, so let’s take an example.

 

Multilingual Support v/s Localization Support

You must’ve come across a website, which provides you the option to switch between several languages. This kind of website, is a multilingual website. For multilingual support, your plugin, should provide live translation of strings.

Another shade of the spectrum, is a local language website. Where the text is only in a single language, local to a particular country or region. WordPress can be used in any language, because it has support for translation. You can test this, by changing the language in your config file. Set WPLANG to another language, using the language code.

Providing Localization Support

WordPress uses GNU gettext framework to provide localization. gettext provides translation, on per message basis. All the message strings in your plugin should be passed into one of the two PHP functions; __() or _e(). To make a plugin localization ready, you need to provide a .pot file. Using this .pot file, all the strings can be translated to a particular language, and .po and .mo files can be created for that language. Details about .pot, .mo, .po files can be found under Translating WordPress.

Guidelines to be followed by Developers to provide localization support:

  • Ensure that all messages are passed in __() or _e() function.

  • Provide a text domain to simplify localization. A text domain identifies all strings belonging to a plugin.

  • Use a tool to create a .pot file.

  • To localize a plugin, a user just needs to then create .po and .mo files for the particular language.

The Poedit tool is a translation tool, which can be used to generate and edit such files.

Providing Multi-Language Support

Providing multilingual support can be a little tricky. Usually many websites use a translation plugin to provide multilingual support. Considering WPML is by far the most popular, it provides a detailed guide, on how to translate text from other plugins. Other plugins have their own methods. But do be wary of certain translation plugins that use automated translation. Translated content could be tagged as duplicate and your site could be penalized by search engines like Google.

Nevertheless, internationalization support is part of the plugin development guidelines as specified by WordPress. They should be followed to extend the usability of your plugin and target a wider audience.

Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

Start with a Free Consultation

    Your Name *

    Website (Optional)

    Work Email *

    Project Details *

    Can't submit the form? Contact us at sales@wisdmlabs.com