Polylang is a popular multilingual plugin for WordPress that allows you to create and manage content in multiple languages.
When combined with Sensei LMS, it can serve different course content versions depending on the visitor has selected language.
There are a couple of things to be aware of before proceeding with Polylang:
- You will need to recreate your menus, one per language. Until that is done, no menus will be visible on your site after installing Polylang.
- Polylang does not automatically translate content for you. If you like, you can use an additional Ray Enterprise Translation plugin to help with that. It provides the option to do machine translation of your content (up to 100,000 characters is free), or you can pay to have it professionally translated.
Configure Polylang to Work With Sensei LMS
In this tutorial and for the sake of using an example, we’ll assume that you’ve already created a course and some lessons in English, and you want to translate them into Spanish. The same process will also work for other languages.
Polylang Installation & Setup
Steps to install the Polylang WordPress plugin and set it up on your WordPress website:
1. Start by installing and activating the Polylang WordPress plugin.
2. As you activate the Polylang plugin on your site, it will launch the setup wizard. You can then proceed through the setup wizard. If you have skipped the setup wizard, you can launch it again from the WP Admin panel by going to Languages > Setup.
3. In the setup wizard, we’ll select English and Spanish (1) as the languages in the first step and then click Continue (2).
4. Toggle whether or not you’d like to translate media and click Continue.
5. The next step is selecting the default language our content has been written in. In our case, since we’ve already written our course and lessons in English, that’s the language we’ll select here and click Continue.
6. Once the setup wizard is complete, click Return to the Dashboard on the last steps of the setup wizard.
Add a Language Switcher
A language switcher allows visitors to select their preferred language and view the content of your website in that language, which enhances their user experience and makes your website more accessible and user-friendly.
Adding a language switcher in Polylang is important because it enables website visitors to switch between languages on your website easily.
Without a language switcher, visitors may have difficulty finding the content they need or understanding the content on your website if it is not in their preferred language.
You can either add it to an existing menu or as a widget. There is more information on how to do this in the Polylang documentation.
If you are not seeing the Language switcher option in the Appearance > Menu section of the WP Admin panel, you will first have to enable the option from the Screen Options to make it appear.
If you are using Full Site Editing theme, then the Menus option will not appear in the Appearance section, and you will need to upgrade the Polylang to Polylang Pro to use their Language Switcher block in the block editor.
Alternatively, you can switch to a theme that doesn’t include the Full Site Editing feature or the Full Site Editing feature but also has the classic Menus option in the Appearance section.
An unfortunate side effect of activating Polylang is that it requires you to recreate your site menus.
Recreating menus in Polylang is necessary because menus are not automatically translated when you add a new language to your WordPress website using the Polylang plugin.
You need to create one menu for each language you selected in the wizard. In our case, we would need to create an English and Spanish menu. You can learn how to do that in the Polylang documentation.
While it may require a bit of extra work to recreate menus in Polylang, doing so is essential for creating a successful multilingual website that meets the needs of your audience.
The final step is to translate your content. As mentioned previously, Polylang on its own does not automatically translate your content.
As mentioned earlier, you can install Ray Enterprise Translation to leverage machine translation, but if you have a lot of content or the quality of the translations are important, there will be a cost.
The easiest way to create a translated version of an existing course is to open the course in the editor. In the Languages (1) box in the sidebar, click the + icon (2) beside the language you would like to create a translation for. In our case, that’s Spanish:
This will create a new course with the Languages setting already correctly set to the translated language.
You can now get to work translating the course and then repeat this process for lessons, questions, or any other content you’d like to translate. When translating lessons, don’t forget to assign them to the translated course.
When you visit your site and select a different language using the language switcher, the page will update to show the translated content.
If you are getting 404 Page Not Found errors when clicking links (for example, clicking on a lesson in a course), try going to Settings > Permalinks and clicking the Save Changes button without making any changes. This should be enough to resolve the 404s.
Otherwise, Polylang has some of its URL modification settings you can explore.
If you notice that some of your courses are no longer appearing on your site, the most likely culprit is that the default language of those courses was not set correctly. Here’s what you can do to fix it:
1. Go to Courses > All Courses.
2. In the language switcher that appears in the top toolbar, ensure Show all languages is selected:
3. If you do not see a language flag in the table for every course, it means the course is no longer visible on your site, so we need to fix that immediately.
Click on the bulk select box (1) at the top of the course list to select all courses on the page, or check the box beside each course missing a flag.
Then choose Edit (2) from the dropdown and click Apply (3):
4. choose the appropriate language from the Language (1) dropdown. Click Update (2) to save your changes:
5. The default language flag should now be displayed for all courses. Repeat the above steps, if necessary, for lessons, pages, and any other content you may have on your site.