openlibrary
openlibrary copied to clipboard
Update `i18n` warn regex and escape relevant files
Sub-task of #9486.
Fix. Adjusts the i18n
WARN
syntax to only flag text wrapped in $(' ')
or $(" ")
, the chosen syntax for intentionally untranslated text. This way, we avoid flagging Python insertions wrapped in parentheses, and can remove a number of files from the exclude list.
Technical
Also involved adding the skip_directive
to escape a few last Python lines still accidentally caught by the script.
Testing
- Add a new line of Python into an HTML file wrapping it in the following:
$( )
- Run the script with
pre-commit run detect-missing-i18n --all-files
, you should not see a warning appear - Change existing
i18n
syntax or add a new line you think shouldn't be translated, using the preferred warning syntax, i.e.$('https://www.google.com')
- Run the script again, the script should still pass but a warning will appear
Screenshot
Stakeholders
@mekarpeles @pidgezero-one