Problem/Motivation

When Vale joins the findings in one field into one validation message, it renames every placeholder by the finding's number, such as @field0 and @rule0, and translates the joined template. Each set of findings is then looked up as a new source string. Locale stores every one for translators, and a site that translated the constraint messages never sees those translations used. Even one finding is looked up as @field0: @rule0: @message0 (line @line0: "@match0") instead of the constraint's own message.

Steps to reproduce

  1. Enable Locale and add a second language.
  2. With the interface in that language, save content whose text field breaks a Vale rule twice.
  3. Open User interface translation and search for @field0. The renamed and joined templates are listed as source strings.

Proposed resolution

  • Add one finding as an ordinary violation, with the constraint's message and its own placeholders.
  • Translate each of several findings by itself, with its own placeholders, then join them as before. Add the joined message to the context directly, so it is not translated again.
  • Remove the internal FindingList::message() and isEmpty() methods, which nothing else uses.

The rendered messages do not change.

Remaining tasks

Review.

User interface changes

None.

API changes

None. FindingList is internal.

Data model changes

None.

Issue fork vale-3639094

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

deciphered created an issue. See original summary.

  • deciphered committed 31fd9ffa on 1.0.x
    fix(#3639094): keep each finding's placeholders so its message is...

  • deciphered committed 31fd9ffa on 1.1.x
    fix(#3639094): keep each finding's placeholders so its message is...
deciphered’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.