Overview
Page Generator Pro is compatible with Polylang, allowing you to generate content in multiple languages.
To achieve this, you’ll need to:
- Setup Polylang, to define the Languages to use on your WordPress web site,
- Define Keyword(s), with Terms in the languages that you wish to generate content for,
- Define Content Groups for each Language,
- Link Content Groups, so that Polylang knows, for each language, which Content Group to use,
- Generate Content from each Content Group
Enable Polylang Languages
With the Polylang Plugin activated, define the languages you want to use on your web site by navigating to WordPress Admin > Languages
Using the Add new language option to define the supported languages:
A list of enabled languages is displayed on the right hand side of the screen:
Enable Polylang on Content Groups
Navigate to WordPress Admin > Languages > Settings
Click Settings below the Custom post types and Taxonomies option:
Tick / enable the Content Groups option, and click Save Changes
For the rest of this Documentation, we’ll assume you have two languages setup:
- English
- Spanish
Define Keywords
Adding Keywords
To add a Keyword to Page Generator Pro:
- Click the Add Keyword button below the Page Generator Pro: Keywords title, which can be found towards the top of the screen:
- The Keywords form will then be displayed, where you can define the following options:
- Keyword: the unique template tag you’ll use when generating Pages / Posts / Custom Post Types.
- The Keyword must be unique from any other Keywords that you might have already defined.
- Make sure to only use letters, numbers and underscores. Spaces and other characters will not work.
- Terms: list the words or phrases that will be cycled through when generating content containing this Keyword, comma separated for each language that is supported on your web site. Each word or phrase must be on its own line.
- Delimiter: Use the comma symbol (,)
- Columns: the comma separated list of languages the above Terms are in.
- Keyword: the unique template tag you’ll use when generating Pages / Posts / Custom Post Types.
For example, if we’re defining a {service} Keyword for Web Design and Web Development in English and Spanish, we’d enter the following information:
Setting | Value |
---|---|
Keyword | service |
Terms | Web Design,Diseño web Web Development,Desarrollo web |
Delimiter | , |
Columns | english,spanish |
When you’re finished, click the Save button.
A notification will be displayed confirming that the Keyword saved successfully.
Editing existing Keywords
To edit an existing Keyword, click the Keyword name in the Keyword table.
In the Keywords form that is then displayed, define the Terms in each of the languages that you have enabled in Polylang.
For example, if we’re editing an existing {service} Keyword, that has Terms in English for Web Design and Web Development, we’d enter the following information:
Setting | Value |
---|---|
Keyword | service |
Terms | Web Design,Diseño web Web Development,Desarrollo web |
Delimiter | , |
Columns | english,spanish |
Define Content Groups
For each language enabled in Polylang, you’ll need to create a Content Group, defining its language in Polylang’s options.
To add a new Content Group to Page Generator Pro, click the Add New button below the Content Groups title, which can be found towards the top of the screen:
You will then be presented with a screen similar to the one used to edit your WordPress Posts and Pages:
Define your Title, Content and other settings as you would for a Content Group, specific to the language that this Content Group is for. For example:
- English: You’d write the content in English, using the {service(english)} Keyword
- Spanish: You’d write the content in Spanish, using the {service(spanish)} Keyword
In Polylang’s Languages option, set the Language dropdown to match the language the content is in. For example:
- English:
- Spanish:
Once you have completed all fields either:
- Click the Save button, if available in the Actions meta box,
- Click the Publish / Update button, if using Gutenberg.
Repeat this process for each language enabled in Polylang, so that you end up with one Content Group for each language:
Link Content Groups
Next, edit the primary language Content Group. In Polylang’s Languages option, set the Translations field(s) to match the Content Group providing content in that language. For example, if we’re editing the English Content Group:
- We’re asked to provide the Spanish Content Group Translation:
- Start typing the Spanish Content Group’s Title in this field:
- Select the Spanish Content Group when it appears:
Once you have completed this, either:
- Click the Save button, if available in the Actions meta box,
- Click the Publish / Update button, if using Gutenberg.
Generate Content
With our Content Groups complete, we can now generate content for each language.
For the primary language Content Group, click the Generate via Browser option. For example, if English is our primary language, we’ll do this for the English Content Group:
A screen will display showing the progress as each Page is generated, along with the time it took and the server memory usage:
Once generation is complete, repeat this step for each additional language’s Content Group. For example, we’ll do the same for the Spanish Content Group:
If we click the first link in the log, we’re taken to the Spanish version of our Web Design service page:
With Polylang’s Language Switcher widget, we can switch to the English version:
Editing that page, we can see that Page Generator Pro has linked the translations automatically for each language, showing us which generated Page contains the English version of the same content for the same service: