From 0e4478c35a892220c72a9bbc14f9ddf668a5365f Mon Sep 17 00:00:00 2001
From: Matthias Mair <code@mjmair.com>
Date: Mon, 20 Jan 2025 01:10:58 +0100
Subject: [PATCH] do not compile on normal translation/compilation to not
 change the source code (#8912)

---
 tasks.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tasks.py b/tasks.py
index 08e097f2fd..4133005305 100644
--- a/tasks.py
+++ b/tasks.py
@@ -419,7 +419,7 @@ def remove_mfa(c, mail=''):
 def static(c, frontend=False, clear=True, skip_plugins=False):
     """Copies required static files to the STATIC_ROOT directory, as per Django requirements."""
     if frontend and node_available():
-        frontend_trans(c)
+        frontend_trans(c, extract=False)
         frontend_build(c)
 
     info('Collecting static files...')
@@ -1228,7 +1228,7 @@ def frontend_compile(c):
     """
     info('Compiling frontend code...')
     frontend_install(c)
-    frontend_trans(c)
+    frontend_trans(c, extract=False)
     frontend_build(c)
     success('Frontend compilation complete')
 
@@ -1244,15 +1244,16 @@ def frontend_install(c):
     yarn(c, 'yarn install')
 
 
-@task
-def frontend_trans(c):
+@task(help={'extract': 'Extract translations (changes sourcecode), default: True'})
+def frontend_trans(c, extract: bool = True):
     """Compile frontend translations.
 
     Args:
         c: Context variable
     """
     info('Compiling frontend translations')
-    yarn(c, 'yarn run extract')
+    if extract:
+        yarn(c, 'yarn run extract')
     yarn(c, 'yarn run compile')