Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

Expand Down
19 changes: 16 additions & 3 deletions linkcheck/build_meta.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
import os
import subprocess

from setuptools import build_meta as default
from setuptools.build_meta import * # noqa: F401, F403


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,
Expand Down
2 changes: 1 addition & 1 deletion linkcheck/templates/linkcheck/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ <h3 style='display: inline; padding-left: 5px;'>{{report_type}} in '{{object.obj
</td>
</tr>
{% if link.url.redirect_to %}
<tr><td colspan="6">R{% translate "Redirects to" %}: <a href="{{ link.url.redirect_to }}" target="_blank">{{ link.url.redirect_to }}</a></td></tr>
<tr><td colspan="6">{% translate "Redirects to" %}: <a href="{{ link.url.redirect_to }}" target="_blank">{{ link.url.redirect_to }}</a></td></tr>
{% endif %}
{% endfor %}
</table>
Expand Down
Loading