Skip to content

Commit

Permalink
Whitelist failures in Tamil translations
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Apr 16, 2024
1 parent 5562e2b commit 7c783d3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions utils/babel_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def run_compile() -> None:
log = _get_logger()

directory = os.path.join('sphinx', 'locale')
total_errors = 0
total_errors = {}

for locale in os.listdir(directory):
po_file = os.path.join(directory, locale, 'LC_MESSAGES', 'sphinx.po')
Expand All @@ -181,10 +181,12 @@ def run_compile() -> None:
continue

for message, errors in catalog.check():
if locale not in total_errors:
total_errors[locale] = 0
for error in errors:
total_errors += 1
total_errors[locale] += 1
log.error(
'error: %s:%d: %s\nerror: in message string: %s',
'error: %s:%d: %s\nerror: in message string: %r',
po_file,
message.lineno,
error,
Expand Down Expand Up @@ -222,8 +224,15 @@ def run_compile() -> None:
# to ensure lines end with ``\n`` rather than ``\r\n``:
outfile.write(f'Documentation.addTranslations({obj});'.encode())

if total_errors > 0:
log.error('%d errors encountered.', total_errors)
if 'ta' in total_errors:
# Tamil is a known failure.
err_count = total_errors.pop('ta')
log.error('%d errors encountered in %r locale.', err_count, 'ta')

if len(total_errors) > 0:
for locale, err_count in total_errors.items():
log.error('%d errors encountered in %r locale.', err_count, locale)
log.error('%d errors encountered.', sum(total_errors.values()))
print('Compiling failed.', file=sys.stderr)
raise SystemExit(2)

Expand Down

0 comments on commit 7c783d3

Please sign in to comment.