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
- Enable Locale and add a second language.
- With the interface in that language, save content whose text field breaks a Vale rule twice.
- 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()andisEmpty()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
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
Comment #5
deciphered