From 64d43a709246a96a2ea95302b8b9f536df216109 Mon Sep 17 00:00:00 2001 From: Ben Stockermans Date: Tue, 29 Jul 2025 13:24:14 +0100 Subject: [PATCH 1/3] Added environment option to skip compilation of translation files. --- linkcheck/build_meta.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/linkcheck/build_meta.py b/linkcheck/build_meta.py index 435f55d..a75ee56 100644 --- a/linkcheck/build_meta.py +++ b/linkcheck/build_meta.py @@ -1,3 +1,4 @@ +import os import subprocess from setuptools import build_meta as default @@ -5,17 +6,29 @@ def compile_translation_files(): - print("Compile translation files") + print("Compiling translation files...") subprocess.run(["django-admin", "compilemessages"], cwd="linkcheck") +def should_compile_translation_files(): + skip_translations = os.environ.get("LINKCHECK_SKIP_TRANSLATIONS") + if skip_translations and skip_translations.lower() in ("1", "true", "yes", "t", "y"): + return False + + return True + + def build_sdist(sdist_directory, config_settings=None): - compile_translation_files() + if should_compile_translation_files(): + compile_translation_files() + return default.build_sdist(sdist_directory, config_settings) def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): - compile_translation_files() + if should_compile_translation_files(): + compile_translation_files() + return default.build_wheel( wheel_directory, config_settings=config_settings, From a23c839f94e54acd1a99f7401a848d4c5b878620 Mon Sep 17 00:00:00 2001 From: Ben Stockermans Date: Tue, 29 Jul 2025 13:24:21 +0100 Subject: [PATCH 2/3] Typo fix. --- linkcheck/templates/linkcheck/report.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkcheck/templates/linkcheck/report.html b/linkcheck/templates/linkcheck/report.html index a65d577..1734170 100644 --- a/linkcheck/templates/linkcheck/report.html +++ b/linkcheck/templates/linkcheck/report.html @@ -171,7 +171,7 @@

{{report_type}} in '{{object.obj {% if link.url.redirect_to %} - R{% translate "Redirects to" %}: {{ link.url.redirect_to }} + {% translate "Redirects to" %}: {{ link.url.redirect_to }} {% endif %} {% endfor %} From b04f6cd4f70e308ea9a8a4c22011a50baea64be7 Mon Sep 17 00:00:00 2001 From: Ben Stockermans Date: Thu, 31 Jul 2025 09:10:19 +0100 Subject: [PATCH 3/3] Added a note into the README regarding LINKCHECK_SKIP_TRANSLATIONS. --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4b9163f..7e686ec 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,9 @@ Basic usage ----------- #. Install app to somewhere on your Python path (e.g. ``pip install - django-linkcheck``). + django-linkcheck``). If you do not need multilingual support, you can skip + the compilation of the translation files with an environment variable, e.g. + (``LINKCHECK_SKIP_TRANSLATIONS=true pip install django-linkcheck``). #. Add ``'linkcheck'`` to your ``settings.INSTALLED_APPS``.