Skip to content

locale:"all" on payload.update #4706

@Utzel-Butzel

Description

@Utzel-Butzel

Describe the Bug

I'm currently building a plugin for translating the content of a page via GPT and the most efficient way would be to update multiple languages at once. Do you may know if there is a way to achieve this or if I should work directly with the mongooseAdapter?

The plugin: https://github.com/wirewirewirewire/payload-ai

const updatedLanguage = await req.payload.update({
  // req,
  collection: collection.slug,
  id: doc.id,
  data: {
    content: {
      en: 'English content',
      es: 'Spanish content',
    },
  },
  locale: 'all',
  })
}

This doesn't throw an error but also does not update the content.

Many thanks for building Payload! :)

To Reproduce

Any update using the local API with locale="all" set.

const result = await req.payload.update({
  // req,
  collection: collection.slug,
  id: doc.id,
  data: {
    content: {
      en: 'English content',
      es: 'Spanish content',
    },
  },
  locale: 'all',
  })
}

The result will return the unchanged content, but the expected output would be:

{
  "content": {
      "en": "English content",
      "es": "Spanish content",
    }
}

Payload Version

2.6.2

Adapters and Plugins

localization

#3189

Metadata

Metadata

Assignees

Labels

status: needs-triagePossible bug which hasn't been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions