]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Simplify read_mo logic (#1148)
authorTomas R. <tomas.roun8@gmail.com>
Mon, 9 Dec 2024 12:35:24 +0000 (13:35 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Dec 2024 12:35:24 +0000 (14:35 +0200)
babel/messages/mofile.py

index 0291b07cc741d8c6ff8ce7a8ab88b88f28bc6ff6..28f89c571309ef4f4f82e53c76ab2bd7a029b176 100644 (file)
@@ -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