Skip to content

Commit

Permalink
Addressing problems raised in sphinx_issues sphinx-doc#10104
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangduytranuk committed Apr 22, 2022
1 parent 068f802 commit 9fa160a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinx/builders/gettext.py
@@ -1,5 +1,5 @@
"""The MessageCatalogBuilder class."""

import os
from codecs import open
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta, tzinfo
Expand Down Expand Up @@ -32,7 +32,7 @@ class Message:
"""An entry of translatable message."""
def __init__(self, text: str, locations: List[Tuple[str, int]], uuids: List[str]):
self.text = text
self.locations = locations
self.locations = list(set(locations))
self.uuids = uuids


Expand All @@ -57,7 +57,7 @@ def add(self, msg: str, origin: Union[Element, "MsgOrigin"]) -> None:

def __iter__(self) -> Generator[Message, None, None]:
for message in self.messages:
positions = [(source, line) for source, line, uuid in self.metadata[message]]
positions = [(os.path.relpath(source, start=os.getcwd()), line) for source, line, uuid in self.metadata[message]]
uuids = [uuid for source, line, uuid in self.metadata[message]]
yield Message(message, positions, uuids)

Expand Down

0 comments on commit 9fa160a

Please sign in to comment.