[FOLIO-3743] Prevent bad translations from entering the system Created: 23/Mar/23  Updated: 23/Mar/23

Status: Open
Project: FOLIO
Components: Continuous Integration
Affects versions: None
Fix versions: None

Type: Story Priority: TBD
Reporter: Mike Taylor Assignee: Peter Murray
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Sprint:
Development Team: None
RCA Group: TBD

 Description   

As described in UIHAADM-23 Closed , some bad translations made it into one of the translations files of ui-harvester-admin in a way that prevented the package from building (though not from running in development, where a different pipeline is used).

The problems — there were several — turned out to be to do with XML formatting in the translation texts: incorrect use of spaces such as <tag > or <tag/ >, or the presence of an opening tag that had no closing tag. These get rejected when building translation bundles:

$ formatjs compile-folder --ast --format simple ./translations/ui-harvester-admin ./translations/ui-harvester-admin/compiled
[@formatjs/cli] [WARN] Error validating message "对于XML数据。对于XML提要,这通常应该设置为 1,如果我们想在数据结构中收集记录元素,例如: <root>   <record/ >  <record/ > < /root>" with ID "harvestables.field.splitAt.help" in file "./translations/ui-harvester-admin/zh_CN.json"
SyntaxError: INVALID_TAG
    at parse (/home/runner/work/ui-harvester-admin/ui-harvester-admin/node_modules/@formatjs/icu-messageformat-parser/index.js:34:21)
    at /home/runner/work/ui-harvester-admin/ui-harvester-admin/node_modules/@formatjs/cli/src/compile.js:48:79
    at step (/home/runner/work/ui-harvester-admin/ui-harvester-admin/node_modules/tslib/tslib.js:193:27)
    at Object.next (/home/runner/work/ui-harvester-admin/ui-harvester-admin/node_modules/tslib/tslib.js:174:57)
    at fulfilled (/home/runner/work/ui-harvester-admin/ui-harvester-admin/node_modules/tslib/tslib.js:164:62)
error Command failed with exit code 1.

We should try to prevent such bad translations from getting merged. Somehow, we need formatjs compile-folder or an equivalent to be run as part of a pre-merge process, to find errors before they get merged. Better still, we should verify translations as they are added in the translation UI, to prevent them from even getting that far.


Generated at Thu Feb 08 23:30:22 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.