Generate: Multilingual Content: WPML

Overview

Page Generator Pro is compatible with WPML, allowing you to generate content in multiple languages.

To achieve this, you’ll need to:

  • Setup WPML, 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 WPML knows, for each language, which Content Group to use,
  • Generate Content from each Content Group

Enable WPML Languages

With the WPML Plugin activated, define the languages you want to use on your web site by navigating to WordPress Admin > WPML > Languages
Page Generator Pro: Generate: Multilingual Content: WPML: Languages: Menu

Using the Add / Remove Languages option to define the supported languages:
Page Generator Pro: Generate: Multilingual Content: WPML: Languages: Add/Remove

Page Generator Pro: Generate: Multilingual Content: WPML: Languages: Selection

Enable WPML on Content Groups

Navigate to WordPress Admin > WPML > Settings
Page Generator Pro: Generate: Multilingual Content: WPML: Settings: Menu

Scroll to the Post Types Translation section, and set Content Groups (page-generator-pro) to Translatable:
Page Generator Pro: Generate: Multilingual Content: WPML: Settings: Post Types

For the rest of this Documentation, we’ll assume you have two languages setup:

  • English
  • Spanish

Define Keywords

Refer to the Keywords documentation for full instructions on adding and editing Keywords.  The below is a guide specific to multilingual WordPress installations.

Adding Keywords

To add a Keyword to Page Generator Pro:

  1. Click the Add Keyword button below the Page Generator Pro: Keywords title, which can be found towards the top of the screen:
    Page Generator Pro: Import CSV
  2. The Keywords form will then be displayed, where you can define the following options:
    Page Generator Pro: Keyword Form

    1. Keyword: the unique template tag you’ll use when generating Pages / Posts / Custom Post Types.
      1. The Keyword must be unique from any other Keywords that you might have already defined.
      2. Make sure to only use letters, numbers and underscores.  Spaces and other characters will not work.
    2. 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.
    3. Delimiter: Use the comma symbol (,)
    4. Columns: the comma separated list of languages the above Terms are in.

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

Page Generator Pro: Polylang: Keyword

When you’re finished, click the Save button.

A notification will be displayed confirming that the Keyword saved successfully.
Page Generator Pro: Keywords: Success Notification

Editing existing Keywords

To edit an existing Keyword, click the Keyword name in the Keyword table.
Page Generator Pro: Keywords: Edit

In the Keywords form that is then displayed, define the Terms in each of the languages that you have enabled in WPML.

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

Refer to the Generate Content documentation for full instructions on adding and editing Content Groups.  The below is a guide specific to multilingual WordPress installations, and assumes you understand Content Groups.

For each language enabled in WPML, you’ll need to create a Content Group, defining its language in WPML’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:
Page Generator Pro: Generate Content:

You will then be presented with a screen similar to the one used to edit your WordPress Posts and Pages:
Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups

For the primary language, define your Title, Content and other settings as you would for a Content Group.  In our example, you’d:

  • Write the content in English, using the {service(english)} Keyword
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: English
  • In the Language section, select English
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: English Language

For the secondary language(s), define your Title, Content and other settings as you would for a Content Group.  In our example, you’d:

  • Write the content in Spanish, using the {service(spanish)} Keyword
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: Spanish
  • In the Language section, select Spanish
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: English Language
  • Click Connect with translations, and start typing the Title of the English Content Group:
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: Connect Translation
  • Click the matching Content Group name, and click Ok
  • The English translation will then be displayed in the Language section:
    Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: Connected Translation

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 any other additional languages enabled in WPML, so that you end up with one Content Group for each language.

Generate Content

Refer to the Generate: Run and Actions documentation for full instructions on generating content.  The below is a guide specific to multilingual WordPress installations.

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:
Page Generator Pro: Polylang: Generate Primary Language

A screen will display showing the progress as each Page is generated, along with the time it took and the server memory usage:
Page Generator Pro: Polylang: Generate Primary Language: Log

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:
Page Generator Pro: Polylang: Generate Additional Language: Log

If we click the first link in the log, we’re taken to the Spanish version of our Web Design service page:
Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: Generated Content: Spanish

With WPML’s Language Switcher widget, we can switch to the English version:
Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: Generated Content: English

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:
Page Generator Pro: Generate: Multilingual Content: WPML: Content Groups: English Language