Translating content with Polylang
In a previous post we took a look at, possibly, the most popular translation plugin for WordPress, WPML. Continuing on with our translation theme, today we’ll take a look at the most popular free plugin currently on the WordPress plugin directory, Polylang.
Getting started with Polylang
The basic version of Polylang is free and it will most likely be all you need. There is also a pro version of the plugin available on its site offering advanced features and premium support.
The plugin’s installation is similar to any other plugin’s, just navigate to Plugins > Add New and search for ‘polylang’, install and activate it.
After activating the plugin you should navigate to Languages > Languages to add your desired languages. First choose the default language from the drop down list, all other boxes will be filled automatically, just click Add New Language. Once the first language is added you will get a notice on top which suggest adding all existing content under the newly added language.
Set all the items to the default language and proceed to add the rest. Once all languages have been added you can start translating.
Translating a post
To translate a post, edit it and click the blue “+” button next to the desired language’s flag in the Languages metabox.
in the next screen you can fill in the translated post’s contents, just like adding a new one.
Once done you can publish the translated post.
The process of translating pages is identical to the one followed for posts.
Translating post categories
To translate a category you can navigate to Posts > Categories and edit the category you wish to translate. Next click the blue “+” button next the desired language’s flag.
in the next screen you can fill in the translated category’s information just like adding a new one.
Once done click the Add New Category button. That’s it, now the translated category is available to help you better organize your posts.
The same procedure can be followed to translate tags.
Adding a language switcher
Polylang provides you with a language switcher widget to make it easier for your visitors to access the site’s translations. To utilize it navigate to appearance > widgets or customize > widgets and add it to the sidebar of your choice. Choose what you want to display by ticking the appropriate boxes and save it, that’s it.
Changing the URL structure
Under Languages > Settings > URL modifications you can control the URL structure of the translated items.
- You have the option to set the language based on the directory, for example English would be at http://yoursite.com/en and Spanish at http://yoursite.com/es
- You can also set the language based on the sub domain, for example English would be at http://en.yoursite.com/ and Spanish at http://es.yoursite.com/
- Languages can also be set at totally different domains, for example English could be at http://yoursite.com/ and Spanish at http://yourspanishsite.com/
As you can see Polylang is a rather simple to use but very capable plugin to help you handle multilingual sites. It’s main advantage is that it has a free version available on the repo which makes it more approachable to many users. If you are interested in translating your site you can always grab a copy, install it on your site and give it a go!