Get Alternative Translations
Introduction
Getting alternative translations of an object is done by supplying the language
argument to a getObject
query.
If a language
is not supplied the default language will be used.
When getting an object's related objects there are various possible outcomes.
- A
language
argument can be supplied to the related object query to get that relationship in a specific language - If the
language
argument is not supplied to the related query, the language of the parent object will be attempted - If a translation of the related object does not exist in the parent language, the default language will be attempted
- Finally if all options above are not possible whatever translation is available for the related objects will be returned. This is an "all else fails" scenario to ensure a relationship is returned, but should be avoided as it will lead to inconsistent translation for users.
Note: If the language
argument is supplied to a relationship but that translation doesn't exist, steps 2-4 above will still be carried out.
Get An Object's Alternative Translation
query getEpisode {
getEpisode(
uid: "0b81a0d5-67d1-4ada-8577-9dd6b6e139c1",
language: "fr-FR"
) {
uid
title
}
}
Get Alternative Translations Of An Object's Relationships
This example shows getting an episode in English (en-GB
) and the brands related to that episode in German (de-DE
).
query getEpisode {
getEpisode(
uid: "0b81a0d5-67d1-4ada-8577-9dd6b6e139c1",
language: "en-GB"
) {
uid
title
brands(language: "de-DE") {
objects {
title
synopsis
}
}
}
}
Updated 6 months ago