Polylang Multi Language Plugin Configurations
What this article is really about is to help you get through that glitch that I have seen mentioned in several support forums. I was nearly ready to give up on the Polylang free plugin and just buy something because I couldn’t work out why my home page had disappeared and returned instead a 404 not found error.
There is already a very good article written by Divitheme with all the steps to getting the plugin working but I just wanted to add the step that wasn’t apparent to me. First off take a look at their tutorial. I would like to reiterate their steps are so nicely out-lined in the article by Divitheme so I am in no way trying duplicate their content, just add a little bit extra which helped me along the way.
So here goes.
Install the Polylang WordPress Plugin from the WordPress repository. Activate the plugin. Then go to the plugin settings via Dashboard > Languages > Languages and choose a language from the drop-down menu. Choosing a language will automatically populate the fields below this. Select the order of the languages setting your Default language to 0. Click ‘Add new language’ . The language will appear on the right hand side in a list with all your languages. In the example below I chose English and German.
You can also click the star icon on and off to set a language to the default language. In my case and the example above I only needed 2 languages. Install the Duplicate Post Plugin and activate it. When you head over to your posts or pages, hover over the list of posts or pages in your dashboard and you will see a new option next to ‘Edit | | Trash | View | Clone | New Draft’. Choose a page you want to translate. In my case it was the home page for my one page website. I clicked ‘clone’ and had an exact copy of my home page ready for translation. Here is the important step. Go into your primary language, in my case the English home page. On the right hand side you will see the language options. Under language I have selected English.
Link your default home page with your other language home pages
Now to link the 2 pages English and German I need to select the German page to link to from inside the Default home page language in my dashboard. So go to your default language home page dashboard. Once in put your cursor in the field below ‘Translations’. It will automatically show options of other pages on the site that are in another language. Select the desired page and language. Save your settings. You will see now that your page url has changed. For example the new url will be mydomain.com/en/home with the English translation code as part of the url. See screenshot below:
If you visit the page you just linked to you will see it is also linked and the url has incorporated the additional language code.
Hide the language code from your urls
If you do not want the url’s to show your language code you can hide this under the Settings > Languages > Settings > URL modifications. In the screenshot below I have configured the settings to show the language code in the url:
If you get the following Polyang Plugin Errors:
The chosen static front page must be translated in all languages
You will not be able to set the default home page until you have created at least 1 additional language for your home page and configured the settings above. Namely, go into your default language home page and choose the additional language to link it to. See explanation above.
Multi Language Menu
You will now navigate to Dashboard > Appearance > Menus and begin creating your multi language menu. First Create new menu, let’s say the English Menu. Add all the English language pages to it. Also add the new item created by the Polylang plugin called ‘Language switcher ‘.
Set the menu as your primary English Menu.
Create another additional language menu. Add the additional language pages to this menu. Set it as the default main menu for the additional language. Remember, you can only do this once you have created your additional language pages shown in the steps above.
Here is what the menu section would look like: