Skip to content

Commit 16f2928

Browse files
authored
Simplify read_mo logic (#1148)
1 parent 967f5d1 commit 16f2928

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

babel/messages/mofile.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ def read_mo(fileobj: SupportsRead[bytes]) -> Catalog:
8989
if b'\x00' in msg: # plural forms
9090
msg = msg.split(b'\x00')
9191
tmsg = tmsg.split(b'\x00')
92-
if catalog.charset:
93-
msg = [x.decode(catalog.charset) for x in msg]
94-
tmsg = [x.decode(catalog.charset) for x in tmsg]
92+
msg = [x.decode(catalog.charset) for x in msg]
93+
tmsg = [x.decode(catalog.charset) for x in tmsg]
9594
else:
96-
if catalog.charset:
97-
msg = msg.decode(catalog.charset)
98-
tmsg = tmsg.decode(catalog.charset)
95+
msg = msg.decode(catalog.charset)
96+
tmsg = tmsg.decode(catalog.charset)
9997
catalog[msg] = Message(msg, tmsg, context=ctxt)
10098

10199
# advance to next entry in the seek tables

0 commit comments

Comments
 (0)