From f2ce63bfe79e150b3ffa7c912bdb0dd37eac8e25 Mon Sep 17 00:00:00 2001
From: Athanasius <github@miggy.org>
Date: Fri, 16 Oct 2020 15:48:56 +0100
Subject: [PATCH] l10n: Close localisation files after reading content

* These are opened in self.file() using codecs.open(), so no quick way
  to convert to a 'with'.
---
 l10n.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/l10n.py b/l10n.py
index 9cc7d946..d6e4677e 100755
--- a/l10n.py
+++ b/l10n.py
@@ -131,6 +131,7 @@ class _Translations:
         """Load all the translations from a translation file."""
         assert lang in self.available()
         translations = {}
+
         h = self.file(lang, plugin_path)
         if not h:
             return {}
@@ -144,6 +145,7 @@ class _Translations:
 
                 elif not _Translations.COMMENT_RE.match(line):
                     logger.debug(f'Bad translation: {line.strip()}')
+        h.close()
 
         if translations.get(LANGUAGE_ID, LANGUAGE_ID) == LANGUAGE_ID:
             translations[LANGUAGE_ID] = str(lang)  # Replace language name with code if missing