Search

Make Your WordPress Plugin Localization Ready

Listen to this article

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.

[space]

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.

[space]

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.

[space]

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.

Aparna Gawade

Aparna Gawade

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads