Skip to content

fix(translations): correct swapped pt min/max rows validation messages - #19431

Open
gbelther wants to merge 1 commit into
payloadcms:mainfrom
gbelther:fix/translations-pt-min-max-rows-main
Open

gbelther wants to merge 1 commit into
payloadcms:mainfrom
gbelther:fix/translations-pt-min-max-rows-main

Conversation

@gbelther

@gbelther gbelther commented Nov 7, 2026

Copy link
Copy Markdown

What?

main (v4) equivalent of #19430.

Fixes the Portuguese (pt) validation messages for array and blocks fields that use minRows / maxRows, plus two smaller issues found on the way:

  • pt: validation:requiresAtLeast and validation:requiresNoMoreThan had their meanings swapped.
  • pt: version:noRowsSelected used a translated placeholder ({{rótulo}}) instead of {{label}}.
  • ui: the Blocks field min-rows banner picked general:row / general:rows the wrong way round.

Why?

  • With the admin in Portuguese, an array with minRows: 2 and one row showed "Esse campo requer no máximo 2 Linhas" (at most), and going over maxRows showed "requer pelo menos" (at least). Every other language has these the right way round.
  • {{rótulo}} is never interpolated because callers pass label, so the placeholder would render literally.
  • When a blocks field has no custom labels, the banner fell back to t(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 existing noRowsFound)
  • packages/ui/src/fields/Blocks/index.tsx: flipped the fallback ternary to match packages/ui/src/fields/Array/index.tsx.

No new keys, so no other languages need updating.

The Blocks minRows default fix from #19430 isn't included: on main the Blocks field already uses minRowsProp ?? (required ? 1 : 0).

Verified locally on main:

  • pnpm vitest run --project unit packages/payload/src/fields/validations.spec.ts: 123 passed.
  • oxlint on the changed files: no errors (only pre-existing warnings on untouched lines). oxfmt --check: clean. tsc --noEmit -p packages/translations: clean.
  • Manually in pnpm dev fields (SQLite) with the admin set to Portuguese: arrayWithMinRows and blocksWithMinRows now show "Esse campo requer pelo menos 2 …", and testBlocks (maxRows: 1) with two rows shows "Esse campo permite no máximo 1 …".

Also fixes the pt translated placeholder ({{rótulo}}) listed in #18876. The pt: ['version:noRowsSelected'] entry in the knownIssues list added by #18883 can be dropped once this lands.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This change corrects Portuguese validation messages and the noRowsSelected placeholder. It also updates the Blocks minimum-row fallback to select general:rows when minRows is greater than 1.

Changes: Validation message corrections

Layer / File(s) Summary
Validation labels
packages/translations/src/languages/pt.ts, packages/ui/src/fields/Blocks/index.tsx
The Portuguese messages now state the correct count limits and use the {{label}} placeholder. The Blocks fallback now selects general:rows when minRows > 1 and general:row otherwise.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

Suggested reviewers: jarrodmflesch

Merge Risk: Minimal · up to c0d7e

The change corrects Portuguese messages and the Blocks row-label fallback. No merge-blocking risk is identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly describes the Portuguese min/max validation message changes.
Description check Passed The description relates to the translation and Blocks field changes.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cfa7d6e and c0d7e52.

Files selected for processing: 2

  • packages/translations/src/languages/pt.ts
  • packages/ui/src/fields/Blocks/index.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant