Query the language for the entity, and the IDs for the translations for that entity.
These types implement interface PolylangTranslatable. (Type Media does only when media support is enabled, via the Polylang settings.)
Field
Description
polylangLanguage
Language of the post or page, or null if no language was assigned (eg: Polylang was installed later on).
polylangTranslationLanguageIDs
Nodes for all the translation languages for the entity, as a JSON object with the language code as key and entity ID as value, or null if no language was assigned (eg: Polylang was installed later on).
Field polylangTranslationLanguageIDs provides the entity IDs for all the translations (i.e. post/page/category/tag/media). It accepts input includeSelf, to indicate if to include the queried entity's ID in the results (it's false by default), and inputs includeLanguages and excludeLanguages, to filter the included languages in the results.
These types implement interface PolylangMaybeTranslatable.
GenericCustomPost is a type used to represent any custom post installed on the site, such as Portfolio, Event, Product, or other. Similarly, GenericTag and GenericCategory are used to represent their taxonomies.
Each of these CPTs and taxonomies can be defined to be translatable on the Polylang settings. Fields polylangLanguage and polylangTranslationLanguageIDs will then have the same behavior as for Post and the others (described above), and also return null if the entity's CPT or taxonomy is not configured to be translated.
In addition, field polylangIsTranslatable indicates if the CPT or taxonomy is configured to be translatable.
Field
Description
polylangLanguage
Language of the post or page, or null if no language was assigned (eg: Polylang was installed later on), or if the entity is not configured to be translated (via Polylang Settings).
polylangTranslationLanguageIDs
Nodes for all the translation languages for the entity, as a JSON object with the language code as key and entity ID as value, or null if no language was assigned (eg: Polylang was installed later on), or if the entity is not configured to be translated (via Polylang Settings).
Establish the language for custom posts, tags, categories, and media items, and
Define associations among them (i.e. indicate that a set of custom posts, tags, categories, or media items is a translation for each other).
Mutation
Description
polylangSetCustomPostLanguage
Set the language of the custom post.
polylangSetTaxonomyTermLanguage
Set the language of the taxonomy term.
polylangSetMediaItemLanguage
Set the language of the media item.
polylangSaveCustomPostTranslationAssociation
Set the translation association for the custom post.
polylangSaveTaxonomyTermTranslationAssociation
Set the translation association for the taxonomy term.
polylangSaveMediaItemTranslationAssociation
Set the translation association for the media item.
For instance, the following query defines the language for 3 posts (to English, Spanish and French), and then defines that these 3 posts are a translation of each other: