Support grdp files in translation screenshot presubmit
Translation screenshots project requires Chrome devs to upload UI screenshots along with string changes in .grd and .grdp files. These are XML files containing all user visible strings in Chrome. Translation screenshots has a presubmit checks that extracts the list of modified strings, looks for image files associated with these strings and warns the developer to add them if they are missing. This presubmit parses .grds to extract the list of modified strings but it skips <part> tags which are used to reference .grdp files. As a result, the presubmit currently ignores string changes in .grdp files. .grdp files contain the majority of UI strings in Chrome, so the lack of presubmit checks for them results in low translation screenshot coverage. This CL changes how .grdp files are loaded in the presubmit: Previously, they were written in a temporary directory alongside a fake .grd file that referenced the loaded .grdp file. The code loaded the fake .grd file which resulted in loading the strings in the actual .grdp file. However, test mocks override all os.path methods which in turn breaks temporary directory creation. As a result, it was not possible to properly test the .grdp loading code, so we skipped <part> tags as a workaround. The new loading code writes a temporary copy of the .grdp file and wraps its contents with proper tags so that it can be loaded as a .grd file instead. This avoids the need to create a temporary directory and is fully testable. The end result is that Translation Screenshots presubmit will now ask Chrome devs to upload screenshots for changes in .grdp files. This should significantly increase the coverage of strings with translation screenshots, leading to better quality in string localizations. Bug: 924652 Change-Id: Iae7933e8147cefdabc15ef21d2b6daa43d5002bc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1875554Reviewed-by:anthonyvd <anthonyvd@chromium.org> Reviewed-by:
Jochen Eisinger <jochen@chromium.org> Commit-Queue: Mustafa Emre Acer <meacer@chromium.org> Cr-Commit-Position: refs/heads/master@{#714550}
Showing
This diff is collapsed.
Please register or sign in to comment