内容丰富的graphql API无法获取本地化的`linkedfrom`项目

时间:2019-11-26 17:21:51

标签: graphql contentful contentful-api

基本上,我想获取链接到我的唯一条目的条目的本地化值。

d1 = pd.to_datetime('2019-06-01')
d2 = pd.to_datetime('2019-06-30')
df[df.Date.between(d1, d2)]

但是我在集合数组中没有任何结果。直接查询df[df.Date.between('2019-06-01', '2019-06-30')] 可以获得本地化值,并且具有 Sub Send_Invoices() Dim edress As String Dim strfrom As String Dim subj As String Dim message As String Dim filename As String Dim filename2 As String Dim outlookapp As Object Dim outlookmailitem As Object Dim myAttachments As Object Dim path As String Dim lastrow As Integer Dim attachment As String Dim attachment2 As String Dim x As Integer Dim wk As Worksheet 'Define Worksheet Set wk = Worksheets("Sending Invoices") 'Add +1 to the Lookup Cell Do Range("F1").Value = Range("F1").Value + 1 Set outlookapp = CreateObject("Outlook.Application") Set outlookmailitem = outlookapp.CreateItem(0) Set myAttachments = outlookmailitem.Attachments path = "C:\Users\...\Desktop\...\Invoices\" 'Set the recipient address column edress = wk.Cells(8, 12) 'Set the Subject subj = "12/1/2019: Annual Support for ..." 'Set the filename and location of Invoice filename = wk.Cells(2, 4) attachment = wk.Cells(2, 6) 'Repeat for the Subscriber Lists filename2 = wk.Cells(2, 5) attachment2 = wk.Cells(2, 7) outlookmailitem.To = edress outlookmailitem.cc = "" outlookmailitem.bcc = "" outlookmailitem.Subject = subj outlookmailitem.body = "Dear ..." myAttachments.Add (attachment) myAttachments.Add (attachment2) 'outlookmailitem.Display outlookmailitem.send lastrow = lastrow + 1 edress = "" x = x + 1 Set outlookapp = Nothing Set outlookmailitem = Nothing Loop Until Range("F1") >= Range("F2") End Sub 中使用的一些匹配movie(id: $movieId) { linkedFrom { spanishMovieLocations: movieLocationCollection(locale: "es-ES") { items {//fields with localized values} } } }

这很好用,但是我没有得到所需的本地化字段。

movieLocationCollection(locale: "es-ES")

1 个答案:

答案 0 :(得分:1)

来自内容丰富的网站:

我们...通过引入新的allowedLocales参数,使查询本地化参考内容更加容易。

https://www.contentful.com/blog/2020/12/03/three-new-graphql-features-2020/

movie(id: $movieId) {
  linkedFrom(allowedLocales: ["es-ES"]) {
    movieLocationCollection { 
      items {//fields with non-localized values} 
    }
  }
}

在我的项目中,我必须同时包含两个语言环境

query ($parner: String) { 
  partnerCollection(limit: 1, locale: "fr-CA", where: {title: $parner}) {
    items {
      title
      sys {
        id
      }
      linkedFrom(allowedLocales: ["en-US", "fr-CA"]) {
        benefitCollection(limit: 3) {
          total
          items {
            title
          }
        }
      }
    }
  }
}