O'Reilly logo

WordPress® All-in-One For Dummies® by Michael Torbert, Andrea Rennick, Kevin Palmer, Cory Miller, Lisa Sabin-Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Internationalizing or Localizing Your Plugin

WordPress users exist across the United States, Russia, Japan, Germany, and all points in between. Therefore, the next person to download and use your plugin may not speak the same language you do. So if you wrote and distributed your plugin in English, it may be useless to the next person to download it if he only speaks German. However, the WordPress software has internationalization built into it, which means it can be localized, or translated, into different languages.

image You aren't translating the file into different languages, unless you want to. Rather, you're providing a mechanism of support for people who will want to provide translation for your plugin through the creation of .mo (machine object) files (discussed later in this chapter). Many people in different countries create (and have created) .mo files for the translation of WordPress into different languages; by providing localization for your plugin, you're enabling them to translate your plugin text, as well. (If you're interested in translating WordPress into a different language, check out this resource page in the WordPress Codex at http://codex.wordpress.org/Translating_WordPress.)

Using GetText Functions for Text Strings

WordPress provides you with two main localization functions: __ and _e. These functions use the GetText translation utility installed on your Web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required