

Notice I am passing in a second parameter ‘my-plugin-domain’ to these functions. Or you could have used the _e() function to translate and echo: _e('I am translatable', 'my-plugin-domain') An example will explain best: //this string is not translatableĮcho _('I am translatable', 'my-plugin-domain') Rather wrap them with the WordPress functions _() or _e(). Whenever you use a string in your code files, don’t just echo or print them out. Now back to the code… Write Code With Localization In Mind His “sister-post” to this article is particularly inspiring this week and I recommend you check it out. His posts always give great insight into how he found my articles, along with any hurdles he had. Tell your plugin to use your translation files.Īs you may know, Matt is following this tutorial and posting his results on his own blog.Prepare/generate your translation files.Write your code with localization in mind.Read up more about localization in WordPress.This is what you need to do in order to make your plugin translation ready: But it does provide a really easy way for your plugin users to provide their own translation files. But making your plugin ready for translation doesn’t mean you need to do the translations yourself. Why make your plugin translatable, you might ask? Well, to increase your plugin’s target audience by allowing any person, who speaks any language, the ability to understand and use it. WordPress provides us with all the tools (and functions) we need to make our plugins translatable or localizable.
