Repository navigation
Conversation
In Portuguese, `validation:requiresAtLeast` said "no máximo" and
`validation:requiresNoMoreThan` said "pelo menos", so array/blocks fields
with `minRows`/`maxRows` showed the opposite constraint.
- pt: swap the two messages back to their correct meaning
- pt: fix `version:noRowsSelected` using a translated `{{rótulo}}`
placeholder instead of `{{label}}`, which rendered literally
- ui: fix inverted singular/plural fallback in the Blocks min rows banner
so it matches the Array field
Equivalent of payloadcms#19430 for main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What?
main(v4) equivalent of #19430.Fixes the Portuguese (
pt) validation messages for array and blocks fields that useminRows/maxRows, plus two smaller issues found on the way:pt:validation:requiresAtLeastandvalidation:requiresNoMoreThanhad their meanings swapped.pt:version:noRowsSelectedused a translated placeholder ({{rótulo}}) instead of{{label}}.ui: the Blocks field min-rows banner pickedgeneral:row/general:rowsthe wrong way round.Why?
minRows: 2and one row showed "Esse campo requer no máximo 2 Linhas" (at most), and going overmaxRowsshowed "requer pelo menos" (at least). Every other language has these the right way round.{{rótulo}}is never interpolated because callers passlabel, so the placeholder would render literally.labels, the banner fell back tot(minRows > 1 ? 'general:row' : 'general:rows'), producing e.g. "at least 2 Row" / "at least 1 Rows" in every language. The Array field already uses'general:rows' : 'general:row'.How?
packages/translations/src/languages/pt.ts:requiresAtLeast:'Esse campo requer pelo menos {{count}} {{label}}.'requiresNoMoreThan:'Esse campo permite no máximo {{count}} {{label}}.'noRowsSelected:'Nenhum(a) {{label}} selecionado(a)'(same pattern as the existingnoRowsFound)packages/ui/src/fields/Blocks/index.tsx: flipped the fallback ternary to matchpackages/ui/src/fields/Array/index.tsx.No new keys, so no other languages need updating.
The Blocks
minRowsdefault fix from #19430 isn't included: onmainthe Blocks field already usesminRowsProp ?? (required ? 1 : 0).Verified locally on
main:pnpm vitest run --project unit packages/payload/src/fields/validations.spec.ts: 123 passed.oxlinton the changed files: no errors (only pre-existing warnings on untouched lines).oxfmt --check: clean.tsc --noEmit -p packages/translations: clean.pnpm dev fields(SQLite) with the admin set to Portuguese:arrayWithMinRowsandblocksWithMinRowsnow show "Esse campo requer pelo menos 2 …", andtestBlocks(maxRows: 1) with two rows shows "Esse campo permite no máximo 1 …".Also fixes the
pttranslated placeholder ({{rótulo}}) listed in #18876. Thept: ['version:noRowsSelected']entry in theknownIssueslist added by #18883 can be dropped once this lands.🤖 Generated with Claude Code