Describe the Bug
The beforeDuplicate implementation iterates all locales here and passes the value to the defined hooks:
https://github.com/payloadcms/payload/blob/main/packages/payload/src/fields/hooks/beforeDuplicate/promise.ts#L72
However, the locale value never gets passed to the hook. For instance the following hook gets the wrong locale (always the same value):
hooks: {
beforeDuplicate: [
({ value, req: { locale } }: FieldHookArgs<Page>) => createDuplicateTitle(value, locale)
]
}
The solution would be to pass a different req.locale value:
const beforeDuplicateArgs: FieldHookArgs = {
blockData,
collection,
context,
data: doc as Partial<T>,
field,
global: undefined!,
indexPath: indexPathSegments,
path: pathSegments,
previousSiblingDoc: siblingDoc,
previousValue: siblingDoc[field.name!]?.[locale],
req: {
...req,
locale
},
schemaPath: schemaPathSegments,
siblingData: siblingDoc,
siblingDocWithLocales: siblingDoc,
siblingFields: siblingFields!,
value: siblingDoc[field.name!]?.[locale],
}
This would allow us to localize the field's value in the hook.
Link to the code that reproduces this issue
https://github.com/cbratschi/payload
Reproduction Steps
Define beforeDuplicate hook and check req.locale.
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 26.3.0
npm: 11.16.0
Yarn: N/A
pnpm: N/A
Relevant Packages:
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.5.0: Mon Apr 27 20:39:42 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6031
Available memory (MB): 65536
Available CPU cores: 16
Describe the Bug
The beforeDuplicate implementation iterates all locales here and passes the value to the defined hooks:
https://github.com/payloadcms/payload/blob/main/packages/payload/src/fields/hooks/beforeDuplicate/promise.ts#L72
However, the locale value never gets passed to the hook. For instance the following hook gets the wrong locale (always the same value):
The solution would be to pass a different req.locale value:
This would allow us to localize the field's value in the hook.
Link to the code that reproduces this issue
https://github.com/cbratschi/payload
Reproduction Steps
Define beforeDuplicate hook and check req.locale.
Which area(s) are affected?
area: core
Environment Info