Toolset allows you to connect content using post relationships. In this guide, we will explain how to translate related content and how these translations appear on the site’s front-end.
The most important thing to remember about translating related content is that the actual connections between posts are stored only for content published in the site’s default language.
When it comes to translating related content, there are some additional restrictions you should consider:
- You cannot connect posts that do not have a default language version.
- Deleting a post in the default language will delete any associations for versions in other languages as well.
- You should never change the site’s default language after the post relationships are already set. This will likely break the site altogether.
A post relationship can involve up to three post types.
One-to-one and one-to-many relationships involve two post types: parent and child. For example, we can have “Airports” (parent) and “Flights” (children), which are two post types that are directly related.
A many-to-many relationship, on the other hand, features a so-called “intermediary” post type that connects the two main post types. For example, we can have “Clients”, connected to “Developers” through a “Contract” (intermediary post type).
You need to set the translation mode for post-types that are related. To do this, go to WPML -> Translation Management and click the Multilingual Content Setup tab. There, scroll to the Post Types Translation section.
As you can see in the above image, post types involved in a post relationship can either be set to “Not translatable” or “Translatable – use translation if available or fallback to default language”.
WPML and Toolset allow you to have any combination of these two translation modes for post types involved in a relationship. If a post type is set to be “Not translatable”, its default-language version will be output. This is because in some cases, you will not need to translate specific post types.
Let’s again consider our example of “Developers” and “Clients” connected through “Contracts”. You could set “Developers” and “Clients” to “Translatable – use translation if available,” but keep the “Contracts” intermediary post type as “Not translatable,” because it just features information about the contract date and cost, with nothing specific to translate.
Once you have selected the translation options for post types in a relationship, you can translate the posts using your favorite translation method in WPML.
When translating, you will see the content of the post, as well as the related posts. You need to translate the content, but you don’t have to do anything about the related posts. All the post connections come from the connections you already made in the site’s default language.
You can connect existing posts, even if the current admin language is not the default one. However, Toolset will not allow you to connect items that do not exist in the site’s default language. Please remember that you are making connections that will show up in all of the site’s languages and not only in the current translation that you’re editing.
You can also create new connected posts, even if the current language is not the default one. In this case, a post in the default language is created.