Hi guys,
Iâm quite new at the Strapi and I have a problem how fetch localized data using GraphQL. Here I found the information how to query data using REST API, but I cannot find what Iâm doing wrong using GraphQL.
This is a JSON structure of response for the default lang (de-CH):
{
âidâ: 5,
âlocaleâ: âde-CHâ,
âpublished_atâ: â2021-05-11T12:04:23.616Zâ,
âcreated_atâ: â2021-05-11T11:56:10.146Zâ,
âupdated_atâ: â2021-05-11T16:44:59.947Zâ,
âmainTitleâ: null,
âcontentâ: null,
âopenDialogButtonLabelâ: "Ich abonniere! ",
âseoâ: {
âidâ: 40,
âmetaTitleâ: âKommt baldâ,
âmetaDescriptionâ: âKommt bald descâ,
âmetaKeywordsâ: ââ,
âpreventIndexingâ: false,
âcannonicalLinkâ: null,
âsharedImageâ: null
},
âdialogâ: {
âidâ: 5,
âTitleâ: null,
âOfferSummaryâ: null,
âConfiramtionReminderâ: null,
âRepeatConfirmationReminderâ: null,
âClauseâ: null,
âtitleâ: null,
âconfiramtionReminderâ: null,
ârepeatConfirmationReminderâ: null,
âclauseâ: null,
âofferSummaryâ: null,
âformâ: null
},
âlogoâ: null,
âlocalizationsâ: [
{
âidâ: 3,
âlocaleâ: âpl-PLâ,
âpublished_atâ: â2021-05-12T17:14:19.643Zâ
},
{
âidâ: 6,
âlocaleâ: âen-GBâ,
âpublished_atâ: â2021-05-12T17:16:01.446Zâ
}
]
}
When I test the query without any filters like this:
query MyQuery {
strapiComingSoon {
openDialogButtonLabel
locale
}
}
I get the correct response:
{
âdataâ: {
âstrapiComingSoonâ: {
âopenDialogButtonLabelâ: "Ich abonniere! ",
âlocaleâ: âde-CHâ
}
},
âextensionsâ: {
âenableRefreshâ: â1â
}
}
This is a JSON structure of response for PL version (url/page?_locale=pl=PL)
{
âidâ: 3,
âlocaleâ: âpl-PLâ,
âpublished_atâ: â2021-05-12T17:14:19.643Zâ,
âcreated_atâ: â2021-05-07T12:55:24.182Zâ,
âupdated_atâ: â2021-05-12T17:14:19.859Zâ,
âmainTitleâ: âStrona w budowieâ,
âcontentâ: null,
âopenDialogButtonLabelâ: âZapisujÄ siÄ!â,
âseoâ: {
âidâ: 41,
âmetaTitleâ: âStrona w budowieâ,
âmetaDescriptionâ: âOpis strony w budowieâ,
âmetaKeywordsâ: null,
âpreventIndexingâ: false,
âcannonicalLinkâ: null,
âsharedImageâ: null
},
âdialogâ: {
âidâ: 6,
âTitleâ: null,
âOfferSummaryâ: null,
âConfiramtionReminderâ: null,
âRepeatConfirmationReminderâ: null,
âClauseâ: null,
âtitleâ: null,
âconfiramtionReminderâ: null,
ârepeatConfirmationReminderâ: null,
âclauseâ: null,
âofferSummaryâ: null,
âformâ: null
},
âlogoâ: null,
âlocalizationsâ: [
{
âidâ: 5,
âlocaleâ: âde-CHâ,
âpublished_atâ: â2021-05-11T12:04:23.616Zâ
},
{
âidâ: 6,
âlocaleâ: âen-GBâ,
âpublished_atâ: â2021-05-12T17:16:01.446Zâ
}
]
}
And when I trying query using GraphQL like this (with filter):
query MyQuery {
strapiComingSoon(locale: {eq: âpl-PLâ}) {
openDialogButtonLabel
locale
}
}
In response I get:
{
âdataâ: {
âstrapiComingSoonâ: null
},
âextensionsâ: {
âenableRefreshâ: â1â
}
}
What should I do to fetch Polish version of the Single Type? Thanks in advance for every help