Those who want to localize any WordPress theme or plugin already know the hassles in doing everything manually. Previously they had to find every word in PHP and CSS files and translate it to their own language. But now mostly every theme or plugin comes with a PO file, so that you can just use that PO file and translate it to your own language. Nowadays Localization is very easy process because there are two ways to translate PO files.
- By using Poedit software
- Automatically by using Umpirsky
So firstly let’s learn how to do this with the help of Poedit.
Download Poedit and install it just like any other utility. Installing is really a breeze as it is really a small utility. (Make sure to download the correct version as per your operating system)
In the first run, it will ask for a preferred language for the user interface. Select the language in which you are comfortable to handle it. In this example, we selected English. Also it will ask for name and Email, just Cancel that step.
Now simply double click on the PO file which is supplied with your theme or plugin. It can also be in “languages” folder or in the root.
You will see the text in English and below that you can write the text in your own language. E.g. here if one wants to write the text for Error 404 – Page not found, so he would simply type Pagina no encontrada, to translate it to Spanish. Now select the second line which is “The page you are…” and translate it also. Follow the same process for all the lines. And finally press Ctrl + S to get the MO file.
But the problem with this method is that you will need to manually translate each and every word. So yes, you can also automate this method and save some of your precious time.
Now let’s take a look at the other method to translate PO file.
Localization using Google Translate API
Just head over to Umpirsky and paste the contents of PO file there. Open PO file in Notepad and copy the contents and paste it in this website. And then select the language in which you want to translate the file. E.g. Spanish. Finally click on Translate. This will use Google Translate API to translate. The outcome will be speedy, compared to the manual method which we saw in the previous method. But the problem with this automated method is that some words are not properly translated and there may be some grammatical mistakes also, as no one is doing anything manually.
So if you are one of that perfectionist type, then manual method is for you OR translate it through this website and then just improve the text later on. Use the one method which you like. Also to get the MO file, just go to File > Save and an MO file will be created at the same place where this PO is stored. Or you can just press Ctrl + S to save and you’ll get the MO file.
So which method you use to translate depends entirely on you. Use the manual or automatic method and your translated WordPress theme is ready to use.
Happy Localizing !