Import WPGet Pro
Menu

Polylang

Import Polylang translations from CSV / XML

Import WP’s Polylang add-on allows you to easily import Polylang translations to post types from XML / CSV files.

Import WP’s Polylang add-on allows you to easily import Polylang translations to post types from XML / CSV files.

Import Polylang translations from CSV or XML files

The Import WP Polylang add-on adds a new section to the “Template Fields” step of the import creation page labelled “Polylang”, by all Polylang fields are hidden, but can be enabled via the Enable Fields button shown at the bottom of the section.

Import WP create importer screen with the Polylang add-on translation fields available

The “Language” field is used to set the current translation language of the object being imported, this can be populated via the dropdown containing a list of all active languages, or can be dynamically populated via a value from the CSV or XML file.

The “Translation” field is used to connect translations together, this can be linked using the Post ID, Post Slug, Post Name, or referencing a value in your CSV or XML file.

Import Polylang translations to posts, pages and custom post types.

When importing Polylang custom post type translations make sure you have enabled the custom post type to allow translations in Polylang (by default pages and posts are enabled), otherwise the Polylang section will not appear in Import WP. To enable the custom post type for translating, go to “Languages > Settings > Custom post types and Taxonomies” and make sure the post type is selected with changes saved.

The following CSV example shows the minimum columns required to import Polylang translations into WordPress posts with translated title and content fields, the important columns to note are the language and translation columns.

Title Content Language Translation
Page one Example page one content en
Page un Exemple de contenu de la première page fr Page one
Pagina uno Esempio di contenuto della prima pagina it Page one
Page two Example page two content en
Pagina due Esempio di contenuto della seconda pagina it Page two
Page deux Exemple de contenu de la page deux fr Page two

Example Polylang translation csv file

The “Language” column uses the 2-letters ISO 639-1 code and is used to set the current posts language while also being used as a reference in the translation field.

Setting the language and translation fields on the “Polylang” Section, setting the “Translation Field Type” to “Name”, as the “Translation” column in this example references a post by its title/name.

Import WP Polylang language and translation-of fields mapped on a post template

Filling out the rest of the post template fields, setting the title, content and post status to the relevant CSV columns allows the translations to be created and referenced during the import.

Import WP Polylang section for assigning a language to imported posts

Using the default permissions and running the importer, you should see the following available posts, each showing with their related translations that can be edited via the pencil icon under its flag.

Import WP Polylang translation reference field matching the default-language post

Polylang translations import using a reference column

Import WP’s Polylang add-on allows you to use a reference column when selecting how translations are related via the “Translation Field Type” field.

Using a similar example CSV file, with extra ID and Translation ID columns, the ID is not the post ID, from the example you can see the first 3 rows are grouped using the Translation ID, and the group matches up to a row in the ID column.

ID Title Content Language Translation ID
1 Page one Example page one content en 1
2 Page un Exemple de contenu de la première page fr 1
3 Pagina uno Esempio di contenuto della prima pagina it 1
4 Page two Example page two content en 4
5 Pagina due Esempio di contenuto della seconda pagina it 4
6 Page deux Exemple de contenu de la page deux fr 4

Example Polylang translation with reference column csv file

The “Translation Field Type” allows us to select a value and have that value be referenced against another column in the CSV file, with the example CSV we set the “Translation” field to the Translation ID Column, and set the “Translation Reference Column” to the ID Column.

Import WP Polylang translation linked to the original post via a reference column

Updated 2023-02-01