-
Notifications
You must be signed in to change notification settings - Fork 8
Refactor metadata PO files generation #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iangmaia
wants to merge
14
commits into
trunk
Choose a base branch
from
iangmaia/refactor-po-generation
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Generated by 🚫 Danger |
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Rename `po` parameter to `po_data` (min 3 chars) - Fix context description wording in spec Co-Authored-By: Claude Opus 4.5 <[email protected]>
9e9b07e to
2dc9458
Compare
2dc9458 to
fc65181
Compare
iangmaia
commented
Jan 12, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes AINFRA-1724
See discussion on Slack: p1767962906955309-slack-CC7L49W13
See test PR: woocommerce/woocommerce-ios#16502
Summary
The main goal of this PR is to fix the issue when generating the .po / .pot files where new entries aren't present in the output or removed entries are removed. To do that, I've consolidated the metadata PO file generation into a new
PoFileGeneratorclass using gettext. Theios_update_metadata_sourceandan_update_metadata_sourceactions are now deprecated and delegate togp_update_metadata_source.What's Changed
New Features:
source_filesnow accepts{ path: 'file.txt', comment: 'translators: ...' }formatcommit_changesoption: Auto-commit support ongp_update_metadata_sourceOutput Changes:
msgctxtfor deterministic output#.lines) must now be explicitly provided—they're no longer preserved from existing PO filesPO-Revision-Dateis now updated with the current date timeBreaking Changes
Migration
When upgrading, callers need to copy comments from
.po/.potfiles to thegp_update_metadata_sourcecall site in theFastfileto make sure the comments remain in the generated file. SeeMIGRATION.mdfor details.Deprecations
ios_update_metadata_sourcegp_update_metadata_sourcewithcommit_changes: truean_update_metadata_sourcegp_update_metadata_sourceDeprecated actions still work (API unchanged) but the output will be different (the comments and header will be removed and the keys will be sorted alphabetically, mainly).