Most WordPress themes are developed and built in English. But what happens if your target audience speaks only Spanish, French or Japanese? Obviously, you need to translate your whole website so they can use it. Maybe content is not a problem, as you are the one writing the articles, but the text strings associated with the theme all come in English. This might cause you problems. In this article, I am going to show you how to translate a website or a plugin in WordPress.
Website language mechanism explained
The content (articles and posts on your page) is stored in the database. The text strings are included in .php files and can be visible in your frontend or backend of your website.
Tip: by text strings, I understand buttons (like the ones in your shopping cart, not the ones in your menu), automatic messages you might receive when working with different functions on your website (like the search box), login/register forms and so on.
All these text strings can be modified using POT (Portable Object Template) files. You will find these files (list of all the original text lines that need translation) in the language folder of your theme or plugin.
Beside the POT file, you might notice another two files. PO (Portable Object) and MO (Machine Object). These two files contain the actual translation (the original text in one column and the translation on the other column). One is human readable (PO) and the other one is encrypted (MO). They look something like fr_FR (from French – fr of France – FR). Find the list of all languages abbreviations accepted in WordPress here.
How to translate a website or a plugin in WordPress
Now that you know where you can find the files that need to be translated let’s see how exactly you can do it. For that, we will use a plugin called Loco Translate. There are a lot of other plugins for this purpose, but I find this to be the easiest and more intuitive one.
Install and activate it like any other plugin. Then go in Dashboard -> Loco Translate -> Themes, select the theme you want to translate and click on “New Language” button.
After selecting the language you want, click on Start translating. All there is left to do is to translate each line you want to be displayed in other than English.
Once you are done, go to Dashboard -> Settings -> General -> Site Language and select the language you just translated the website in. Refresh your page and as a result, you should see all displayed in the language you choose.
Hint: the same procedure applies for translating a plugin.
Therefore, it is really that simple to translate a website or a plugin in WordPress. Let me know if you have any questions or you recommend any other plugin for this. Thanks!
Tip: feel like learning more about WordPress? Have a look at my other related tutorials:
- Remove the password strength meter! Register button disabled in WooCommerce.
- Plugins for WordPress. 4 “MUST have” plugins!
- What is an RSS feed and how you can use it
- How to create an RSS feed for each category in WordPress
- How to truncate an RSS feed – display only a part of your post
- Image quality loss after uploading in WordPress?
- How to create One Page menu in WordPress