From: Tomas R. Date: Mon, 9 Dec 2024 12:35:24 +0000 (+0100) Subject: Simplify read_mo logic (#1148) X-Git-Tag: v2.17.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16f292873d50bf564a6d93c758213cd9e9af2fdf;p=thirdparty%2Fbabel.git Simplify read_mo logic (#1148) --- diff --git a/babel/messages/mofile.py b/babel/messages/mofile.py index 0291b07c..28f89c57 100644 --- a/babel/messages/mofile.py +++ b/babel/messages/mofile.py @@ -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