Problem/Motivation

For now, the module translates the value of the #title, #description, and the #options labels automatically.

But in some cases, it might be necessary to translate other parts of the YAML structure. For this, we can reuse the "tags" feature of the YAML files and use the !translate tag for values that should be translatable.

The same issue is with Drupal Recipes - see #3488972: [Meta] Make recipes translatable, and it seems they chose the way of using YAML tags for this, see this issue #3313863: Translation of recipe input and config actions [monolingual] for the progress.

So, let's try to implement the same approach in the Schema Form module too.

Comments

murz created an issue.

murz’s picture

To read the YAML tags correctly, seems we have to use the Symfony YAML library (Symfony\Component\Yaml\Yaml) with the flag Yaml::PARSE_CUSTOM_TAGS, because the Drupal YAML (Drupal\Component\Serialization\Yaml) doesn't allow passing custom YAML flags to the parser.

murz’s picture

Let's maybe just wait until the tag support is added to the Drupal YAML library by this MR: https://git.drupalcode.org/project/drupal/-/merge_requests/12121/diffs#6...