FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Sort MO indexes by encoded context and message keys by fhgffy · Pull Request #1374 · python-babel/babel · GitHub

Repository navigation

Sort MO indexes by encoded context and message keys - #1374

Open
fhgffy wants to merge 1 commit into
python-babel:masterfrom
fhgffy:fix/mo-context-sort
Open

fhgffy wants to merge 1 commit into
python-babel:masterfrom
fhgffy:fix/mo-context-sort

Conversation

fhgffy commented Oct 9, 2026

Copy link
Copy Markdown

MO files require the original-string table to be sorted by its encoded lookup keys. Sorting Message objects orders msgid before context, which can emit an unsorted table when messages have contexts. Babel does not emit a hash table, so binary-search readers depend on this ordering.

Sort the existing descriptors by their serialized context/singular keys before writing the parallel original and translation indexes. Add a regression that checks the emitted tables and translation correspondence with UTF-8 and cp1252 contexts and plural messages.

Validation: the new regression fails on the original source; all 6 MO tests and the complete suite (7,829 passed, 10 skipped, 2 xfailed) pass after the fix. Project Ruff and whitespace/debug hooks and sdist/wheel builds passed.

Specification: https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html

This branch has not been deployed

No deployments
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL