openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Add `messages.pot` updates to pre-commit hook (if possible)

Open rebecca-shoptaw opened this issue 1 year ago • 0 comments

Describe the problem that you'd like solved

It would be nice if the messages.pot file, which stores all the to-be-translated strings and their locations in the current version of the code, could be updated automatically with new PRs to keep everything more up to date for translators. After finishing up a bulk update to the messages.pot file for translations (#8817), I was talking with @cdrini about options for automating the process:

Proposal & Constraints

I'm not sure how the implementation for this would work, or whether it would be possible, but ideally one would bundle in the command that generates a new messages.pot file -- docker compose run --rm -uroot home ./scripts/i18n-messages extract -- into the already-existing pre-commit hook. More info re: updating in the documentation.

This would be great, as it would mean that any time someone adds a new untranslated string, or modifies a file so the string line numbers are different, the update to the translation file would be included in the PR. Optionally/if possible, it would be great if the translation update could only run if the Python and/or HTML files had been modified, as those are the only changes that would affect it.

Alternatively, either if this isn't possible or just as a stop-gap measure, one could add a note to the Git Cheat Sheet that requests that people run the command themselves as part of the PR if their update has involved adding/changing any on-screen text. If this is the preferred solution or just something that would be good in the meantime, I'd be happy to do that update myself!

Additional context

Stakeholders

@cdrini

rebecca-shoptaw avatar Feb 13 '24 19:02 rebecca-shoptaw