[damned-lies] fix: error when updating english locale



commit 2d5eb6a45411ecf8183cfde440c742cb9cae43d3
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Sat Jun 26 10:23:56 2021 +0200

    fix: error when updating english locale

 stats/management/commands/update-trans.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/stats/management/commands/update-trans.py b/stats/management/commands/update-trans.py
index fc5e256f..9d289cc5 100644
--- a/stats/management/commands/update-trans.py
+++ b/stats/management/commands/update-trans.py
@@ -25,11 +25,13 @@ class Command(BaseCommand):
     def handle(self, **options):
         self.lang_code = options["lang_code"]
         self.po_dir = settings.BASE_DIR / "po"
-        if self.lang_code != "en":
-            self.po_file = self.po_dir / f"{self.lang_code}.po"
         self.locale_dir = settings.BASE_DIR / "locale" / self.lang_code / "LC_MESSAGES"
+        if self.lang_code == "en":
+            self.po_file = self.po_dir / 'damned-lies.pot'
+        else:
+            self.po_file = self.po_dir / f"{self.lang_code}.po"
+            self._update_django_po_with_code_strings()
 
-        self._update_django_po_with_code_strings()
         # backup code only strings in the code.po file. Remove non code related msgid (mainly coming from 
database)
         code_po_file = str(self.locale_dir / "code.po")
         shutil.copy(str(self.locale_dir / "django.po"), code_po_file)
@@ -46,8 +48,6 @@ class Command(BaseCommand):
             if not self.locale_dir.is_dir():
                 self.locale_dir.mkdir(parents=True, exist_ok=True)
             shutil.copy(self.po_file, self.locale_dir / "django.po")
-        else:
-            self.po_file = self.po_dir / "damned-lies.pot"
         self._call_django_makemessages_command()
 
     def _call_django_makemessages_command(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]