From ddac6665da685ab7baccebea4a73f84ddee3c15a Mon Sep 17 00:00:00 2001 From: Ryan Li <13653603496@163.com> Date: Mon, 17 Aug 2026 11:59:28 +0800 Subject: [PATCH 1/2] Fix false positive python-format detection on space-flag pattern --- babel/messages/catalog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py index 5686b3141..d0bf6f910 100644 --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -74,7 +74,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6): \% (?:\(([\w]*)\))? ( - [-#0\ +]?(?:\*|[\d]+)? + [-#0+]?(?:\*|[\d]+)? (?:\.(?:\*|[\d]+))? [hlL]? ) From afc7fef23d1dd8c63b9ed9824bb581b0b7b5efa1 Mon Sep 17 00:00:00 2001 From: Ryan Li <13653603496@163.com> Date: Mon, 17 Aug 2026 17:01:15 +0800 Subject: [PATCH 2/2] Downgrade TranslationError to warning(frontend.py) in compile_catalog --- babel/messages/frontend.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index c80bcbeb8..a046f81e4 100644 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -198,13 +198,13 @@ def finalize_options(self): raise OptionError('you must specify either the output file or the base directory') def run(self): - n_errors = 0 + n_warnings = 0 for domain in self.domain: for errors in self._run_domain(domain).values(): - n_errors += len(errors) - if n_errors: - self.log.error('%d errors encountered.', n_errors) - return 1 if n_errors else 0 + n_warnings += len(errors) + if n_warnings: + self.log.warning('%d warnings encountered.', n_warnings) + return 0 def _get_po_mo_triples(self, domain: str): if not self.input_file: @@ -262,7 +262,7 @@ def _run_domain(self, domain): catalogs_and_errors[catalog] = catalog_errors = list(catalog.check()) for message, errors in catalog_errors: for error in errors: - self.log.error('error: %s:%d: %s', po_file, message.lineno, error) + self.log.warning('warning: %s:%d: %s', po_file, message.lineno, error) self.log.info('compiling catalog %s to %s', po_file, mo_file)