Your search is in good hands

  • Pricing
  • Documentation
    • User guides
    • Support
    • Features
      • Roadmap
      • Artificial Intelligence
      • Elasticsearch
      • OpenSearch
      • Solr
      • Algolia
      • Swiftype (soon)
      • Hosting
      • Addons (Plugins, themes, features)
    • Blog
  • Demo
    • All Demos
    • Testimonials
    • Showcase
  • My Licenses
    • Login
    • Why us
    • Contact us
Menu
  • Pricing
  • Documentation
    • User guides
    • Support
    • Features
      • Roadmap
      • Artificial Intelligence
      • Elasticsearch
      • OpenSearch
      • Solr
      • Algolia
      • Swiftype (soon)
      • Hosting
      • Addons (Plugins, themes, features)
    • Blog
  • Demo
    • All Demos
    • Testimonials
    • Showcase
  • My Licenses
    • Login
    • Why us
    • Contact us

Home » Your configuration journey, step by step » Add-ons » Polylang add-on

Polylang add-on

373 views 0 February 17, 2021 Updated on February 19, 2021

What is the Polylang add-on

Polylang is a WordPress plugin that allows you to create a multilingual website, a lot like WPML. You can translate, posts, pages and products with it. It is very useful to WPSOLR because you can use multiple languages to search in. You will need multiples indexes however as each languages will be indexed separately. If you want to learn how to configure WPSOLR to use Polylang, follow the rest of this guide.

 

Install the Polylang plugin

Image Screenshot-2021-02-17-at-13.56.29-1024x64.png of Polylang add-on

Install the Polylang plugin. After you’ve activated it, you should see a setup screen.

Setup Polylang

Image Screenshot-2021-02-17-at-14.25.39-1-1024x600.png of Polylang add-on

Choose the languages you want to use on your website.

Image Screenshot-2021-02-17-at-14.13.47-1024x737.png of Polylang add-on

Leave the default options here.

Image Screenshot-2021-02-17-at-14.27.53-1024x645.png of Polylang add-on

Choose a default language.

Image Screenshot-2021-02-17-at-14.30.28-1024x768.png of Polylang add-on

Image Screenshot-2021-02-17-at-14.30.35-1024x534.png of Polylang add-on

You should end up on this screen. Click on “Return to the Dashboard” for now.

 

Translate content

If you have WooCommerce content you might have difficulty translating it. By default, Polylang translates posts and pages.

Image Screenshot-2021-02-18-at-10.45.52.png of Polylang add-on

Image Screenshot-2021-02-18-at-10.46.01-1024x74.png of Polylang add-on

Go to “Languages” -> “Settings”. Click on “Settings” under “Custom post types and Taxonomies”.

Image Screenshot-2021-02-18-at-10.48.19-1-1024x366.png of Polylang add-on

Select the post types and taxonomies you would like to translate. When you’re done, save your changes.

Image Screenshot-2021-02-19-at-11.00.42-1-1024x305.png of Polylang add-on

Click on URL modifications then if you want remove /language/ from url.

Image Screenshot-2021-02-18-at-12.56.07-1024x329.png of Polylang add-on

Now edit the content you want to translate.

Image Screenshot-2021-02-18-at-13.11.02-1024x243.png of Polylang add-on

Click on the + icon on the right

Image Screenshot-2021-02-18-at-13.11.56-1024x425.png of Polylang add-on

You should end up with a new page. You can now begin translating.

 

 

Change website language

Image Screenshot-2021-02-18-at-16.40.38-1024x63.png of Polylang add-on

Image Screenshot-2021-02-18-at-16.40.46-1024x427.png of Polylang add-on

To change the website language to french you must enter the website url followed by /language/fr. This will only work if you have selected “Post name” as a permalink.

Image Screenshot-2021-02-18-at-16.42.53-1024x320.png of Polylang add-on

 

Create an index

Image Screenshot-2021-02-01-at-09.29.07-1024x529.png of Polylang add-on

Click on “Connect your indexes” then, if you want to create a test index, click on “Click to generate a free index to test WPSOLR”.

Image Screenshot-2021-02-01-at-09.31.07-1024x244.png of Polylang add-on

Select “Create a free test index”. The index is only valid for two hours however, so you will have to create more if you want to use it for longer. You will however need to have the same number of indexes as languages you want your website to have, but you can only create one test index. You will therefore need to connect to a search server or service for the other indexes.

Image Screenshot-2021-02-15-at-09.35.31.png of Polylang add-on

Image Screenshot-2021-02-15-at-09.44.32-1024x671.png of Polylang add-on

Choose the search engine for your index then choose a hosting service. Choose the language you want your index to be used for, in my case i want the second index to be used for the french search. name your WPSOLR index and give a name to the search engine index. get your endpoint url from Elasticsearch server, and fill in the user and password you were given.

 

Activate the Polylang extension

Image Screenshot-2021-02-19-at-09.37.44-1024x454.png of Polylang add-on

Image Screenshot-2021-02-19-at-09.37.51-1024x359.png of Polylang add-on

Go to “Activate extensions” then click on “Polylang” in the sidebar. Click on the first checkbox to activate the extension, then scroll down and choose the language the indexes will be using. When you’re done save.

Image Screenshot-2021-02-19-at-10.00.44-1024x347.png of Polylang add-on

Don’t forget to activate the “Theme” extension as well and to click on the “Use this extension” checkbox.

 

Configure WPSOLR

Image Screenshot-2021-02-02-at-15.10.14-1024x84.png of Polylang add-on

Click on “Define your search with ‘Test index from Elastic Cloud'”.

Image Screenshot-2021-02-02-at-15.32.17-1024x405.png of Polylang add-on

Next click on “Search” and select one of the two indexes in “Search with this search engine index”.

Image Screenshot-2021-02-02-at-15.42.05.png of Polylang add-on

Click on “Data” in the sidebar.

Image Screenshot-2021-02-02-at-15.44.31-1024x188.png of Polylang add-on

Then select the data you want to index.

Image Screenshot-2021-02-02-at-15.46.39-1024x191.png of Polylang add-on

You can choose the taxonomies you want to use.

Image Screenshot-2021-02-03-at-15.29.12-1024x380.png of Polylang add-on

You can also choose the fields you want to use. If you want to use a slider you will have to change the default option, which is text, to floating point number if there are decibel numbers or integer if there are only whole numbers.

Image Screenshot-2021-02-12-at-09.16.37.png of Polylang add-on

Click on “Suggestions” in the sidebar

Image Screenshot-2021-02-12-at-09.16.52-1024x680.png of Polylang add-on

Then create a new suggestion. Choose a name for your suggestion in the “Label” field and click on the “Is active” checkbox. In the “jQuery selectors” field, fill in the search bar id. I will show you how to retrieve it later. In the “Query” section, choose “Suggest content” and then scroll down.

Image Screenshot-2021-02-12-at-09.17.02-1024x441.png of Polylang add-on

Click on “Products” if you want to display products in search suggestions. If you also want to display the price, you can click on the “Show Products price” checkbox.

Image Screenshot-2021-02-12-at-10.09.24-1024x201.png of Polylang add-on

head over to the search bar you want the suggestions to apply to and right click and select “inspect”. You will then see something similar to the photo. copy the search bar id. In my case it is “woocommerce-product-search-field-0”. When you’re done, go back to WordPress admin.

Image Screenshot-2021-02-02-at-15.48.55.png of Polylang add-on

Click on “Filter” in the sidebar.

Image Screenshot-2021-02-02-at-15.59.37-1024x585.png of Polylang add-on

Image Screenshot-2021-02-12-at-10.33.15-1024x34.png of Polylang add-on

Click on the filters you would like to use on your website then click on “Save Options”.

Image Screenshot-2021-02-17-at-10.55.12-1024x568.png of Polylang add-on

Image Screenshot-2021-02-11-at-10.24.24-1024x568.png of Polylang add-on

Image Screenshot-2021-02-11-at-10.24.44-1024x709.png of Polylang add-on

Image Screenshot-2021-02-11-at-10.24.59-1024x382.png of Polylang add-on

Image Screenshot-2021-02-12-at-11.19.16-1024x562.png of Polylang add-on

If you want to change the layout of the filter you select the one you want in “Layout”. You can also change layout skin on “Range Slider – Ion.RangeSlider js library”. Give your filters a title so that they are translated. if you want to people to be able to choose a product or page based on date of creation, modify “displaydate_dt” filter. Choose a label then choose the range slider and a skin. You will also have to enter some javascript to choose date format. Enter this code for the english US format:

wpsolr_ion_range_slider_options =
{
grid: true,
prettify: function tsToDate (ts) {
var lang = "en-US";
var d = new Date(ts); return d.toLocaleDateString(lang, { year: 'numeric', month: 'long', day: 'numeric' });
 } 
};

If you want to be able to change the currency and the format based on the language, enter this javascript code:

wpsolr_ion_range_slider_options =

{

grid: true,

prefix: "$",

prettify: function my_prettify (n) {
return n.toLocaleString('en-US', {maximumFractionDigits:2});
}};

Image Screenshot-2021-02-19-at-11.54.03-1024x281.png of Polylang add-on

Then go to “Texts” and choose the second option in the dropdown menu.

 

Index content

Image Screenshot-2021-02-02-at-16.38.47-1024x81.png of Polylang add-on

Click on “Send your data”

Image Screenshot-2021-02-02-at-16.48.23-1024x514.png of Polylang add-on

Click on “Index selected post types in index ‘index-name'”. Then do the same thing for the other index.

 

Add the WPSOLR Facet widget

Image Screenshot-2021-02-03-at-13.11.39-1024x405.png of Polylang add-on

 

Click on “Customise” on the front part of your website, then select “Widget” and “Sidebar”. Add the WPSOLR Facets widget.

 

Translate WPSOLR Facets and WordPress widgets

Image Screenshot-2021-02-19-at-10.22.25.png of Polylang add-on

Click on “Language” then on “String translations” in the sidebar.

Image Screenshot-2021-02-19-at-10.26.14-1024x76.png of Polylang add-on

Click on the field designated for your secondary language and write your translation.

Image Screenshot-2021-02-19-at-10.27.33-1024x72.png of Polylang add-on

Image Screenshot-2021-02-19-at-10.43.28-1024x74.png of Polylang add-on

Image Screenshot-2021-02-19-at-10.54.22-1024x73.png of Polylang add-on

Image Screenshot-2021-02-19-at-10.55.17-1024x76.png of Polylang add-on

Translate the WPSOLR facets.

 

Image Screenshot-2021-02-19-at-10.56.40-1024x83.png of Polylang add-on

Be sure to also translate the code i showed you earlier to display date in your language format. You just have to change “var lang = ” to your language.

Image Screenshot-2021-02-19-at-10.58.01-1024x64.png of Polylang add-on

Don’t forget to also translate the JS code for the price slider. Change “prefix” to “postfix” and “$” to “€”.  You will also have to change “en-US” to “fr”. Everything should be working as expected after that.

 

Test your website search

Image Screenshot-2021-02-19-at-11.50.05-1024x434.png of Polylang add-on

As you can see, we only get english content when searching right now.

Image Screenshot-2021-02-19-at-11.48.26-1024x249.png of Polylang add-on

The suggestions are working as well.

Image Screenshot-2021-02-11-at-14.11.49.png of Polylang add-on

Now let’s switch over to french.

Image Screenshot-2021-02-19-at-11.55.26-1024x498.png of Polylang add-on

Image Screenshot-2021-02-12-at-10.22.24-1024x167.png of Polylang add-on

We now have search in the french language. If you want more detailed instructions, you can watch this video:

Was this helpful?

Yes  No
Related Articles
  • Listable add-on
  • MyListing add-on
  • YITH WooCommerce Ajax Search add-on
  • Embed Any Document add-on
  • PDF Embedder add-on
  • bbPress add-on
Expand All Collapse All
  • What is it WPSOLR ?
    • The standard WordPress SQL search
    • The WPSOLR search with Elasticsearch, Apache Solr, or Algolia
  • Your configuration journey, step by step
    • Install Apache Solr
    • Hosted Apache Solr and SolrCloud Services
    • Install Elasticsearch
    • Elasticsearch Hosting
    • Configure your indexes
      • Generate a test Apache Solr index
      • Generate a test Elasticsearch index
      • Create an Apache Solr index
      • Create a SearchStax SolrCloud index
      • Create an Elastic Elasticsearch index
      • Create an Algolia index
      • Create an Elasticsearch index
      • Create an Opensolr Solr index
      • Create a Qbox Elasticsearch index
      • Create an ElasticPress Elasticsearch index
      • Create an Aiven Elasticsearch or OpenSearch index
      • Create a Bonsai Elasticsearch index
      • Create an Amazon Amazon Elasticsearch or Amazon OpenSearch index
      • Create an ObjectRocket Elasticsearch index
      • Create a Cloudways Elasticsearch index
      • Create an Alibaba Cloud Elasticsearch index
      • Create a Compose Elasticsearch index
      • Connect to an Apache Solr index
      • Connect to an Elasticsearch index
    • Add-ons
      • bbPress add-on
      • YITH WooCommerce Ajax Search add-on
      • SEO add-ons
        • Yoast SEO add-on
        • All in One SEO add-on
      • Listable add-on
      • ACF add-on
      • Advanced Scoring add-on
      • Cron Scheduling add-on
      • Theme add-on
        • Filters layouts
          • Radiobox & Checkbox Layout
          • Numeric Range Layout
          • Colour Picker Layout
          • Range Slider Layout
        • Add Ajax to the current Theme
        • Collapse taxonomy hierarchies
        • Custom Facets CSS
      • WPML add-on
      • Premium add-on
        • Manage more than one Elasticsearch or Solr index
      • PDF Embedder add-on
      • Geolocation add-on
      • AI Natural Language APIs add-on
        • Amazon Comprehend
        • Google Natural Language
        • Aylien Text Analysis
        • MeaningCloud
        • Qwam Text Analytics
      • Toolset Types add-on
      • AI Image and OCR APIs add-on
        • Google Vision
        • Amazon Rekognition
      • Embed Any Document add-on
      • MyListing add-on
      • Polylang add-on
      • WooCommerce add-on
      • Cross-domain search add-on
      • Directory+ add-on
      • Toolset Views add-on
      • Listify add-on
      • Jobify add-on
      • Query Monitor add-on
  • Quick start
Login
Support
Privacy policy
  • Terms and Conditions
  • © 2020 wpsolr.com. All Rights Reserved.
Youtube
Roadmap