Problem/Motivation

In #1493324-308: Inline form errors for accessibility and UX
there is a list of things programatically created that is user facing text.

Usually when hand crafting messages (like in module help pages),
we follow https://www.drupal.org/style-guide/content#english
and make list like:

This: one.
This: one and two.
This: one, two, and three.

Proposed resolution

See comment #308 (and around there for discussion and some code that could be used).

Do the style guide way.

Remaining tasks

would be to:
find all the programatically created lists...
use some kind of method to format them.

User interface changes

API changes

Comments

YesCT’s picture

Status: Active » Closed (won't fix)
Issue tags: +D8MI

See #1493324-315: Inline form errors for accessibility and UX
and
#1493324-309: Inline form errors for accessibility and UX

@Gábor Hojtsy

Right, we don't do ", , and " magic elsewhere. If we need to do it here for some reason, then we can make something like the following happen: t('@errors and @last_error' ....); where you remove the last item from the list to display separately. Languages that do not have this construct can add a comma in place of ' and ' in this string and get the same. However that would require a high level of attention from the translator to figure out.

Why do we need this here even though we don't use it elsewhere?

@tstoeckler

Elsewhere we just leave it at all commas.

YesCT’s picture

#316 from that issue also:

YesCT asked for examples of commas. A quick grep on code we use to tell admins when .info files are invalid or dependent modules or themes are missing:

core/lib/Drupal/Core/Extension/InfoParser.php:          $message = String::format('Missing required keys (!missing_keys) in !file.', array(!missing_keys' => implode(', ', $missing_keys), '!file' => $filename));
core/lib/Drupal/Core/Extension/ModuleInstaller.php:          '%modules' => implode(', ', $module_list),
core/lib/Drupal/Core/Extension/ModuleInstaller.php:          '%missing' => implode(', ', $missing_modules),
core/lib/Drupal/Core/Extension/ModuleInstaller.php:        $reason_message[] = implode(', ', $reason);
core/lib/Drupal/Core/Extension/ModuleInstaller.php:        '@reasons' => implode(', ', $reason_message),
core/lib/Drupal/Core/Extension/ThemeHandler.php:          '!themes' => implode(', ', $missing),