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:
    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: Generate Content: WPML: 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 Primary Language Content Group

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.

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

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
  • Save the Content Group
    • Click the Save button, if available in the Actions meta box,
    • Click the Publish / Update button, if using Gutenberg.

Define Translation Content Group(s)

For secondary language(s) enabled in WPML, you’ll need to create an additional Content Group, defining its language in WPML’s options.

In our example, you’d:

  • Create a new Content Group
  • In the Language section, change it from English to Spanish
    Page Generator Pro: Generate: WPML: Spanish Language Selection
  • Click Ok on the prompt that appears
    Page Generator Pro: Generate Content: WPML: Change Language
  • Write the content in Spanish, using the {service(spanish)} Keyword
    Page Generator Pro: Generate Content: WPML: Spanish Content Group
  • Save the Content Group
    • Click the Save button, if available in the Actions meta box,
    • Click the Publish / Update button, if using Gutenberg.

Connect Content Group Translations

With your secondary language(s) Content Groups created, we now need to connect them to the primary language’s Content Group in WPML.

In our example, we would:

  • Edit the English Content Group
  • Click Connect with translations
    Page Generator Pro: Generate Content: WPML: Connect Translations Link
  • Start typing the Title of the English Content Group:
  • Click the matching Content Group name, and click Ok
    Page Generator Pro: Generate Content: WPML: Select Translation Content Group
  • Confirm that the Content Group name listed in the modal window is the Spanish (secondary) Content Group language, and that the “Make… the original language for this page-generator-pro” is ticked
    Page Generator Pro: Generate Content: WPML: Confirm Connection
  • Click Assign
  • The Spanish (secondary) translation will then be displayed in the Language section:
    Page Generator Pro: Generate Content: WPML: Connected Translations List
  • Save the Content Group
    • Click the Save button, if available in the Actions meta box,
    • Click the Publish / Update button, if using Gutenberg.

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 each secondary language Content Group, click the Generate via Browser option. For example, if Spanish is our primary language, we’ll do this for the Spanish Content Group:
Page Generator Pro: Generate Content: WPML: Generate via Browser: Spanish 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:
Page Generator Pro: Generate Content: WPML: Generate via Browser: Spanish Content Group Log

Once generation is complete, repeat this step for the primary language’s Content Group.  For example, we’ll do the same for the English Content Group:
Page Generator Pro: Generate Content: WPML: Generate via Browser: English Content Group

Again, 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: Generate Content: WPML: Generate via Browser: English Content Group Log

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

With WPML’s Language Switcher widget, we can switch to the Spanish version:
Page Generator Pro: Generate Content: WPML: Spanish Output

Editing the generated Spanish 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 Content: WPML: Spanish Language Settings