Tips and tools for WordPress, Google and more
Multilingual WordPress website with Polylang
WordPress does not yet have the inherent ability to create a multilingual website. Of course, you could fill each page with content in different languages, but this is not the wisdoms last end. This is not the wisdom last end. The menu items should be offered in different languages, as well as the name and subtitle of the website. And finally, it would be nice if you could click on a different language in the language switcher on a page or a post to go directly to the different language version of the same content.
Table of Contents
- Setup of Polylang
- Polylang settings
- Translating character strings
- Translate page/article
- Media
- Translate menu, language switcher
- Contribution categories
- Conclusion
A plugin is required for the proper setup of multilingual WordPress websites. Three plugins for multilingualism are very popular in the WordPress community and are therefore widely used:
- Polylong
- TranslatePress
- WPML (Premium-Plugin)
The first two plugins can already be used in a free version (there is also a Pro version that requires a license), while WPML must be licensed annually.
More plugins for setting up multilingual websites with WordPress:
- MultilingualPress (Premium plugin; builds on a WordPress Multisite installation)
- WPGlobus
In this tutorial, I will show you how to use the free version of Polylang can set up a multilingual website and what the limitations are compared to the Pro version.
Setup of Polylang
Polylang is installed in the usual way in WordPress. Search in the WordPress backend under "Plugins" / "Install" for Polylang from WP SYNTEX and click on "Install", then on "Activate". The plugin should then appear as activated in your plugin list.
You can now use the Polylang Wizard to quickly configure the plugin for the first time (click on the "Settings" link next to the plugin).
First add the current language of the website, in most cases "German".
Click on + Add new language Now add the first additional language. We select "English" for this. Of course, you can also add other languages here, but for this article we will limit ourselves to German and English.
Then click on "Next".
In the next step, you can specify whether you would like to create alternative image texts in other languages. We think this is a good idea, so we activate this option.
In the next step, you assign all existing content to a language, which then becomes something like the default language of the website.
Now complete the Polylang setup wizard and switch to the plugin settings.
Polylang settings
In the settings (accessible in the WordPress backend under "Languages"), you can specify what the URLs of the language variants should look like. We opt for the most common and simplest variant. The default language does not need its own language directory (/en/), so activate the option "Hide URL information for the default language".
But the content of the second language should appear in a URL structure such as /en/.
Translating character strings
As mentioned above, a website also contains designations that are assigned to the entire website. These should also be displayed in the second language.
To translate the name and subtitle of the website, for example, go to "Languages" and select "Translations of character strings". Now edit the texts in the respective language and, if you wish, also the Formats for date and timeand click on "Save changes" after completion.
"blogname" stands for the "title of the website" and "blogdescription" stands for the "subtitle".
Translate page/article
Call up the list of pages and first display all languages (top horizontal bar).
This could look something like this for a fresh WordPress installation:
You can see that the Example page is available in German, but there is no version for English yet. Click on the plus symbol in the column with the US flag and create the content for the English equivalent of the example page.
If there is already an English version of the sample page, you will see a pencil icon in the list instead of the plus symbol. You can also click on this to edit and update the English content.
However, you can also access the English version via the editing mode of the German page. To do this, open the "Languages" item under the page properties of the German page and click on the pencil symbol next to the US flag. This will switch you to the editing mode of the English page.
In this way, the different language versions of pages (and posts) are assigned to each other. In the image above you can see that "English Sample Page" is the English version of the German "Beispielseite". The language switcher can only function correctly because of this assignment. Because if you simply create an English page called "English Sample Page" without assigning this page to the German page "Beispielseite", visitors will not be able to switch directly between the two language versions with a simple click.
Permalinks
You can and should also use different permalinks use, for example /example page/ for the German-language version and /en/sample-page/ for the English-language version.
However, you can only use Polylang Prothe premium version of Polylang, the same slugs (permalinks) for Pages, posts, categories, etc. use:
In the free version you only achieve something like:
But in this case, the English version of the page is more likely to be this:
Media
When we first set up Polylang, we indicated that we would also like to offer alternative image texts in other languages. You can therefore display the images in the media overview in list form and add a "translation" of images in the same way as for pages or posts. This means that the "translated" images are also available in the second language so that you can provide these images with your own alternative texts for the other languages.
The "German-language" image can now be provided with a German alternative text in the page/post, while you can assign a different alternative text to the same image in the second-language page/post.
Note: the image will be not stored multiple times on the server.
Translate menu, language switcher
Website visitors should be able to click on a Language switch be able to switch between languages in the menu. The language switch should therefore be added to a menu.
Edit the German language menu (in our example we have named it "top") and add the language switch to the menu.
You can edit the display of the language switcher. For example, we do without the flag display and instead select the entire language name.
Switch to the second language in the top horizontal bar and also create a menu for the language. Now add the language switcher to this menu ("top EN" in our example). Do not forget the placement of the menu ("Position in theme").
If necessary, edit the German-language menu items. For example, you could rename "Startseite" to "Home" for the English version.
Ready! Ready!
A language switcher is also available as a widget that you can integrate into the footer, for example.
Please note that the language switch will only work correctly later if you have previously assigned the other language version to the pages (see above).
Contribution categories
You can offer a post list in WordPress in several ways. It is very common to use a "post page" and alternatively to add categories to the main menu.
Contribution page
If you are using the contribution page variant (because you may only be using a single category anyway), then create an empty page and designate this as the contribution page under "Settings" / "Read". You can now also create this as a corresponding page in the second language and add both pages to the respective language menus.
For all languages, you must select a language under "Settings" / "Read". static page as homepage so that you also have a Contribution page can use.
Add categories to the menu
When using categories in the menu, proceed in the same way as when translating posts or pages. You create a corresponding category in the second language. This category can or should have a name in the other language and therefore also a different permalink. In our case:
- German:
- New / new
- English:
- News / news
Assign contributions in the second language to this category.
Of course, not every article has to be available in translation; you can also offer articles in just one language.
Conclusion
With Polylang, you can quickly produce a satisfactory multilingual output of a WordPress website. And this is already possible with the free version of the plugin.
The Pro version of Polylang provides a few additional features that may be indispensable for some applications.
- Language switcher also for widgets
- Translation of permalinks also for custom post types, taxonomies and more
- Duplicate posts/pages for languages
- Activate and deactivate languages
- Further integration with the ACF Pro plugin
- Premium Support
Polylang additives
In addition to Polylang, you can also Lingotek Translation for the translation of your texts. The translations can be done either by machine, by professional translators or with the help of a community. However, the number of requests for this service has been increasing recently (2021) negative reviewsso it is better to test this on a test website first.
If you are currently using WPML and would like to switch to the possibly somewhat clearer Polylang, you can use the plugin WPML to Polylang use.
Would you like to be informed quickly about new articles and more?
Then we recommend that you subscribe to our newsletter "Online Marketing News from E-Werkstatt".
Hello Heinz,
Clear article, would be nice if you could also mention MultilingualPress. German support and particularly suitable for scalable and flexible websites where performance and SEO optimization are important 🙂
That's right, I've now added that.
Hello Heinz 😉
Hello,
I get the error message "File already exists" when installing.
Unfortunately I don't know which ones and where I can find them
Use FTP to look at the server and search for "polylang" in the wp-content/plugins/ directory. Delete this directory, then try the installation again.
Or Polylang is already correctly installed on the server, as you should see in the list of your plugins.
Unfortunately, I cannot enter a URL for the menu items.
Why?
Probably because you don't know how to do this. With non-full-site editing themes (i.e. "classic themes"), there is the menu item "Design > Menus" in the backend, where you can add "Individual links" in addition to pages.
For full-site editing themes, you must edit the corresponding navigation block in the page header.
If none of this is possible, it may be that you are not an administrator and therefore do not have sufficient rights.
Hello, I have added another language and wanted to add the language switcher to the corresponding menu. However, under "Add menu items" the selection is not available as shown above. Is there a tip on how I can display this again, or how else can I insert it into the new language? Thank you and best regards.
If the language switch is already there, you do not need to add it again. Only one more language will be added (automatically).
Here is a screenshot of the menu of a simple polylang website. If you do not see the language switch, there may be a technical problem (plugin incompatibility).