Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

  • Explore repository structure and understand the issue
  • Understand gettext library and how mergeWith works
  • Create test scenario to reproduce the issue
  • Implement solution to preserve POT file order in update-po command
  • Add tests for the new functionality
  • Address code review feedback - fix docblock placement
  • Fix Behat test syntax to use correct step definition
  • Manually verify the fix with additional test scenarios
  • Run security check

Summary

Successfully implemented POT file order preservation in the update-po command. The solution:

  1. Added reorder_translations() method: After merging PO and POT translations, this method creates a new Translations object with entries ordered according to the POT file.

  2. Preserves all translation data: The solution maintains all translations, comments, metadata, and headers while only changing the order.

  3. Works with all entry types: Tested with simple translations, plural forms, translations with contexts, translator comments, extracted comments, references, and new/existing translations.

  4. Backward compatible: Existing tests will pass as the functionality remains the same, only the order changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>update-po: Keep POT's order of translations</issue_title>
<issue_description>It would be nice (if not the default, as an option) to keep translations in the order they appear in the POT file when executing the update-po command.

This would help translators better understand the context (keep messages close to one another if they originate from the same source file) and make the diffs clearer (for instance, when a source message is changed in the code).</issue_description>

Comments on the Issue (you are @copilot in this section)

@swissspidy Interesting suggestion!

Not sure if the underlying library we use actually supports this. It would require some investigation.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 3, 2025 14:09
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] update-po: Keep POT's order of translations Preserve POT file order when updating PO files Nov 3, 2025
Copilot AI requested a review from swissspidy November 3, 2025 14:17
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy November 3, 2025 14:31
@swissspidy swissspidy marked this pull request as ready for review November 3, 2025 17:35
@swissspidy swissspidy requested a review from a team as a code owner November 3, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update-po: Keep POT's order of translations

2 participants