Last active
April 6, 2020 08:24
-
-
Save WillsB3/f0012b98dbbed91a30fa1b23d9851caa to your computer and use it in GitHub Desktop.
Django patch to help with testing that content is correctly marked up for translation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# django/utils/translation/trans_real.py | |
# | |
# Add the following to the end of the `do_translate` method (~line 316 in Django 1.11.27), just after the eol_message assignment. | |
# | |
# This replaces characters within content marked up for translation with `#`. The idea is that, with this | |
# patch applied, you can browse the site and look for any copy that has not been replaced with `#`. Any | |
# copy you find will not yet have been marked up for translation. | |
import re | |
return re.sub(r'[^ ]', r'#', message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment