If you translated a theme/plugin, you can give a huge help to the community by sharing your translation. It will automatically generate a MO file after saving the PO, and your project will use them to show the strings in that language. If you want to do it by yourself, open Poedit, click on File > New from POT/PO file, find and select the POT you just created, and then choose the language you want to translate it to. From now on, translators will use it to create their translation. Delete the MO file since you don’t need it for a catalog, and rename the PO file changing the extension to POT. Save it again and open the folder where you saved it. This is the project’s catalog, it does not need to be translated. Poedit will scan each single file in your project (by following the paths and keywords specified in the catalog properties) and will extract all the needed strings, adding them to the catalog.Īt the end of the scan you should have something like this (probably with more than two strings only):ĭo not translate anything here. Click on Extract from sources to scan all the files inside your project. In the case of a WordPress project, they are the translation functions, like _(), _e(), _x(), etc.īut you can’t write them like this, there are specific rules to follow, you also have to specify what the functions get as parameters to let Poedit know if the first string in the function is the source text, a comment for the translator, or something else, so add this in the keywords box, by using the + button at the bottom of the box: _Īfter doing so, your Source keywords should look like this:Ĭlick on Ok to save the properties and now you are ready to add the project’s strings to the catalog. Here you have to specify the functions used in your project to translate. If you saved the project in the folder /languages or /i18n inside your project folder (and you really should save it there), the Source paths tab should now look like this:Ĭlick now on the tab Source keywords. Open again to the catalog properties and click on the tab Source paths and click on the + just below the box Paths. It will be saved as a PO file, but don’t worry, you will change the file extension later. Go to Catalog > Properties and configure the translation properties like in the screenshot below: With Poedit, you need to configure the catalog to get it working properly with WordPress. So a translator can use that catalog to translate the project in his language. It has all the strings included in your project, ready to be translated. Now there’s a new file to learn about, it’s the POT file.Ī POT file is a catalog for the original language of the project. In the first article of this series I explained what are PO and MO files. It’s worth to mention here what a catalog is. After this, you need to configure the catalog. Here you have to choose the original language of your project, not the language you want to translate the theme/plugin to. So, click on File > New and choose the language of your translation. If you want though, feel free to support the project and upgrade Poedit to the PRO version. To create a new WordPress project it says that you need to upgrade to PRO, but you don’t really need it, in fact I never used the PRO version and I was always able to translate WordPress projects, only you need some more steps to set up the project. You should see a screen like this:Īs you can see, it has a PRO version too. When you are done, open it for the first time. Download it from here and go through the installation wizard to install it. Installing Poedit is easy as is for any other program in Windows, OS X or Linux. In this tutorial though, you will learn how to use it to translate your WordPress theme/plugin. It does not only work with WordPress, but with anything that uses the gettext package to manage translations. Poedit is an open source ( MIT license) program available for OS X, Windows and Linux. Yesterday I wrote about how to translate WordPress themes and plugins with Loco Translate and I mentioned also another method, which is by using Poedit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |