dkan icon indicating copy to clipboard operation
dkan copied to clipboard

Translateable form and schemas

Open dafeder opened this issue 10 months ago • 0 comments

Following up #3684

Because the forms are build from schema and ui-schema JSON files, they are localize-able in the same way other Drupal forms are.

One solution could be to have multiple JSON schemas that match a locale name by convention, but there are some issues with this approach. I think there needs to be one single-language schema file that reflects the default language on the website that is the single-source-of-truth validation schema. Then any parts that need to be localized are translated individually.

Some ways to deal with this could be:

  1. Somehow have DKAN register the translatable parts of the schema with the Drupal string translation system. You can then use the i18n UI to add translations for each string, and those strings are localized before being used on the form.
  2. Accommodate this somehow in the .ui.json files. Perhaps in addition to ui:options keys we can have ui:locale strings or something, and allow individual schema elements to be translated there.
  3. Support packaging .po files along with our schemas, which I think has some precedent in the JSON schema ecosystem.

dafeder avatar Mar 05 '25 20:03 dafeder