Skip to content

Commit

Permalink
Simplify read_mo logic (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 authored Dec 9, 2024
1 parent 967f5d1 commit 16f2928
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions babel/messages/mofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ def read_mo(fileobj: SupportsRead[bytes]) -> Catalog:
if b'\x00' in msg: # plural forms
msg = msg.split(b'\x00')
tmsg = tmsg.split(b'\x00')
if catalog.charset:
msg = [x.decode(catalog.charset) for x in msg]
tmsg = [x.decode(catalog.charset) for x in tmsg]
msg = [x.decode(catalog.charset) for x in msg]
tmsg = [x.decode(catalog.charset) for x in tmsg]
else:
if catalog.charset:
msg = msg.decode(catalog.charset)
tmsg = tmsg.decode(catalog.charset)
msg = msg.decode(catalog.charset)
tmsg = tmsg.decode(catalog.charset)
catalog[msg] = Message(msg, tmsg, context=ctxt)

# advance to next entry in the seek tables
Expand Down

0 comments on commit 16f2928

Please sign in to comment.