Skip to content

Commit

Permalink
Merge pull request #10503 from AA-Turner/gettext-catalogue-fix
Browse files Browse the repository at this point in the history
`gettext`: Ensure positions always sort
  • Loading branch information
tk0miya authored Jun 1, 2022
2 parents 113e1d8 + a1ecf99 commit 433c67e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def add(self, msg: str, origin: Union[Element, "MsgOrigin"]) -> None:
if msg not in self.metadata: # faster lookup in hash
self.messages.append(msg)
self.metadata[msg] = []
self.metadata[msg].append((origin.source, origin.line, origin.uid)) # type: ignore
line = origin.line
if line is None:
line = -1
self.metadata[msg].append((origin.source, line, origin.uid)) # type: ignore

def __iter__(self) -> Generator[Message, None, None]:
for message in self.messages:
Expand Down

0 comments on commit 433c67e

Please sign in to comment.