To do this, simply click on the string you want to translate and enter its translated in the “Translation here” box. Now that you have created a new copy, you can begin translating the strings. You can see a complete list of language codes here, and a list of country codes here.
This is the language code plus the country code. Second, note the “de_DE” part of the name. Note that first my file is prefixed with my plugin text domain.
In my case, I am translating to German, so I save my file as “fsb-de_DE.po”. po file for the specific language you are translating to. If you want to go ahead and do the translation, read on.įirst (with the default.po) file still opened, click on the File Menu and go to Save As. If you do not intend to do the actual translation of your plugin, then you can skip to the last step where we change the language WordPress displays in. po file after clicking “OK” in step 4 above.
If you’ve done everything correctly, you will see that all of your text strings have been automatically pulled into your. po file into your plugin’s “language” folder. These keywords are used to automatically parse the PHP files and pull the strings that need translated into our. Click on the “keywords” tab and enter _ (that’s a double underscore) and _e for the keywords (these were used in step 2 to localize the plugin).I also have an “includes” folder in my plugin, so to ensure that all of those files get processed, I need to add “includes” as a path. po (the file format) catalog will be stored. I created a folder called “languages” in my main plugin folder, and this is where my. Click on the “paths” tab and enter the path for the files that needs translating.Enter a name for your project – I used the same as my prefix and text domain: “fsb”.Open the program then click on File > New Catalog.It runs on just about every platform, so regardless of whether you are using Mac, Windows, or Linux, you will be fine.
The first thing you need to do now is go and download the Poedit program. Step 3 – Create the Translation File For Text Domain Once you have done that, you are ready to translate your plugin. You will need to replace all text in your plugin with one of these functions.
Your’s will differ slightly, but the exact function call I used in my Full Screen Background Images Pro plugin looks like this:
To load the plugin text domain, we are going to use the load_plugin_textdomain() function. By loading the text domain, we tell our plugin to display in the language that is defined in the wp-config.php file. The plugin text domain is what determines which language the plugin text is displayed in. The translation is then displayed instead of the original text. When WordPress is set to display in a language other than the default (English), the catalog is used to look up the appropriate translations for each piece of text. It works by storing all of your plugin text into a “catalog”, which acts as a reference and has all of the text translations stored in it. While it may sound very difficult and time consuming, making a plugin ready for translation (and even translating it) does not take long, nor is it difficult. To help you out, I’m going to provide basic instructions after the video in text form, but the majority of explanations will take place in the video. I’m going to do this by translating part of one of my plugins, Full Screen Background Images Pro.
So I’d like to take you in depth on the topic and actually demonstrate how it is done.įor this tutorial, I’m going to start from the beginning and actually show you how to setup your plugin for translation (this means localizing it). Making your plugin ready for translation is actually a pretty simple task, but, unfortunately, has very, very little good documentation on how it is done. If you are one of those that is blessed with the fluency of more than one language, then you can also translate it, but for the majority of us, localizing will be enough. This means make it “ready for translation”. In order to be kind to our friends that do not speak the language we have written our plugin in, it is always a good idea to fully localize your WordPress plugin.